Bug 115634 - split thows up an error in /usr/include/sys/syslog.h line 187 __gnuc_va_list is not defined. Have to include /usr/include/err.h for a def of _gnuc_va_list
Summary: split thows up an error in /usr/include/sys/syslog.h line 187 __gnuc_va_list...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: splint
Version: 9
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-02-14 00:46 UTC by Philip Shearer
Modified: 2007-04-18 17:02 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-02-14 05:33:05 UTC
Embargoed:


Attachments (Terms of Use)

Description Philip Shearer 2004-02-14 00:46:36 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113

Description of problem:
this is NOT to report a problem in splint but to report a problem that
splint has identified.

It seems that /usr/include/syslog.h is missing a definition for
"_gnuc_va_list" in the function
 #ifdef __USE_BSD
 extern void vsyslog (int __pri, __const char *__fmt, __gnuc_va_list __ap)
 #endif

The only place I could find __gnuc_va_list defined was in
/usr/include/err.h

If this file is included in the client sourece file then the error
message generated by splint evaporate.  

Version-Release number of selected component (if applicable):
syslog version @(#)syslog.h    8.1 (Berkeley) 6/2/93

How reproducible:
Always

Steps to Reproduce:
1) write a test C source file called: t.c
 #include <stdarg.h>
 #include <syslog.h>
 int main()
 {
 return 0 ;
 }

2) Now run splint
splint t.c
 Splint 3.0.1.7 --- 24 Jan 2003
 
 /usr/include/sys/syslog.h:187:66: Parse Error:
    Inconsistent function parameter syntax: __gnuc_va_list :
    <any>. (For help on parse errors, see splint -help parseerrors.)
 *** Cannot continue.

3) Edit t.c add a line to the top of the file
 #include <err.h>
so the file now reads:
 #include <err.h>
 #include <stdarg.h>
 #include <syslog.h>
 int main()
 {
 return 0 ;
 }

4) re-run splint:
splint t.c
 Splint 3.0.1.7 --- 24 Jan 2003
 
 Finished checking --- no warnings    

Expected Results:  I would expect that given the first source file the
result would be the same as the one with the modification.
split would return  
  Splint 3.0.1.7 --- 24 Jan 2003
 
  Finished checking --- no warnings


Additional info:

There would seem to be 4 possible fixes:
1)alter __gnuc_va_list to "__ptr_t" or "va_list" in the prototype
vsyslog(...
2) add the definition int the syslog.h
 #ifndef __gnuc_va_list
 #define __gnuc_va_list __ptr_t
 #endif
but with will cause problems if err.h is inclded after syslog in an
application source file.
3) Add the definition in to <feature.h> as they both include that
file. err.h will need to be modified
4) Include it in another file and include that in to err.h syslog.h
5) #include <err.h> into <syslog.h>

Comment 1 Jeff Johnson 2004-02-14 05:33:05 UTC
This is gcc, so you need to also look in /usr/lib/gcc-lib:

$ pwd
/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/include
$ grep gnuc_va_list *
stdarg.h:/* Define __gnuc_va_list.  */
stdarg.h:typedef __builtin_va_list __gnuc_va_list;
stdarg.h:/* Define va_list, if desired, from __gnuc_va_list. */
stdarg.h:   but must not use that name.  It should use the name
__gnuc_va_list,
stdarg.h:typedef __gnuc_va_list va_list;
stdarg.h:typedef __gnuc_va_list va_list;

gcc knows how to do this, splint needs

-Iusr/lib/gcc-lib/i386-redhat-linux/3.3.2/include

somewhere like .splintrc or on splint CLI invocation.





Note You need to log in before you can comment on or make changes to this bug.