New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[whitespace/parens] Spurious warning within comment #210
Comments
Thanks for reporting. |
I modified the above program to actually use the line that was in the comment, to see what would happen: $ cat tmp/src/man3/dlopen.3.d/dlopen.c
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <gnu/lib-names.h> /* Defines LIBM_SO (which will be a
string such as "libm.so.6") */
int
main(void)
{
void *handle;
double (*cosine)(double);
char *error;
handle = dlopen(LIBM_SO, RTLD_LAZY);
if (!handle) {
fprintf(stderr, "%s\n", dlerror());
exit(EXIT_FAILURE);
}
dlerror(); /* Clear any existing error */
// cosine = (double (*)(double)) dlsym(handle, "cos");
*(void **) (&cosine) = dlsym(handle, "cos");
error = dlerror();
if (error != NULL) {
fprintf(stderr, "%s\n", error);
exit(EXIT_FAILURE);
}
printf("%f\n", (*cosine)(2.0));
dlclose(handle);
exit(EXIT_SUCCESS);
} That line of code is fine, according to the standards. But cpplint(1) still warns; see below.
However, it makes sense if cpplint(1) is not powerful enough to parse such complex lines of code, and would understand if it can't be fixed without important changes to the program. |
I believe the warning is about this comment:
And I think cpplint has trouble identiifying |
Ahh, yes, sorry, I forgot about it :) |
cpplint(1) is triggering a warning from something that resembles a function but within a comment. Comments can have anything in them, and doesn't necessarily represent a function (and in this case, obviously isn't).
The text was updated successfully, but these errors were encountered: