This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc and stdarg.h AND sunos4.1.4
- To: jcc at ugm dot com
- Subject: Re: gcc and stdarg.h AND sunos4.1.4
- From: Bruce Korb <bkorb at sco dot COM>
- Date: Wed, 16 Feb 2000 14:57:16 -0800
- CC: gcc at gcc dot gnu dot org
- Organization: Santa Cruz Operation
- References: <38AAFDDC.B0593F47@ugm.com>
- Reply-To: Bruce Korb <autogen at linuxbox dot com>
Jonathan Claggett wrote:
>
> Hello, this should be a quick #include question. I am attempting to
> compile a c program which uses va_start and other stdarg macros on a
> Solaris 2.5.1 box. The compile fails because gcc has no knowledge of the
> builtin function prototyped in stdarg.h called __builtin_va_alist. Sun's
> cc works fine with this builtin. Should I have installed a gcc friendly
> stdarg at some point here?
No, gcc should automatically install its own,
from which this fragment has been extracted:
/* Define __gnuc_va_list. */
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef __builtin_va_list __gnuc_va_list;
#endif
Someone more familiar with Sun gaffes should comment
on some of this. I mean, sometimes it looks like the
correct thing is to close a comment, other times
ignore the fact there is a nested comment starter.
In other cases, it looks like cccp/cpplib is broken.
> Subject: Re: broken srand() decl in sparc-sun-sunos4.1.4
> Date: Wed, 16 Feb 2000 16:17:13 +0100
> From: Harald Fricke <Fricke.Harald@mh-hannover.de>
>
>
> Bruce Korb wrote:
> >
> > Harald Fricke wrote:
>
> (...)
> > > When compiling Ghostscript 6.0 with Sunview support, I came across a
> > > couple of warnings about improperly nested comments in Sun-specific
> > > header files. As GS compiles and works, I guess it is better to leave
> > > these header files the way they are.
> >
> > The easiest way for me to judge is to have a look
> > at the offending fragment and the name of the file
> > it was found in.
>
> I have run all files from the /usr/include tree through GCC and here is
> the results:
>
> The following do not compile because gcc parses inside the #ifdef.
What?? Really?? At least _this_ part should not be a Sun problem...
Perhaps there is some fragility in the Solaris installs that
cause some of these problems?
> from <sbusdev/fdreg.h>:
> --------------------------------- cut --------------------------------
> #ifdef NEVER
> XXX add another field so we can look up by command value
> >>> but they are ordered now ??
> XXX maybe need a mask field also?
> XXX add another field / rearrange this for the hwintr's opmode value
> XXX -> YES make these a bit mask
> #endif NEVER
> --------------------------------- cut --------------------------------
>
> from <suntool/icon_load.h>:
> --------------------------------- cut --------------------------------
> #ifdef notdef
> The format of an ASCII representation of an icon file is defined by:
> (....)
> CAVEAT: currently pr must be a memory pixrect.
> #endif
> --------------------------------- cut --------------------------------
>
>
>
> <sun3/asm_linkage.h> contains lots of M68K assembler code packed into C
> macro definitions. GCC does not like this at all. I hope nobody on a Sun
> 3 relies on this.
>
>
> Missing white space after the macro name in <sundev/arreg.h>:
> --------------------------------- cut --------------------------------
> /*
> * Drive status bits.
> */
> #define ARCH_BITS\
> "\20\17NoCart\16NoDrive\15WriteProt\14EndMedium\13HardErr\12WrongBlock\
> \11FileMark\7InvCmd\6NoData\5Flaking\4BOT\0034\0022\1GotReset"
> --------------------------------- cut --------------------------------
Slick.
> Two files have a dot in the name of a macro.
>
> from <suntool/wmgr.h>:
> --------------------------------- cut --------------------------------
> #ifndef wmgr.h_DEFINED
> #define wmgr.h_DEFINED 1
> --------------------------------- cut --------------------------------
>
> from <machine/iommu.h>:
> --------------------------------- cut --------------------------------
> #ifndef _sun4m_iommu.h
> #define _sun4m_iommu.h
> (...)
> #endif _sun4m_iommu.h
> --------------------------------- cut --------------------------------
>
>
>
> The following only cause a warning when -Wall is on, but declarations
> are masked by the unterminated comments:
Are the defines required? If so, its a bug.
If not, it's deliberate :-) and it works just fine. 8-O !
> from <sbusdev/memfb.h>:
> --------------------------------- cut --------------------------------
> /* frame buffer address offsets */
> #define MFB_OFF_ID 0 /* ID register/ROM */
> #define MFB_OFF_REG 0x400000 /* video registers */
> #define MFB_OFF_FB 0x800000 /* frame buffer */
> #define MFB_OFF_DUMMY 0xC00000 /* reserved area *
>
> #define MFB_ID_MASK 0xFFFFFFF0
> #define MFB_ID_VALUE 0xFE010100
>
> /* colormap (Bt458) */
> --------------------------------- cut --------------------------------
>
> from <scsi/generic/inquiry.h>:
> --------------------------------- cut --------------------------------
> #define DPQ_NEVER 0x30 /*
> * The target is not capable of
> supporting a
> * physical device on this logical unit.
> For
> * this peripheral qualifier, the
> peripheral
> * device type will be set to
> DTYPE_UNKNOWN
> * in order to provide compatibility
> with
> * previous versions of SCSI.
>
> #define DPQ_VUNIQ 0x80 /*
> * If this bit is set, this is a vendor
> * unique qualifier.
> */
> --------------------------------- cut --------------------------------
>
> from <sunwindow/io_stream.h>:
> --------------------------------- cut --------------------------------
> char *stream_gets();
> /* char *stream_gets(s, in)
> * char *s;
> * STREAM *in;
> * analagous to gets:
> * reads characters from in until newline is read.
> * Terminating newline character is not stored in s, and s is terminated
> * with null character
> * newlines preceded by \ are treated the same as any other character,
> i.e.
> * both the \ and the newline are copied into s.
> * if an error occurs, or if no characters are read, the value NULL is
> returned
> *
>
> char *stream_fgets();
> /* char *stream_fgets(s, n, in)
> * char *s;
> * int n;
> * struct Stream *in;
> * analagous to fgets, i.e., like stream_gets, except newline is
> included
> */
> --------------------------------- cut
> --------------------------------
>
>
>
> The rest of the warnings only show up with -Wall and seem to be
> harmless. I don't know if it is policy to fix these or leave them alone:
>
> from <suntool/walkmenu.h>:
> --------------------------------- cut
> --------------------------------
> MENU_INITIAL_SELECTION = MENU_ATTR(ATTR_ENUM, 55),
> /* MENU_ACCELERATED_SELECTION = MENU_INITIAL_SELECTION, /* OBS
> */
> MENU_INITIAL_SELECTION_SELECTED = MENU_ATTR(ATTR_BOOLEAN, 57),
> MENU_INITIAL_SELECTION_EXPANDED = MENU_ATTR(ATTR_BOOLEAN, 58),
> /* MENU_DISPLAY_ONE_LEVEL = MENU_ATTR(ATTR_INT, 59), !attr58 /*
> OBS */
>
> --------------------------------- cut
> --------------------------------
>
> from <suntool/window.h>:
> --------------------------------- cut
> --------------------------------
>
> /*
> MISCELLANEOUS */
>
> WIN_MOUSE_XY = WIN_ATTR(ATTR_XY, 82), /* Set
> only */
> WIN_SHOW_UPDATES = WIN_ATTR(ATTR_BOOLEAN, 83),
> /* WIN_LOCK = WIN_ATTR(ATTR_BOOLEAN, 84), /* NYI
> */
>
> /* ADVANCED features for package
> implementors */
> --------------------------------- cut
> --------------------------------
>
>
> from <sys/stream.h>:
> --------------------------------- cut
> --------------------------------
> /*
> * Block allocation parameters
> */
> /* #define MAXBSIZE 4096 /* max block size */
> #define MAXIOCBSZ 1024 /* max ioctl data block size */
>
> --------------------------------- cut
> --------------------------------
>
> The following files have a similiar problem, e.g. one or more lines of
> the form
> /*<some declaration or pre-processor directive> /* <comment> */
>
> arpa/nameser.h
> scsi/adapters/espvar.h
> scsi/targets/stdef.h
> stand/sdreg.h
> stand/streg.h
> sundev/cg8reg.h
> sundev/ipi_trace.h
> sundev/kbd.h
> sundev/smreg.h
> sundev/srreg.h
> sundev/streg.h
>
> These files also have improperly nested or unterminated comments that do
> no harm:
> sparc/fpu/ieee.h
> sundev/desreg.h
> sundev/scsi.h
> sunif/if_ievar.h
>
> Oh dear, what a mess.
Quite.