Mercurial > hg > CbC > CbC_gcc
comparison libcpp/init.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* CPP Library. | 1 /* CPP Library. |
2 Copyright (C) 1986-2017 Free Software Foundation, Inc. | 2 Copyright (C) 1986-2018 Free Software Foundation, Inc. |
3 Contributed by Per Bothner, 1994-95. | 3 Contributed by Per Bothner, 1994-95. |
4 Based on CCCP program by Paul Rubin, June 1986 | 4 Based on CCCP program by Paul Rubin, June 1986 |
5 Adapted to ANSI C, Richard Stallman, Jan 1987 | 5 Adapted to ANSI C, Richard Stallman, Jan 1987 |
6 | 6 |
7 This program is free software; you can redistribute it and/or modify it | 7 This program is free software; you can redistribute it and/or modify it |
89 char user_literals; | 89 char user_literals; |
90 char binary_constants; | 90 char binary_constants; |
91 char digit_separators; | 91 char digit_separators; |
92 char trigraphs; | 92 char trigraphs; |
93 char utf8_char_literals; | 93 char utf8_char_literals; |
94 char va_opt; | |
94 }; | 95 }; |
95 | 96 |
96 static const struct lang_flags lang_defaults[] = | 97 static const struct lang_flags lang_defaults[] = |
97 { /* c99 c++ xnum xid c11 std digr ulit rlit udlit bincst digsep trig u8chlit */ | 98 { /* c99 c++ xnum xid c11 std digr ulit rlit udlit bincst digsep trig u8chlit vaopt */ |
98 /* GNUC89 */ { 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 }, | 99 /* GNUC89 */ { 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1 }, |
99 /* GNUC99 */ { 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0 }, | 100 /* GNUC99 */ { 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1 }, |
100 /* GNUC11 */ { 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0 }, | 101 /* GNUC11 */ { 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1 }, |
101 /* STDC89 */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0 }, | 102 /* GNUC17 */ { 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1 }, |
102 /* STDC94 */ { 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0 }, | 103 /* GNUC2X */ { 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1 }, |
103 /* STDC99 */ { 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0 }, | 104 /* STDC89 */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, |
104 /* STDC11 */ { 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0 }, | 105 /* STDC94 */ { 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0 }, |
105 /* GNUCXX */ { 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 }, | 106 /* STDC99 */ { 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0 }, |
106 /* CXX98 */ { 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0 }, | 107 /* STDC11 */ { 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0 }, |
107 /* GNUCXX11 */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0 }, | 108 /* STDC17 */ { 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0 }, |
108 /* CXX11 */ { 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0 }, | 109 /* STDC2X */ { 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0 }, |
109 /* GNUCXX14 */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0 }, | 110 /* GNUCXX */ { 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1 }, |
110 /* CXX14 */ { 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }, | 111 /* CXX98 */ { 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0 }, |
111 /* GNUCXX17 */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1 }, | 112 /* GNUCXX11 */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1 }, |
112 /* CXX17 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1 }, | 113 /* CXX11 */ { 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0 }, |
113 /* GNUCXX2A */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1 }, | 114 /* GNUCXX14 */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1 }, |
114 /* CXX2A */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1 }, | 115 /* CXX14 */ { 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 }, |
115 /* ASM */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } | 116 /* GNUCXX17 */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1 }, |
117 /* CXX17 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0 }, | |
118 /* GNUCXX2A */ { 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1 }, | |
119 /* CXX2A */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1 }, | |
120 /* ASM */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } | |
116 }; | 121 }; |
117 | 122 |
118 /* Sets internal flags correctly for a given language. */ | 123 /* Sets internal flags correctly for a given language. */ |
119 void | 124 void |
120 cpp_set_lang (cpp_reader *pfile, enum c_lang lang) | 125 cpp_set_lang (cpp_reader *pfile, enum c_lang lang) |
135 CPP_OPTION (pfile, user_literals) = l->user_literals; | 140 CPP_OPTION (pfile, user_literals) = l->user_literals; |
136 CPP_OPTION (pfile, binary_constants) = l->binary_constants; | 141 CPP_OPTION (pfile, binary_constants) = l->binary_constants; |
137 CPP_OPTION (pfile, digit_separators) = l->digit_separators; | 142 CPP_OPTION (pfile, digit_separators) = l->digit_separators; |
138 CPP_OPTION (pfile, trigraphs) = l->trigraphs; | 143 CPP_OPTION (pfile, trigraphs) = l->trigraphs; |
139 CPP_OPTION (pfile, utf8_char_literals) = l->utf8_char_literals; | 144 CPP_OPTION (pfile, utf8_char_literals) = l->utf8_char_literals; |
145 CPP_OPTION (pfile, va_opt) = l->va_opt; | |
140 } | 146 } |
141 | 147 |
142 /* Initialize library global state. */ | 148 /* Initialize library global state. */ |
143 static void | 149 static void |
144 init_library (void) | 150 init_library (void) |
474 if (b->value == BT_HAS_ATTRIBUTE | 480 if (b->value == BT_HAS_ATTRIBUTE |
475 && (CPP_OPTION (pfile, lang) == CLK_ASM | 481 && (CPP_OPTION (pfile, lang) == CLK_ASM |
476 || pfile->cb.has_attribute == NULL)) | 482 || pfile->cb.has_attribute == NULL)) |
477 continue; | 483 continue; |
478 cpp_hashnode *hp = cpp_lookup (pfile, b->name, b->len); | 484 cpp_hashnode *hp = cpp_lookup (pfile, b->name, b->len); |
479 hp->type = NT_MACRO; | 485 hp->type = NT_BUILTIN_MACRO; |
480 hp->flags |= NODE_BUILTIN; | |
481 if (b->always_warn_if_redefined) | 486 if (b->always_warn_if_redefined) |
482 hp->flags |= NODE_WARN; | 487 hp->flags |= NODE_WARN; |
483 hp->value.builtin = (enum cpp_builtin_type) b->value; | 488 hp->value.builtin = (enum cpp_builtin_type) b->value; |
484 } | 489 } |
485 } | 490 } |
516 } | 521 } |
517 else if (CPP_OPTION (pfile, lang) == CLK_ASM) | 522 else if (CPP_OPTION (pfile, lang) == CLK_ASM) |
518 _cpp_define_builtin (pfile, "__ASSEMBLER__ 1"); | 523 _cpp_define_builtin (pfile, "__ASSEMBLER__ 1"); |
519 else if (CPP_OPTION (pfile, lang) == CLK_STDC94) | 524 else if (CPP_OPTION (pfile, lang) == CLK_STDC94) |
520 _cpp_define_builtin (pfile, "__STDC_VERSION__ 199409L"); | 525 _cpp_define_builtin (pfile, "__STDC_VERSION__ 199409L"); |
526 else if (CPP_OPTION (pfile, lang) == CLK_STDC2X | |
527 || CPP_OPTION (pfile, lang) == CLK_GNUC2X) | |
528 _cpp_define_builtin (pfile, "__STDC_VERSION__ 202000L"); | |
529 else if (CPP_OPTION (pfile, lang) == CLK_STDC17 | |
530 || CPP_OPTION (pfile, lang) == CLK_GNUC17) | |
531 _cpp_define_builtin (pfile, "__STDC_VERSION__ 201710L"); | |
521 else if (CPP_OPTION (pfile, lang) == CLK_STDC11 | 532 else if (CPP_OPTION (pfile, lang) == CLK_STDC11 |
522 || CPP_OPTION (pfile, lang) == CLK_GNUC11) | 533 || CPP_OPTION (pfile, lang) == CLK_GNUC11) |
523 _cpp_define_builtin (pfile, "__STDC_VERSION__ 201112L"); | 534 _cpp_define_builtin (pfile, "__STDC_VERSION__ 201112L"); |
524 else if (CPP_OPTION (pfile, c99)) | 535 else if (CPP_OPTION (pfile, c99)) |
525 _cpp_define_builtin (pfile, "__STDC_VERSION__ 199901L"); | 536 _cpp_define_builtin (pfile, "__STDC_VERSION__ 199901L"); |