]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c: New C2x keywords
authorJoseph Myers <joseph@codesourcery.com>
Wed, 7 Sep 2022 13:56:25 +0000 (13:56 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 7 Sep 2022 13:56:46 +0000 (13:56 +0000)
C2x follows C++ in making alignas, alignof, bool, false,
static_assert, thread_local and true keywords; implement this
accordingly.  This implementation makes them normal keywords in C2x
mode just like any other keyword (C2x leaves open the possibility of
implementation using predefined macros instead - thus, there aren't
any testcases asserting that they aren't macros).  As in C++ and
previous versions of C, true and false are handled like signed 1 and 0
in #if (there was an intermediate state in some C2x drafts where they
had different macro expansions that were unsigned in #if).

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

As with the removal of unprototyped functions, this change has a high
risk of breaking some old code and people doing GNU/Linux distribution
builds may wish to see how much is broken in a build with a -std=gnu2x
default.

gcc/
* ginclude/stdalign.h [defined __STDC_VERSION__ &&
__STDC_VERSION__ > 201710L]: Disable all content.
* ginclude/stdbool.h [defined __STDC_VERSION__ && __STDC_VERSION__
> 201710L] (bool, true, false): Do not define.

gcc/c-family/
* c-common.cc (c_common_reswords): Use D_C2X instead of D_CXXONLY
for alignas, alignof, bool, false, static_assert, thread_local and
true.

gcc/c/
* c-parser.cc (c_parser_static_assert_declaration_no_semi)
(c_parser_alignas_specifier, c_parser_alignof_expression): Allow
for C2x spellings of keywords.
(c_parser_postfix_expression): Handle RID_TRUE and RID_FALSE.

gcc/testsuite/
* gcc.dg/c11-keywords-1.c, gcc.dg/c2x-align-1.c,
gcc.dg/c2x-align-6.c, gcc.dg/c2x-bool-2.c,
gcc.dg/c2x-static-assert-3.c, gcc.dg/c2x-static-assert-4.c,
gcc.dg/c2x-thread-local-1.c: New tests.
* gcc.dg/c2x-bool-1.c: Update expectations.

libcpp/
* include/cpplib.h (struct cpp_options): Add true_false.
* expr.cc (eval_token): Check true_false not cplusplus to
determine whether to handle true and false keywords.
* init.cc (struct lang_flags): Add true_false.
(lang_defaults): Update.
(cpp_set_lang): Set true_false.

15 files changed:
gcc/c-family/c-common.cc
gcc/c/c-parser.cc
gcc/ginclude/stdalign.h
gcc/ginclude/stdbool.h
gcc/testsuite/gcc.dg/c11-keywords-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-align-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-align-6.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-bool-1.c
gcc/testsuite/gcc.dg/c2x-bool-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-static-assert-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-static-assert-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-thread-local-1.c [new file with mode: 0644]
libcpp/expr.cc
libcpp/include/cpplib.h
libcpp/init.cc

index 9746504195b26512160db11e4f87b8110b828919..0a5b7e120c9777aef827d2bf960b151940c362f9 100644 (file)
@@ -459,11 +459,11 @@ const struct c_common_resword c_common_reswords[] =
   { "__GIMPLE",                RID_GIMPLE,     D_CONLY },
   { "__PHI",           RID_PHI,        D_CONLY },
   { "__RTL",           RID_RTL,        D_CONLY },
-  { "alignas",         RID_ALIGNAS,    D_CXXONLY | D_CXX11 | D_CXXWARN },
-  { "alignof",         RID_ALIGNOF,    D_CXXONLY | D_CXX11 | D_CXXWARN },
+  { "alignas",         RID_ALIGNAS,    D_C2X | D_CXX11 | D_CXXWARN },
+  { "alignof",         RID_ALIGNOF,    D_C2X | D_CXX11 | D_CXXWARN },
   { "asm",             RID_ASM,        D_ASM },
   { "auto",            RID_AUTO,       0 },
-  { "bool",            RID_BOOL,       D_CXXONLY | D_CXXWARN },
+  { "bool",            RID_BOOL,       D_C2X | D_CXXWARN },
   { "break",           RID_BREAK,      0 },
   { "case",            RID_CASE,       0 },
   { "catch",           RID_CATCH,      D_CXX_OBJC | D_CXXWARN },
@@ -489,7 +489,7 @@ const struct c_common_resword c_common_reswords[] =
   { "explicit",                RID_EXPLICIT,   D_CXXONLY | D_CXXWARN },
   { "export",          RID_EXPORT,     D_CXXONLY | D_CXXWARN },
   { "extern",          RID_EXTERN,     0 },
-  { "false",           RID_FALSE,      D_CXXONLY | D_CXXWARN },
+  { "false",           RID_FALSE,      D_C2X | D_CXXWARN },
   { "float",           RID_FLOAT,      0 },
   { "for",             RID_FOR,        0 },
   { "friend",          RID_FRIEND,     D_CXXONLY | D_CXXWARN },
@@ -515,15 +515,15 @@ const struct c_common_resword c_common_reswords[] =
   { "signed",          RID_SIGNED,     0 },
   { "sizeof",          RID_SIZEOF,     0 },
   { "static",          RID_STATIC,     0 },
-  { "static_assert",    RID_STATIC_ASSERT, D_CXXONLY | D_CXX11 | D_CXXWARN },
+  { "static_assert",    RID_STATIC_ASSERT, D_C2X | D_CXX11 | D_CXXWARN },
   { "static_cast",     RID_STATCAST,   D_CXXONLY | D_CXXWARN },
   { "struct",          RID_STRUCT,     0 },
   { "switch",          RID_SWITCH,     0 },
   { "template",                RID_TEMPLATE,   D_CXXONLY | D_CXXWARN },
   { "this",            RID_THIS,       D_CXXONLY | D_CXXWARN },
-  { "thread_local",    RID_THREAD,     D_CXXONLY | D_CXX11 | D_CXXWARN },
+  { "thread_local",    RID_THREAD,     D_C2X | D_CXX11 | D_CXXWARN },
   { "throw",           RID_THROW,      D_CXX_OBJC | D_CXXWARN },
-  { "true",            RID_TRUE,       D_CXXONLY | D_CXXWARN },
+  { "true",            RID_TRUE,       D_C2X | D_CXXWARN },
   { "try",             RID_TRY,        D_CXX_OBJC | D_CXXWARN },
   { "typedef",         RID_TYPEDEF,    0 },
   { "typename",                RID_TYPENAME,   D_CXXONLY | D_CXXWARN },
index 72db5b527f8c4a425b8bc6b65bbcbe64962b0a26..d134448196ed9f594a9fb3258e82789fcb4da855 100644 (file)
@@ -2630,13 +2630,14 @@ c_parser_static_assert_declaration_no_semi (c_parser *parser)
   tree string = NULL_TREE;
 
   gcc_assert (c_parser_next_token_is_keyword (parser, RID_STATIC_ASSERT));
+  tree spelling = c_parser_peek_token (parser)->value;
   assert_loc = c_parser_peek_token (parser)->location;
   if (flag_isoc99)
     pedwarn_c99 (assert_loc, OPT_Wpedantic,
-                "ISO C99 does not support %<_Static_assert%>");
+                "ISO C99 does not support %qE", spelling);
   else
     pedwarn_c99 (assert_loc, OPT_Wpedantic,
-                "ISO C90 does not support %<_Static_assert%>");
+                "ISO C90 does not support %qE", spelling);
   c_parser_consume_token (parser);
   matching_parens parens;
   if (!parens.require_open (parser))
