NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: standards/51044: NetBSD cdefs.h defines __func__ incompatibly with C99



Sorry for the late response.

Assertion output is specified in C99 7.2.1 paragraph 2, specifically
mentioning __func__.
6.4.2.2 paragraph 1 specifically reserves __func__ for the
translator (i.e. compiler), not OS header files, and as shown in
paragraph3, is is supposed to be the function name, unadorned.
J.2 notes that explicit declaration of __func__ (as in NetBSD
cdefs.h and assert.h) leads to undefined behavior.

The fundamental issue is regression failures caused by the NetBSD
headers trampling on the compiler-reserved identifier __func__ when
compiling pre-C99 code using clang and gcc.
Specifically, the NetBSD header redefinition overrides the correct
compiler-defined value of __func__, causing problems when compiling
with clang on NetBSD (but not other OSes) -- (the problem goes
unobserved when compiling with gcc, as gcc definition of the peculiar
"__PRETTY_FUNCTION__" is the same as __FUNCTION__, as
previously noted).  The root cause is the OS header files trampling on
compiler-reserved namespace.



Home | Main Index | Thread Index | Old Index