svn commit: r268137 - head/sys/sys

Bruce Evans brde at optusnet.com.au
Sun Jun 21 19:25:29 UTC 2015


On Sun, 21 Jun 2015, Pedro Giffuni wrote:

> On 06/21/15 11:48, Bruce Evans wrote:
>> On Sun, 21 Jun 2015, Pedro Giffuni wrote:
>>> ...
>>> Well, the fact this we just do this in the tree and no one has bothered to
>>> "clean" the situation for older compilers just indicates that no one 
>>> *cares*
>>> about older compilers.
>> 
>> No, we don't do this with older compilers, except for for a couple of
>> pre-C90 cases.  We are careful to only define names in our namespace,
>> e.g., __signed but not the C90 keyword 'signed'.  This is still fragile.
>> __signed is a keyword for gcc, and it is confusing that some of our use
>> of it require it to have the gcc meaning.  __signed is in the 
>> implementation
>> namespace so we don't own it completely.  This is what is now causing 
>> problems
>> with defining __weak.
>
> We have plenty of C++-style comments and C99 initializers in the tree.

Headers cannot use these unconditionally.

FreeBSD attempts to support:
- user code written in K&R C using __P(()) to ifdef for prototypes.  __P(())
   and missing prototypes still turn up frequently.  Most recently in zfs
   code with missing prototypes.
- ISO C90, including all C90 compilers, all C90 headers and all C90 libraries
- POSIX.1-1990.
- the POSIX.2 compiler c89.  This is one of the C90 compilers.  Actually
   it is C94 or C95 (-std=iso9899:199409).  c89 is especially strict.  Most
   carefully written C90 code can be compiled by a C11 compiler with C11
   constructs in compiled but not really used parts of standard headers.
   But c89 forces the compiler/language back to an old standard.  This
   requires the visible parts of standard headers to be written carefully
   to the old standard too.

The support mostly works.  The only brokenness that I know of in it is
the stdarg thing.  I defended against breaking it by using variadic macros

Bruce


More information about the svn-src-head mailing list