Skip to content
  • Joseph Myers's avatar
    f3b5de94
    preprocessor: Adjust C rules on UCNs for C23 [PR117162] · f3b5de94
    Joseph Myers authored
    As noted in bug 117162, C23 changed some rules on UCNs to match C++
    (this was a late change agreed in the resolution to CD2 comment
    US-032, implementing changes from N3124), which we need to implement.
    
    Allow UCNs below 0xa0 outside identifiers for C, with a
    pedwarn-if-pedantic before C23 (and a warning with -Wc11-c23-compat)
    except for the always-allowed cases of UCNs for $ @ `.  Also as part
    of that change, do not allow \u0024 in identifiers as equivalent to $
    for C23.
    
    Bootstrapped with no regressions for x86_64-pc-linux-gnu.
    
    	PR c/117162
    
    libcpp/
    	* include/cpplib.h (struct cpp_options): Add low_ucns.
    	* init.cc (struct lang_flags, lang_defaults): Add low_ucns.
    	(cpp_set_lang): Set low_ucns
    	* charset.cc (_cpp_valid_ucn): For C, allow UCNs below 0xa0
    	outside identifiers, with a pedwarn if pedantic before C23 or a
    	warning with -Wc11-c23-compat.  Do not allow \u0024 in identifiers
    	for C23.
    
    gcc/testsuite/
    	* gcc.dg/cpp/c17-ucn-1.c, gcc.dg/cpp/c17-ucn-2.c,
    	gcc.dg/cpp/c17-ucn-3.c, gcc.dg/cpp/c17-ucn-4.c,
    	gcc.dg/cpp/c23-ucn-2.c, gcc.dg/cpp/c23-ucnid-2.c: New tests.
    	* c-c++-common/cpp/delimited-escape-seq-3.c,
    	c-c++-common/cpp/named-universal-char-escape-3.c,
    	gcc.dg/cpp/c23-ucn-1.c, gcc.dg/cpp/c2y-delimited-escape-seq-3.c:
    	Update expected messages
    	* gcc.dg/cpp/ucs.c: Use -pedantic-errors.  Update expected
    	messages.
    f3b5de94
    preprocessor: Adjust C rules on UCNs for C23 [PR117162]
    Joseph Myers authored
    As noted in bug 117162, C23 changed some rules on UCNs to match C++
    (this was a late change agreed in the resolution to CD2 comment
    US-032, implementing changes from N3124), which we need to implement.
    
    Allow UCNs below 0xa0 outside identifiers for C, with a
    pedwarn-if-pedantic before C23 (and a warning with -Wc11-c23-compat)
    except for the always-allowed cases of UCNs for $ @ `.  Also as part
    of that change, do not allow \u0024 in identifiers as equivalent to $
    for C23.
    
    Bootstrapped with no regressions for x86_64-pc-linux-gnu.
    
    	PR c/117162
    
    libcpp/
    	* include/cpplib.h (struct cpp_options): Add low_ucns.
    	* init.cc (struct lang_flags, lang_defaults): Add low_ucns.
    	(cpp_set_lang): Set low_ucns
    	* charset.cc (_cpp_valid_ucn): For C, allow UCNs below 0xa0
    	outside identifiers, with a pedwarn if pedantic before C23 or a
    	warning with -Wc11-c23-compat.  Do not allow \u0024 in identifiers
    	for C23.
    
    gcc/testsuite/
    	* gcc.dg/cpp/c17-ucn-1.c, gcc.dg/cpp/c17-ucn-2.c,
    	gcc.dg/cpp/c17-ucn-3.c, gcc.dg/cpp/c17-ucn-4.c,
    	gcc.dg/cpp/c23-ucn-2.c, gcc.dg/cpp/c23-ucnid-2.c: New tests.
    	* c-c++-common/cpp/delimited-escape-seq-3.c,
    	c-c++-common/cpp/named-universal-char-escape-3.c,
    	gcc.dg/cpp/c23-ucn-1.c, gcc.dg/cpp/c2y-delimited-escape-seq-3.c:
    	Update expected messages
    	* gcc.dg/cpp/ucs.c: Use -pedantic-errors.  Update expected
    	messages.
Loading