Why are lots of typedefs not defined unless __STDC__ == 0 on 2.6?

Why are lots of typedefs not defined unless __STDC__ == 0 on 2.6?

Post by R. Bernste » Fri, 05 Feb 1999 04:00:00



I've been working on a program to display process trees dynamically to
work non-suid for Solaris 2.6 and up. I've been getting compiler
errors with egcs (the only compiler I have and have tried) because
lots of typedefs are missing such as for sigset_t and uint64_t (used
by "sys/procfs.h").

In /usr/include/sys/int_types.h we have
#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
typedef unsigned long long      uint64_t;
#endif

Looking at /usr/include/sys/signal.h we have:

#if defined(__EXTENSIONS__) || (__STDC__ - 0 == 0) || ...

Actually, the C-Preprocssor logic for sigset_t in sys/signal.h is
so complicated that I really have a hard time pinpointing why it is
not defined, other than knowing that you can #define __EXTENSIONS__ or
#define __STDC__ 0 and that will work.

Anyway, the question is what are the various meanings of the values of
__STDC__? Is this documented somewhere?

 
 
 

Why are lots of typedefs not defined unless __STDC__ == 0 on 2.6?

Post by Casper H.S. Dik - Network Security Engine » Fri, 05 Feb 1999 04:00:00


[[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]


>I've been working on a program to display process trees dynamically to
>work non-suid for Solaris 2.6 and up. I've been getting compiler
>errors with egcs (the only compiler I have and have tried) because
>lots of typedefs are missing such as for sigset_t and uint64_t (used
>by "sys/procfs.h").

Which version of egcs, does it use fixed includes?
Are you using -ansi?

Quote:>Anyway, the question is what are the various meanings of the values of
>__STDC__? Is this documented somewhere?

The Sun C compiler/include files use tree values:

        - not defined           - K&R mode (not prototypes, const, etc)
        - defined as 0          - ANSI + extensions (long long)
        - defined as 1          - strict ANSI (no long long, but also
                                  no non-ANSI symbols visible in ANSI
                                  include files.

Newer versions of gcc define __STDC__ as 1 when reading the system include
and they work fine.  Older versions need to run fixinclude

Casper

--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.

 
 
 

Why are lots of typedefs not defined unless __STDC__ == 0 on 2.6?

Post by R. Bernste » Sat, 06 Feb 1999 04:00:00


Casper H.S. Dik - Network Security Engineer sagely queries/reports:

Quote:> Which version of egcs, does it use fixed includes?
> Are you using -ansi?

gcc version egcs-2.90.23 980102 (egcs-1.0.1 release), includes are
not "fixed".  I do not use -ansi. egcs (or something
else) does however #define __STDC__, but not as 0.

...

Quote:> Newer versions of gcc define __STDC__ as 1 when reading the system include
> and they work fine.  Older versions need to run fixinclude

I think you mean __STDC_ as 0. I tried #defining as 1 and that
had different problems. Will pick up a new egcs.
I have a report that egcs-2.92.23 19981129 works.

Many thanks for the explanation of the meanings for the values of
__STDC__.

 
 
 

Why are lots of typedefs not defined unless __STDC__ == 0 on 2.6?

Post by Casper H.S. Dik - Network Security Engine » Sat, 06 Feb 1999 04:00:00


[[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]


>> Which version of egcs, does it use fixed includes?
>> Are you using -ansi?
>gcc version egcs-2.90.23 980102 (egcs-1.0.1 release), includes are
>not "fixed".  I do not use -ansi. egcs (or something
>else) does however #define __STDC__, but not as 0.

But in system includes it changes the define to 0.

Quote:>I think you mean __STDC_ as 0. I tried #defining as 1 and that
>had different problems. Will pick up a new egcs.
>I have a report that egcs-2.92.23 19981129 works.

Uhm, yes.  It seems to work fine for me.  Check for the following
(FSF)Changelog file:


        * cccp.c, cpplib.c (special_symbol): If STDC_0_IN_SYSTEM_HEADERS
        is defined, expand __STDC__ to 0 in system headers.
        * i386/sol2.h, rs6000/sol2.h, sparc/sol2.h:
        (STDC_0_IN_SYSTEM_HEADERS): New macro.
        (CPP_SPEC): Remove -D__STDC__=0; it's no longer needed.

Casper
--
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.

 
 
 

1. Why are lots of typedefs not defined unless __STDC__ == 0 on Solaris 2.6?

I've been working on a program to display process trees dynamically to
work non-suid for Solaris 2.6 and up. I've been getting compiler
errors with egcs (the only compiler I have and have tried) because
lots of typedefs are missing such as for sigset_t and uint64_t (used
by "sys/procfs.h").

In /usr/include/sys/int_types.h we have
#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
typedef unsigned long long      uint64_t;
#endif

Looking at /usr/include/sys/signal.h we have:

#if defined(__EXTENSIONS__) || (__STDC__ - 0 == 0) || ...

Actually, the C-Preprocssor logic for sigset_t in sys/signal.h is
so complicated that I really have a hard time pinpointing why it is
not defined, other than knowing that you can #define __EXTENSIONS__ or
#define __STDC__ 0 and that will work.

Anyway, the question is what are the various meanings of the values of
__STDC__? Is this documented somewhere?

2. Motherboard install question [kinda offtopic but will be a linux boxl

3. why isn't __STDC__ being defined?

4. What does my Harddisk do all the time (Problem solved)

5. Why Wont X Run Unless I am Root?

6. YDL install problem w/G3 PB FW Pismo

7. Why am I using lots of swap with plenty of RAM free?

8. ignore!

9. Xnest why not shiped in Solaris 2.6?

10. traceroute not in 2.6 ... why?

11. Why is my SIS900 NIC not recognized/working with 2.6?

12. Legato backup won't write unless I am snooping

13. Talk wont unless I am connected to internet