@@ -2667,7 +2668,7 @@ c_parser_static_assert_declaration_no_semi (c_parser *parser)
        new C2X feature of _Static_assert.  */
     pedwarn_c11 (assert_loc, OPT_Wpedantic,
                 "ISO C11 does not support omitting the string in "
-                "%<_Static_assert%>");
+                "%qE", spelling);
   parens.require_close (parser);
 
   if (!INTEGRAL_TYPE_P (TREE_TYPE (value)))
@@ -3774,13 +3775,14 @@ c_parser_alignas_specifier (c_parser * parser)
   tree ret = error_mark_node;
   location_t loc = c_parser_peek_token (parser)->location;
   gcc_assert (c_parser_next_token_is_keyword (parser, RID_ALIGNAS));
+  tree spelling = c_parser_peek_token (parser)->value;
   c_parser_consume_token (parser);
   if (flag_isoc99)
     pedwarn_c99 (loc, OPT_Wpedantic,
-                "ISO C99 does not support %<_Alignas%>");
+                "ISO C99 does not support %qE", spelling);
   else
     pedwarn_c99 (loc, OPT_Wpedantic,
-                "ISO C90 does not support %<_Alignas%>");
+                "ISO C90 does not support %qE", spelling);
   matching_parens parens;
   if (!parens.require_open (parser))
     return ret;
