On Thu, Feb 16, 2023 at 10:30:30AM +0000, Jonathan Wakely via Gcc-patches wrote:
> Tested powerpc64le-linux. Pushed to trunk.
> 
> These should be backported too.
> 
> -- >8 --
> 
> The non-reserved names 'val' and 'dest' were being used in our headers
> but haven't been added to the 17_intro/names.cc test. That's because
> they are used by <asm-generic/posix_types.h> and <netinet/tcp.h>
> respecitvely on glibc-based systems.

So, can't we for such problematic names add hacks, like some directory
which the test adds as -isystem before the standard ones and contains
some header wrappers which temporarily
#undef val
#undef dest
(or whatever other name), then
#include_next ...
and then define them again?
Doesn't need to be for all targets of course, but just something to cover
at least the most common ones.

Or perhaps even do it differently, add 2 headers, one which defines
all those #define whatever (, one that #undef whatever them all,
and add wrappers in a -isystem directory for all non-gcc owned headers
used by the libstdc++ headers, which would include this #undef header
first and #define at the end.  That way we wouldn't test non-reserved
names in say libc headers, just in libstdc++ headers.

What both of these break though is if libstdc++ headers try to use
__has_include etc. on them, because the added wrapper will mean they will
show as existing.

        Jakub

Reply via email to