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



The following reply was made to PR standards/51044; it has been noted by GNATS.

From: Bruce Lilly <bruce.lilly%gmail.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: standards-manager%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, 
	netbsd-bugs%netbsd.org@localhost
Subject: Re: standards/51044: NetBSD cdefs.h defines __func__ incompatibly
 with C99
Date: Wed, 10 Aug 2016 11:39:41 -0400

 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