@@ -8399,10 +8401,12 @@ c_parser_alignof_expression (c_parser *parser)
   location_t end_loc;
   tree alignof_spelling = c_parser_peek_token (parser)->value;
   gcc_assert (c_parser_next_token_is_keyword (parser, RID_ALIGNOF));
-  bool is_c11_alignof = strcmp (IDENTIFIER_POINTER (alignof_spelling),
-                               "_Alignof") == 0;
+  bool is_c11_alignof = (strcmp (IDENTIFIER_POINTER (alignof_spelling),
+                               "_Alignof") == 0
+                        || strcmp (IDENTIFIER_POINTER (alignof_spelling),
+                                   "alignof") == 0);
   /* A diagnostic is not required for the use of this identifier in
-     the implementation namespace; only diagnose it for the C11
+     the implementation namespace; only diagnose it for the C11 or C2X
      spelling because of existing code using the other spellings.  */
   if (is_c11_alignof)
     {
@@ -10272,6 +10276,16 @@ c_parser_postfix_expression (c_parser *parser)
          pedwarn_c11 (loc, OPT_Wpedantic,
                       "ISO C does not support %qs before C2X", "nullptr");
          break;
+       case RID_TRUE:
+         c_parser_consume_token (parser);
+         expr.value = boolean_true_node;
+         set_c_expr_source_range (&expr, tok_range);
+         break;
+       case RID_FALSE:
+         c_parser_consume_token (parser);
+         expr.value = boolean_false_node;
+         set_c_expr_source_range (&expr, tok_range);
+         break;
        default:
          c_parser_error (parser, "expected expression");
          expr.set_error ();
index b10cad1ff246154128f596c0d415a1ac53a27c0c..6ed424343b442fe3693283607285a8c885efadfb 100644 (file)
@@ -26,7 +26,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #ifndef _STDALIGN_H
 #define _STDALIGN_H
 
-#ifndef __cplusplus
+#if (!defined __cplusplus                                              \
+     && !(defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L))
 
 #define alignas _Alignas
 #define alignof _Alignof
index fe500d98dadd89126b37e10d4d7f5aea5f8a754d..bcf78395941578ff6f27d679dcc338efa3697367 100644 (file)
@@ -30,11 +30,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 #ifndef __cplusplus
 
-#define bool   _Bool
 #if defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L
-#define true   ((_Bool)+1u)
-#define false  ((_Bool)+0u)
+/* bool, true and false are keywords.  */
 #else
+#define bool   _Bool
 #define true   1
 #define false  0
 #endif
