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: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: standards/51044: NetBSD cdefs.h defines __func__ incompatibly
with C99
Date: Wed, 10 Aug 2016 18:09:58 +0000
On Wed, Aug 10, 2016 at 03:40:01PM +0000, Bruce Lilly wrote:
> Sorry for the late response.
>
> Assertion output is specified in C99 7.2.1 paragraph 2, specifically
> mentioning __func__.
Yes, it says "an implementation-defined format".
> 6.4.2.2 paragraph 1 specifically reserves __func__ for the
> translator (i.e. compiler), not OS header files,
Rubbish. First of all, the standard does not define "translator"; the
only formal concept is the "implementation", which includes the header
files and standard library.
Second of all, that paragraph does no such thing; it simply says that
__func__ shall be declared a certain way. When C99 is in effect,
cdefs.h defers to the compiler's version, and the standard is
satisfied.
When C99 is not in effect, that paragraph is not the slightest bi
pertinent.
> J.2 notes that explicit declaration of __func__ (as in NetBSD
> cdefs.h and assert.h) leads to undefined behavior.
(a) that is only true when C99 is in effect; when C99 is not in
effect, that statement is no more relevant than the other.
And, (b) cdefs.h is part of the implementation so this statement does
not apply.
Besides, Annex J is not normative.
> 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.
That means your regression tests are wrong. Try fixing them.
> The root cause is the OS header files trampling on
> compiler-reserved namespace.
There is no such thing as compiler-reserved namespace in Standard C.
--
David A. Holland
dholland%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index