target/1538: cannot compile with #include <sys/varargs.h>

Richard Henderson rth@redhat.com
Fri Mar 29 01:06:00 GMT 2002


The following reply was made to PR target/1538; it has been noted by GNATS.

From: Richard Henderson <rth@redhat.com>
To: "Garrett D'Amore" <garrett@damore.org>
Cc: rth@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
   nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Subject: Re: target/1538: cannot compile with #include <sys/varargs.h>
Date: Fri, 29 Mar 2002 01:00:22 -0800

 On Fri, Mar 29, 2002 at 12:37:30AM -0800, Garrett D'Amore wrote:
 > The "standard" to which you refer is for *USERLAND* code only.  When you
 > compile kernel code for Solaris, you are not supposed to use this header
 > since it might introduce other (conflicting) symbols.  The Solaris DDI
 > specifies the use of <sys/varargs.h> for builing devices drivers and other
 > kernel code.
 
 That certainly was not clear to me from your report.  It certainly
 looked like someone being fresh with the internals of Solaris varargs.
 
 > It would be very nice if gcc knew that on Solaris <sys/varargs.h> is
 > basically the same as <stdarg.h> and fixincludes automagically took care
 > of this.  Which is why I filed the request.
 
 Ok.  If you're still interested, please try the following vs
 a gcc 3.1 snapshot.
 
 
 r~
 
 
 	* fixinc/inclhack.def (solaris_sys_varargs_h): New.
 	* fixinc/fixincl.x: Regenerate.
 
 Index: fixincl.x
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/fixinc/fixincl.x,v
 retrieving revision 1.119
 diff -c -p -d -r1.119 fixincl.x
 *** fixincl.x	2002/03/22 02:24:51	1.119
 --- fixincl.x	2002/03/29 08:57:49
 ***************
 *** 5,11 ****
    * files which are fixed to work correctly with ANSI C and placed in a
    * directory that GNU C will search.
    *
 !  * This file contains 140 fixup descriptions.
    *
    * See README for more information.
    *
 --- 5,11 ----
    * files which are fixed to work correctly with ANSI C and placed in a
    * directory that GNU C will search.
    *
 !  * This file contains 141 fixup descriptions.
    *
    * See README for more information.
    *
 *************** static const char* apzSolaris_Stdio_TagP
 *** 3696,3701 ****
 --- 3696,3729 ----
   
   /* * * * * * * * * * * * * * * * * * * * * * * * * *
    *
 +  *  Description of Solaris_Sys_Varargs_H fix
 +  */
 + tSCC zSolaris_Sys_Varargs_HName[] =
 +      "solaris_sys_varargs_h";
 + 
 + /*
 +  *  File name selection pattern
 +  */
 + tSCC zSolaris_Sys_Varargs_HList[] =
 +   "|sys/varargs.h|";
 + /*
 +  *  Machine/OS name selection pattern
 +  */
 + tSCC* apzSolaris_Sys_Varargs_HMachs[] = {
 +         "*-*-solaris*",
 +         (const char*)NULL };
 + #define SOLARIS_SYS_VARARGS_H_TEST_CT  0
 + #define aSolaris_Sys_Varargs_HTests   (tTestDesc*)NULL
 + 
 + /*
 +  *  Fix Command Arguments for Solaris_Sys_Varargs_H
 +  */
 + static const char* apzSolaris_Sys_Varargs_HPatch[] = {
 + "#include <stdarg.h>",
 +     (char*)NULL };
 + 
 + /* * * * * * * * * * * * * * * * * * * * * * * * * *
 +  *
    *  Description of Statsswtch fix
    */
   tSCC zStatsswtchName[] =
 *************** static const char* apzX11_SprintfPatch[]
 *** 5506,5512 ****
    */
   #define REGEX_COUNT          149
   #define MACH_LIST_SIZE_LIMIT 279
 ! #define FIX_COUNT            140
   
   /*
    *  Enumerate the fixes
 --- 5534,5540 ----
    */
   #define REGEX_COUNT          149
   #define MACH_LIST_SIZE_LIMIT 279
 ! #define FIX_COUNT            141
   
   /*
    *  Enumerate the fixes
 *************** typedef enum {
 *** 5605,5610 ****
 --- 5633,5639 ----
       SCO_UTIME_FIXIDX,
       SOLARIS_MUTEX_INIT_FIXIDX,
       SOLARIS_STDIO_TAG_FIXIDX,
 +     SOLARIS_SYS_VARARGS_H_FIXIDX,
       STATSSWTCH_FIXIDX,
       STDIO_STDARG_H_FIXIDX,
       STDIO_VA_LIST_FIXIDX,
 *************** tFixDesc fixDescList[ FIX_COUNT ] = {
 *** 6119,6124 ****
 --- 6148,6158 ----
        apzSolaris_Stdio_TagMachs,
        SOLARIS_STDIO_TAG_TEST_CT, FD_MACH_ONLY,
        aSolaris_Stdio_TagTests,   apzSolaris_Stdio_TagPatch, 0 },
 + 
 +   {  zSolaris_Sys_Varargs_HName,    zSolaris_Sys_Varargs_HList,
 +      apzSolaris_Sys_Varargs_HMachs,
 +      SOLARIS_SYS_VARARGS_H_TEST_CT, FD_MACH_ONLY | FD_REPLACEMENT,
 +      aSolaris_Sys_Varargs_HTests,   apzSolaris_Sys_Varargs_HPatch, 0 },
   
     {  zStatsswtchName,    zStatsswtchList,
        apzStatsswtchMachs,
 Index: inclhack.def
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/fixinc/inclhack.def,v
 retrieving revision 1.122
 diff -c -p -d -r1.122 inclhack.def
 *** inclhack.def	2002/03/22 02:24:52	1.122
 --- inclhack.def	2002/03/29 08:57:49
 *************** fix = {
 *** 2077,2082 ****
 --- 2077,2094 ----
   
   
   /*
 +  * Solaris <sys/varargs.h> is a DDK (aka kernel-land) header providing
 +  * the same interface as <stdarg.h>.  No idea why they couldn't have just
 +  * used the standard header.
 +  */
 + fix = {
 +     hackname = solaris_sys_varargs_h;
 +     files    = "sys/varargs.h";
 +     mach     = '*-*-solaris*';
 +     replace  = "#include <stdarg.h>";
 + };
 + 
 + /*
    *  Sony NEWSOS 5.0 does not support the complete ANSI C standard.
    */
   #ifdef SONY



More information about the Gcc-prs mailing list