diff --git a/gcc/testsuite/gcc.dg/c11-keywords-1.c b/gcc/testsuite/gcc.dg/c11-keywords-1.c
new file mode 100644 (file)
index 0000000..974ccfc
--- /dev/null
@@ -0,0 +1,11 @@
+/* Test new C2x keywords not keywords in C11.  */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+int alignas;
+int alignof;
+int bool;
+int false;
+int true;
+int static_assert;
+int thread_local;
diff --git a/gcc/testsuite/gcc.dg/c2x-align-1.c b/gcc/testsuite/gcc.dg/c2x-align-1.c
new file mode 100644 (file)
index 0000000..25dbd62
--- /dev/null
@@ -0,0 +1,41 @@
+/* Test C2x alignment support.  Test valid code.  */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+#include <stddef.h>
+
+alignas (alignof (max_align_t)) char c;
+extern alignas (max_align_t) char c;
+extern char c;
+
+extern alignas (max_align_t) short s;
+alignas (max_align_t) short s;
+
+alignas (int) int i;
+extern int i;
+
+alignas (max_align_t) long l;
+
+alignas (max_align_t) long long ll;
+
+alignas (max_align_t) float f;
+
+alignas (max_align_t) double d;
+
+alignas (max_align_t) _Complex long double cld;
+
+alignas (0) alignas (int) alignas (char) char ca[10];
+
+alignas ((int) alignof (max_align_t) + 0) int x;
+
+enum e { E = alignof (max_align_t) };
+alignas (E) int y;
+
+void
+func (void)
+{
+  alignas (max_align_t) long long auto_ll;
+}
+
+/* Valid, but useless.  */
+alignas (0) struct s; /* { dg-warning "useless" } */
diff --git a/gcc/testsuite/gcc.dg/c2x-align-6.c b/gcc/testsuite/gcc.dg/c2x-align-6.c
new file mode 100644 (file)
index 0000000..8559a58
--- /dev/null
@@ -0,0 +1,8 @@
+/* Test C2x alignof returning minimum alignment for a type.  */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+#define _Alignas alignas
+#define _Alignof alignof
+
+#include "c11-align-6.c"
index b64da1f7b43a00be2a76bc509274d822b0ac3316..992fb3180874dc10e1f0a8abdc1fe10d4d4b44f5 100644 (file)
@@ -11,16 +11,16 @@ extern void abort (void);
 extern void exit (int);
 extern int strcmp (const char *, const char *);
 
-#if false - 1 < 0
-#error "false signed in #if"
+#if false - 1 >= 0
+#error "false unsigned in #if"
 #endif
 
 #if false != 0
 #error "false not 0 in #if"
 #endif
 
-#if true - 2 < 0
-#error "true signed in #if"
+#if true - 2 >= 0
+#error "true unsigned in #if"
 #endif
 
 #if true != 1
