hi,
#include <sys/time.h> int main() { struct timeval a = {0}; struct timeval b = {0}; return timercmp(&a, &b, <); }
gives:
cppcheck.c:6:29: error: syntax error: <) [syntaxError] return timercmp(&a, &b, <);
this is, afaik, valid syntax.
thanks, jacob
GCC chokes on it: https://ideone.com/yvgfUJ
hi, did you miss the include? works for me locally (gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0), https://onlinegdb.com/B15ZmNBg https://godbolt.org/z/cPM4e4
My bad, ideone.com seems to not have that header available. It looks like cppcheck doesn't pick up that timercmp is a macro. This works however:
timercmp
struct timeval { long tv_sec; long tv_usec; }; #define timercmp(a, b, CMP) \ (((a)->tv_sec == (b)->tv_sec) ? \ ((a)->tv_usec CMP (b)->tv_usec) : \ ((a)->tv_sec CMP (b)->tv_sec)) int main() { struct timeval a = {0}; struct timeval b = {0}; return timercmp(&a, &b, <); }
Log in to post a comment.
hi,
gives:
this is, afaik, valid syntax.
thanks, jacob
GCC chokes on it: https://ideone.com/yvgfUJ
hi,
did you miss the include? works for me locally (gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0), https://onlinegdb.com/B15ZmNBg
https://godbolt.org/z/cPM4e4
thanks, jacob
My bad, ideone.com seems to not have that header available.
It looks like cppcheck doesn't pick up that
timercmp
is a macro. This works however: