I'm seeing build failures of glibc for powerpc64, as illustrated by the 
following C code:

#if 0
\NARG
#endif

(the actual sysdeps/powerpc/powerpc64/sysdep.h code is inside #ifdef 
__ASSEMBLER__).

This shows some problems with this feature - and with delimited escape 
sequences - as it affects C.  It's fine to accept it as an extension 
inside string and character literals, because \N or \u{...} would be 
invalid in the absence of the feature (i.e. the syntax for such literals 
fails to match, meaning that the rule about undefined behavior for a 
single ' or " as a pp-token applies).  But outside string and character 
literals, the usual lexing rules apply, the \ is a pp-token on its own and 
the code is valid at the preprocessing level, and with expansion of macros 
appearing before or after the \ (e.g. u defined as a macro in the \u{...} 
case) it may be valid code at the language level as well.  I don't know 
what older C++ versions say about this, but for C this means e.g.

#define z(x) 0
#define a z(
int x = a\NARG);

needs to be accepted as expanding to "int x = 0;", not interpreted as 
using the \N feature in an identifier and produce an error.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to