@@ -30,20 +30,14 @@ extern int strcmp (const char *, const char *);
 int
 main (void)
 {
-  if (strcmp (str (bool), "_Bool") != 0)
-    abort ();
   if (_Generic (true, _Bool : 1) != 1)
     abort ();
   if (true != 1)
     abort ();
-  if (strcmp (str (true), "((_Bool)+1u)") != 0)
-    abort ();
   if (_Generic (false, _Bool : 1) != 1)
     abort ();
   if (false != 0)
     abort ();
-  if (strcmp (str (false), "((_Bool)+0u)") != 0)
-    abort ();
   if (strcmp (str (__bool_true_false_are_defined), "1") != 0)
     abort ();
   exit (0);
diff --git a/gcc/testsuite/gcc.dg/c2x-bool-2.c b/gcc/testsuite/gcc.dg/c2x-bool-2.c
new file mode 100644 (file)
index 0000000..4edb34e
--- /dev/null
@@ -0,0 +1,42 @@
+/* Test bool, true and false keywords in C2x.  */
+/* { dg-do run } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+extern void abort (void);
+extern void exit (int);
+
+#if false - 1 >= 0
+#error "false unsigned in #if"
+#endif
+
+#if false != 0
+#error "false not 0 in #if"
+#endif
+
+#if true - 2 >= 0
+#error "true unsigned in #if"
+#endif
+
+#if true != 1
+#error "true not 1 in #if"
+#endif
+
+extern bool b;
+extern _Bool b;
+
+_Static_assert (false == 0);
+_Static_assert (true == 1);
+
+int
+main (void)
+{
+  if (_Generic (true, bool : 1) != 1)
+    abort ();
+  if (true != 1)
+    abort ();
+  if (_Generic (false, bool : 1) != 1)
+    abort ();
+  if (false != 0)
+    abort ();
+  exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/c2x-static-assert-3.c b/gcc/testsuite/gcc.dg/c2x-static-assert-3.c
new file mode 100644 (file)
index 0000000..5d84a6a
--- /dev/null
@@ -0,0 +1,6 @@
+/* Test C2x static assertions.  static_assert keyword.  */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic" } */
+
+static_assert (1);
+static_assert (1, "message");
diff --git a/gcc/testsuite/gcc.dg/c2x-static-assert-4.c b/gcc/testsuite/gcc.dg/c2x-static-assert-4.c
new file mode 100644 (file)
index 0000000..b3bcfb4
--- /dev/null
@@ -0,0 +1,6 @@
+/* Test C2x static assertions.  static_assert keyword.  Failed assertions.  */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic" } */
+
+static_assert (0); /* { dg-error "static assertion failed" } */
+static_assert (0, "message"); /* { dg-error "message" } */
diff --git a/gcc/testsuite/gcc.dg/c2x-thread-local-1.c b/gcc/testsuite/gcc.dg/c2x-thread-local-1.c
new file mode 100644 (file)
index 0000000..e1917bd
--- /dev/null
@@ -0,0 +1,6 @@
+/* Test C2x thread_local keyword.  */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x -pedantic-errors" } */
+
+thread_local int a;
+thread_local void f (void); /* { dg-error "storage class" } */
index a02290471aeb8782ef3a59f6fcb8a6544a1a8932..4bb02c418d05ebcdd832418e9348bc1750f51d2d 100644 (file)
@@ -1183,7 +1183,7 @@ eval_token (cpp_reader *pfile, const cpp_token *token,
     case CPP_NAME:
       if (token->val.node.node == pfile->spec_nodes.n_defined)
        return parse_defined (pfile);
-      else if (CPP_OPTION (pfile, cplusplus)
+      else if (CPP_OPTION (pfile, true_false)
               && (token->val.node.node == pfile->spec_nodes.n_true
                   || token->val.node.node == pfile->spec_nodes.n_false))
        {
index c25bcf215e027fca92eda729754408ff4b99709f..2db1e9cbdfbfc2873102df144c90669c8543b348 100644 (file)
@@ -526,6 +526,9 @@ struct cpp_options
   /* Nonzero for C++23 delimited escape sequences.  */
   unsigned char delimited_escape_seqs;
 
+  /* Nonzero for 'true' and 'false' in #if expressions.  */
+  unsigned char true_false;
+
   /* Holds the name of the target (execution) character set.  */
   const char *narrow_charset;
 
index 629252445e12b82c2b3df772c0774525ab0999dc..d3b4f00994b5877ef5c230e4a7cf7b2b3cd15936 100644 (file)
@@ -98,34 +98,35 @@ struct lang_flags
   char elifdef;
   char warning_directive;
   char delimited_escape_seqs;
+  char true_false;
 };
 
 static const struct lang_flags lang_defaults[] =
-{ /*              c99 c++ xnum xid c11 std digr ulit rlit udlit bincst digsep trig u8chlit vaopt scope dfp szlit elifdef warndir delim */
-  /* GNUC89   */  { 0,  0,  1,  0,  0,  0,  1,   0,   0,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0,      0,      0 },
-  /* GNUC99   */  { 1,  0,  1,  1,  0,  0,  1,   1,   1,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0,      0,      0 },
-  /* GNUC11   */  { 1,  0,  1,  1,  1,  0,  1,   1,   1,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0,      0,      0 },
-  /* GNUC17   */  { 1,  0,  1,  1,  1,  0,  1,   1,   1,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0,      0,      0 },
-  /* GNUC2X   */  { 1,  0,  1,  1,  1,  0,  1,   1,   1,   0,    1,     1,     0,   1,      1,   1,     1,   0,   1,      1,      0 },
-  /* STDC89   */  { 0,  0,  0,  0,  0,  1,  0,   0,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0,      0,      0 },
-  /* STDC94   */  { 0,  0,  0,  0,  0,  1,  1,   0,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0,      0,      0 },
-  /* STDC99   */  { 1,  0,  1,  1,  0,  1,  1,   0,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0,      0,      0 },
-  /* STDC11   */  { 1,  0,  1,  1,  1,  1,  1,   1,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0,      0,      0 },
-  /* STDC17   */  { 1,  0,  1,  1,  1,  1,  1,   1,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0,      0,      0 },
-  /* STDC2X   */  { 1,  0,  1,  1,  1,  1,  1,   1,   0,   0,    1,     1,     0,   1,      0,   1,     1,   0,   1,      1,      0 },
-  /* GNUCXX   */  { 0,  1,  1,  1,  0,  0,  1,   0,   0,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0,      0,      0 },
-  /* CXX98    */  { 0,  1,  0,  1,  0,  1,  1,   0,   0,   0,    0,     0,     1,   0,      0,   1,     0,   0,   0,      0,      0 },
-  /* GNUCXX11 */  { 1,  1,  1,  1,  1,  0,  1,   1,   1,   1,    0,     0,     0,   0,      1,   1,     0,   0,   0,      0,      0 },
-  /* CXX11    */  { 1,  1,  0,  1,  1,  1,  1,   1,   1,   1,    0,     0,     1,   0,      0,   1,     0,   0,   0,      0,      0 },
-  /* GNUCXX14 */  { 1,  1,  1,  1,  1,  0,  1,   1,   1,   1,    1,     1,     0,   0,      1,   1,     0,   0,   0,      0,      0 },
-  /* CXX14    */  { 1,  1,  0,  1,  1,  1,  1,   1,   1,   1,    1,     1,     1,   0,      0,   1,     0,   0,   0,      0,      0 },
-  /* GNUCXX17 */  { 1,  1,  1,  1,  1,  0,  1,   1,   1,   1,    1,     1,     0,   1,      1,   1,     0,   0,   0,      0,      0 },
-  /* CXX17    */  { 1,  1,  1,  1,  1,  1,  1,   1,   1,   1,    1,     1,     0,   1,      0,   1,     0,   0,   0,      0,      0 },
-  /* GNUCXX20 */  { 1,  1,  1,  1,  1,  0,  1,   1,   1,   1,    1,     1,     0,   1,      1,   1,     0,   0,   0,      0,      0 },
-  /* CXX20    */  { 1,  1,  1,  1,  1,  1,  1,   1,   1,   1,    1,     1,     0,   1,      1,   1,     0,   0,   0,      0,      0 },
-  /* GNUCXX23 */  { 1,  1,  1,  1,  1,  0,  1,   1,   1,   1,    1,     1,     0,   1,      1,   1,     0,   1,   1,      1,      1 },
-  /* CXX23    */  { 1,  1,  1,  1,  1,  1,  1,   1,   1,   1,    1,     1,     0,   1,      1,   1,     0,   1,   1,      1,      1 },
-  /* ASM      */  { 0,  0,  1,  0,  0,  0,  0,   0,   0,   0,    0,     0,     0,   0,      0,   0,     0,   0,   0,      0,      0 }
+{ /*              c99 c++ xnum xid c11 std digr ulit rlit udlit bincst digsep trig u8chlit vaopt scope dfp szlit elifdef warndir delim trufal */
+  /* GNUC89   */  { 0,  0,  1,  0,  0,  0,  1,   0,   0,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0,      0,      0,    0 },
+  /* GNUC99   */  { 1,  0,  1,  1,  0,  0,  1,   1,   1,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0,      0,      0,    0 },
+  /* GNUC11   */  { 1,  0,  1,  1,  1,  0,  1,   1,   1,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0,      0,      0,    0 },
+  /* GNUC17   */  { 1,  0,  1,  1,  1,  0,  1,   1,   1,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0,      0,      0,    0 },
+  /* GNUC2X   */  { 1,  0,  1,  1,  1,  0,  1,   1,   1,   0,    1,     1,     0,   1,      1,   1,     1,   0,   1,      1,      0,    1 },
+  /* STDC89   */  { 0,  0,  0,  0,  0,  1,  0,   0,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0,      0,      0,    0 },
+  /* STDC94   */  { 0,  0,  0,  0,  0,  1,  1,   0,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0,      0,      0,    0 },
+  /* STDC99   */  { 1,  0,  1,  1,  0,  1,  1,   0,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0,      0,      0,    0 },
+  /* STDC11   */  { 1,  0,  1,  1,  1,  1,  1,   1,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0,      0,      0,    0 },
+  /* STDC17   */  { 1,  0,  1,  1,  1,  1,  1,   1,   0,   0,    0,     0,     1,   0,      0,   0,     0,   0,   0,      0,      0,    0 },
+  /* STDC2X   */  { 1,  0,  1,  1,  1,  1,  1,   1,   0,   0,    1,     1,     0,   1,      0,   1,     1,   0,   1,      1,      0,    1 },
+  /* GNUCXX   */  { 0,  1,  1,  1,  0,  0,  1,   0,   0,   0,    0,     0,     0,   0,      1,   1,     0,   0,   0,      0,      0,    1 },
+  /* CXX98    */  { 0,  1,  0,  1,  0,  1,  1,   0,   0,   0,    0,     0,     1,   0,      0,   1,     0,   0,   0,      0,      0,    1 },
+  /* GNUCXX11 */  { 1,  1,  1,  1,  1,  0,  1,   1,   1,   1,    0,     0,     0,   0,      1,   1,     0,   0,   0,      0,      0,    1 },
+  /* CXX11    */  { 1,  1,  0,  1,  1,  1,  1,   1,   1,   1,    0,     0,     1,   0,      0,   1,     0,   0,   0,      0,      0,    1 },
+  /* GNUCXX14 */  { 1,  1,  1,  1,  1,  0,  1,   1,   1,   1,    1,     1,     0,   0,      1,   1,     0,   0,   0,      0,      0,    1 },
+  /* CXX14    */  { 1,  1,  0,  1,  1,  1,  1,   1,   1,   1,    1,     1,     1,   0,      0,   1,     0,   0,   0,      0,      0,    1 },
+  /* GNUCXX17 */  { 1,  1,  1,  1,  1,  0,  1,   1,   1,   1,    1,     1,     0,   1,      1,   1,     0,   0,   0,      0,      0,    1 },
+  /* CXX17    */  { 1,  1,  1,  1,  1,  1,  1,   1,   1,   1,    1,     1,     0,   1,      0,   1,     0,   0,   0,      0,      0,    1 },
+  /* GNUCXX20 */  { 1,  1,  1,  1,  1,  0,  1,   1,   1,   1,    1,     1,     0,   1,      1,   1,     0,   0,   0,      0,      0,    1 },
+  /* CXX20    */  { 1,  1,  1,  1,  1,  1,  1,   1,   1,   1,    1,     1,     0,   1,      1,   1,     0,   0,   0,      0,      0,    1 },
+  /* GNUCXX23 */  { 1,  1,  1,  1,  1,  0,  1,   1,   1,   1,    1,     1,     0,   1,      1,   1,     0,   1,   1,      1,      1,    1 },
+  /* CXX23    */  { 1,  1,  1,  1,  1,  1,  1,   1,   1,   1,    1,     1,     0,   1,      1,   1,     0,   1,   1,      1,      1,    1 },
+  /* ASM      */  { 0,  0,  1,  0,  0,  0,  0,   0,   0,   0,    0,     0,     0,   0,      0,   0,     0,   0,   0,      0,      0,    0 }
 };
 
 /* Sets internal flags correctly for a given language.  */
@@ -157,6 +158,7 @@ cpp_set_lang (cpp_reader *pfile, enum c_lang lang)
   CPP_OPTION (pfile, elifdef)                   = l->elifdef;
   CPP_OPTION (pfile, warning_directive)                 = l->warning_directive;
   CPP_OPTION (pfile, delimited_escape_seqs)     = l->delimited_escape_seqs;
+  CPP_OPTION (pfile, true_false)                = l->true_false;
 }
 
 /* Initialize library global state.  */