Linting with splint: Preprocessor behaves different from compiler

61 views Asked by At

I'm trying to lint C code with splint. However, I'm including the standard lua.h header file, which does some preprocessing to set internal types. GCC and splint take different paths. I've narrowed this down to the following code:

#include <limits.h>     
#if defined(LLONG_MAX)     
    // GCC path (we're good)     
#else                                                                                                                                       
    // splint path     
    #error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)"    
#endif   

In gcc, LLONG_MAX is defined, which then compiles correctly. In splint, the #else path is taken, since LLONG_MAX is not defined. I don't set any additional flags for gcc, just plain gcc -c test.c. I can define LLONG_MAX for splint which then in turn processes files seemingly correct, but I would like to know that it does looks at the same code as gcc (there is of course more preprocessing, so it might see different code). How do I get process the code like gcc?

0

There are 0 answers