This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC][PATCH v2] Initial support for C11 Annex K Bounds checking functions
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Paul Eggert <eggert at cs dot ucla dot edu>
- Cc: Ulrich Bayer <ubayer at sba-research dot org>, <libc-alpha at sourceware dot org>
- Date: Wed, 5 Jun 2013 22:07:25 +0000
- Subject: Re: [RFC][PATCH v2] Initial support for C11 Annex K Bounds checking functions
- References: <5102DBFD dot 4060103 at sba-research dot org> <513DE7A1 dot 8080501 at sba-research dot org> <Pine dot LNX dot 4 dot 64 dot 1305151554100 dot 15900 at digraph dot polyomino dot org dot uk> <51AF6406 dot 30201 at sba-research dot org> <Pine dot LNX dot 4 dot 64 dot 1306051643310 dot 14749 at digraph dot polyomino dot org dot uk> <51AFB0D1 dot 4010708 at cs dot ucla dot edu>
On Wed, 5 Jun 2013, Paul Eggert wrote:
> * It won't work with <stddef.h>, which is supplied
> by the compiler, not by glibc, and whose behavior should
> depend on __STDC_WANT_LIB_EXT1__.
The same inconsistency of course applies to other cases with the headers
GCC installs - e.g. <float.h> can only test __STDC_VERSION__ to determine
whether to define C99 and C11 macros, whereas glibc headers would also
define them for _GNU_SOURCE.
> * It could generate bogus diagnostics. If (say) <stdio.h>
> defines __STDC_WANT_LIB_EXT1__, then K.3.1.1 paragraph 4
> would require a diagnostic for this program:
That does indicate maybe using __STDC_WANT_LIB_EXT1__ || __USE_GNU in
headers, instead of defining __STDC_WANT_LIB_EXT1__ in features.h.
> Which brings up another point: the proposed implementation doesn't
> support K.3.1.1 paragraph 4 -- shouldn't it?
As previously discussed, that requires a new GCC feature, maybe a pragma
for affected headers to use, given that the check is needed for multiple
includes of the same header (despite multiple include optimization) and
that as I interpret it the requirement is for identical token sequences
(including whether whitespace separates each pair of tokens - the same
requirement as for duplicate #defines in 6.10.3).
--
Joseph S. Myers
joseph@codesourcery.com