On 03/26/15 01:37, Bruce Evans wrote:
On Wed, 25 Mar 2015, Pedro Giffuni wrote:

On 03/25/15 21:14, Bruce Evans wrote:
On Wed, 25 Mar 2015, Pedro F. Giffuni wrote:

Log:
 Temporarily revert 280458.

 GCC is still carries an old version of cdefs.h which doesn't
 accept multiple parameters for the nonnull attribute.
 Since this issue probably affects many ports in the tree
 we will revert it for now until gcc gets fixed.

Note that sys/cdefs.h is supposed to work with any version of
gcc back to gcc-1, and does mostly work back to at least gcc-2.95.
The whole point of sys/cdefs.h is to provide compatibity macros
for old and other non-default compilers.  Standard compilers don't
even have __attribute__(()).  So no changes in future versions
of gcc will fix the previous commit.

cdefs.h still works for all versions of gcc back to gcc-1 AFAICT.

I now remember other bugs in it.  I think you put the varargs stuff
in the non-gcc version.  That won't work compilers that don't support
varargs for macros.  Neither will not changing the non-gcc version.

According to the gcc documentation [1]

"Variadic macros are a new feature in C99. GNU CPP has supported them for a long time, but only with a named variable argument (‘args...’, not ‘...’ and |__VA_ARGS__|). If you are concerned with portability to previous versions of GCC, you should use only named variable arguments. On the other hand, if you are concerned with portability to other conforming implementations of C99, you should use only |__VA_ARGS__|."

I gave priority for C99 conformant compilers instead of older (which?) gcc versions.

glibc (2.6 at least) avoids using varargs in its __nonnull() macro
by using the same portable method that is used in many optional
debugging statements including FreeBSD's KASSERT().

I will take a look at KASSERT(), I normally avoid looking at glibc as
it is likely to have GNUisms, and maybe even license issues.

  (KASSERT() is
broken as designed.  It never needed this since it wasn't implmented
until several years after C99 standardized  varargs for macros.)
The macro takes a single arg consisting of a normal list of args
enclosed in parentheses.

Hmm.. I think Android's Bionic libc does the same, it's really ugly.

Thanks,

Pedro.

[1] https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to