Chad Loder
Sat, 09 Nov 2002 13:59:16 -0800
Hello. I am having problems getting slint to parse
certain files without reporting an error.
For example, I run:
splint -weak +gnuextensions -I. systrace/filter.c
This "works" OK, but of course it gives me warnings like:
systrace/filter.c:354:7: Unrecognized identifier: strsep
systrace/filter.c:505:5: Unrecognized identifier: snprintf
Well, clearly I want to take advantage of slint's POSIX
checks, so I try it this way:
splint -weak +gnuextensions +posixlib -I. systrace/filter.c
But now it won't even parse the source file. I get:
cvs/src/bin/systrace/intercept.h:52:43: Parse Error:
Inconsistent function parameter syntax: u_char :
The offending line in the header is a function pointer
prototype (member of a struct):
int (*io)(int, pid_t, int, void *, u_char *, size_t);
OK, I remember u_char is a UNIXism. So let me try the
UNIX extensions instead of the POSIX extensions:
splint -weak +gnuextensions +posixlib -I. systrace/filter.c
But now I get a different error:
cvs/src/bin/systrace/intercept.h:54:37: Parse Error:
Inconsistent function parameter syntax: u_int32_t :
The offendeng line in the header is:
int (*answer)(int, pid_t, u_int32_t, short, int, short,
struct elevate *);
I can't seem to win here! I know POSIX does not define u_char,
so I'm prepared to use UNIX. But UNIX *does* define u_int32_t,
does it not?
On my machine (OpenBSD.i386), these things are defined in sys/types.h
(for UNIXisms) and machine/types.h (for POSIX). The relevant sections
are included below:
------------------------------ from sys/types.h ------------------
#ifndef _SYS_TYPES_H_
#define _SYS_TYPES_H_
/* Machine type dependent parameters. */
#include <machine/types.h>
#include <machine/ansi.h>
#include <machine/endian.h>
#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef unsigned char unchar; /* Sys V compatibility */
typedef unsigned short ushort; /* Sys V compatibility */
typedef unsigned int uint; /* Sys V compatibility */
typedef unsigned long ulong; /* Sys V compatibility */
#endif
-------------------------------------------------------------------
-------------------------- from machine/types.h -------------------
typedef __signed char int8_t;
typedef unsigned char u_int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short u_int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int u_int32_t;
typedef unsigned int uint32_t;
-------------------------------------------------------------------