5

Is there a way to stop splint from analyzing system headers included, POSIX, libc etc.? I run with -warnposix -preproc:

% splint -warnposix -preproc my.c

/usr/include/unistd.h:220:8: Parse Error: Non-function declaration:
    __BEGIN_DECLS : int. (For help on parse errors, see splint -help
    parseerrors.)
*** Cannot continue.

UPDATE:

% splint +posixlib +unixlib -I/path/to/myheaders -I/usr/include/x86_64-linux-gnu my.c

/usr/include/asm-generic/int-ll64.h:19:24: Parse Error:
    Suspect missing struct or union keyword: __signed__ :
    int. (For help on parse errors, see splint -help parseerrors.)

After reading splint FAQ14 I tried to eliminate nonstandard keyword:

% splint +posixlib +unixlib -D__signed__= -I/path/to/myheaders -I/usr/include/x86_64-linux-gnu my.c

/usr/include/x86_64-linux-gnu/sys/syslog.h:200:66: Parse Error:
    Inconsistent function parameter syntax: __gnuc_va_list :
    <any>. (For help on parse errors, see splint -help parseerrors.)
*** Cannot continue.

Declaring __gnuc_va_list as nonstandard keyword doesn't help in this particular case. I feel that splint is a powerful tool, but it requires to annotate almost every code it parses. Am I wrong?

Mark
  • 6,052
  • 8
  • 61
  • 129
  • 1
    Documentation: http://www.splint.org/faq.html#quest15 – jxh Jan 11 '17 at 00:58
  • @jxh, thanks for comment. Please see my update. I wonder is there a way to ask `splint` do not check system headers at all? – Mark Jan 11 '17 at 15:05
  • You were also supposed to read: http://www.splint.org/faq.html#quest14 as the previous FAQ suggested. – jxh Jan 11 '17 at 17:52
  • @jxh, I did, however declaring nonstandard keywords won't help `splint` bypass. I updated the original post. – Mark Jan 11 '17 at 18:34
  • 1
    Try `signed` rather than empty. Also, `+gnuextensions`. – jxh Jan 11 '17 at 19:13
  • `splint` tries to be like the compiler, so it needs the prototypes to help do the static analysis. If it bypasses the system headers, you will just have a bunch of unknown function usage errors. – jxh Jan 11 '17 at 19:32

0 Answers0