c: C2x binary constants
authorJoseph Myers <joseph@codesourcery.com>
Fri, 13 Nov 2020 22:45:22 +0000 (22:45 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Fri, 13 Nov 2020 22:45:22 +0000 (22:45 +0000)
commite400a64936efdc2424044aa74c0424df16242d2d
tree5306e5a590540d75f925bd5f41600102ed65039c
parentf3dc991fba095b38b15cd667e5cd15b1c418e809
c: C2x binary constants

C2x adds binary integer constants (approved at the last WG14 meeting,
though not yet added to the working draft in git).  Configure libcpp
to consider these a standard feature in C2x mode, with appropriate
updates to diagnostics including support for diagnosing them with
-std=c2x -Wc11-c2x-compat.

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

gcc/testsuite/
2020-11-13  Joseph Myers  <joseph@codesourcery.com>

* gcc.dg/binary-constants-2.c, gcc.dg/binary-constants-3.c,
gcc.dg/system-binary-constants-1.c: Update expected diagnostics.
* gcc.dg/c11-binary-constants-1.c,
gcc.dg/c11-binary-constants-2.c, gcc.dg/c2x-binary-constants-1.c,
gcc.dg/c2x-binary-constants-2.c, gcc.dg/c2x-binary-constants-3.c:
New tests.

libcpp/
2020-11-13  Joseph Myers  <joseph@codesourcery.com>

* expr.c (cpp_classify_number): Update diagnostic for binary
constants for C.  Also diagnose binary constants for
-Wc11-c2x-compat.
* init.c (lang_defaults): Enable binary constants for GNUC2X and
STDC2X.
gcc/testsuite/gcc.dg/binary-constants-2.c
gcc/testsuite/gcc.dg/binary-constants-3.c
gcc/testsuite/gcc.dg/c11-binary-constants-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c11-binary-constants-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-binary-constants-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-binary-constants-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-binary-constants-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/system-binary-constants-1.c
libcpp/expr.c
libcpp/init.c