preprocessor: Enable digit separators for C2X
authorJoseph Myers <joseph@codesourcery.com>
Tue, 11 May 2021 14:25:55 +0000 (14:25 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Tue, 11 May 2021 14:25:55 +0000 (14:25 +0000)
commit5ea40269a77a3754dd0f610f7c09b1a372e3c7f7
treecc0b1ef3b1f4f4a03447c7cca3b8cdec6ffd7bee
parent010d4a5047166037b316ed22331f3d99742f1f1d
preprocessor: Enable digit separators for C2X

C2X adds digit separators, as in C++.  Enable them accordingly in
libcpp and c-lex.c.  Some basic tests are added that digit separators
behave as expected for C2X and are properly disabled for C11; further
test coverage is included in the existing g++.dg/cpp1y/digit-sep*.C
tests.

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

gcc/c-family/
* c-lex.c (interpret_float): Handle digit separators for C2X.

libcpp/
* init.c (lang_defaults): Enable digit separators for GNUC2X and
STDC2X.

gcc/testsuite/
* gcc.dg/c11-digit-separators-1.c,
gcc.dg/c2x-digit-separators-1.c, gcc.dg/c2x-digit-separators-2.c:
New tests.
gcc/c-family/c-lex.c
gcc/testsuite/gcc.dg/c11-digit-separators-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-digit-separators-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-digit-separators-2.c [new file with mode: 0644]
libcpp/init.c