File tree Expand file tree Collapse file tree 4 files changed +41
-1
lines changed
regression/ansi-c/c23_attributes1 Expand file tree Collapse file tree 4 files changed +41
-1
lines changed Original file line number Diff line number Diff line change
1
+ enum [[nodiscard ]] error_t
2
+ {
3
+ A ,
4
+ };
5
+
6
+ int main ()
7
+ {
8
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ -std=c2x
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ --
7
+ ^warning: ignoring
8
+ ^CONVERSION ERROR$
Original file line number Diff line number Diff line change @@ -899,8 +899,18 @@ enable_or_disable ("enable"|"disable")
899
899
" __if_not_exists" { return MSC_cpp_keyword (TOK_MSC_IF_NOT_EXISTS); }
900
900
" __underlying_type" { return conditional_keyword (PARSER.cpp98 , TOK_UNDERLYING_TYPE); }
901
901
902
- " [[" { if (PARSER.c23 )
902
+ " [[" { // C23 attributes (also C++11 and later, but for C++ we
903
+ // handle them directly in the parser); GCC >= 11, Clang
904
+ // >= 17, and Visual Studio >= 2022 support these
905
+ // irrespective of the language standard selected on the
906
+ // command-line.
907
+ if (PARSER.c23 ||
908
+ PARSER.mode ==configt::ansi_ct::flavourt::GCC ||
909
+ PARSER.mode ==configt::ansi_ct::flavourt::CLANG ||
910
+ PARSER.mode ==configt::ansi_ct::flavourt::VISUAL_STUDIO)
911
+ {
903
912
BEGIN (STD_ANNOTATION);
913
+ }
904
914
else
905
915
{
906
916
yyless (1 ); // puts one [ back into stream
Original file line number Diff line number Diff line change @@ -648,6 +648,20 @@ int gcc_modet::doit()
648
648
std_string==" gnu1x" || std_string==" c1x" )
649
649
config.ansi_c .set_c11 ();
650
650
651
+ if (
652
+ std_string == " gnu17" || std_string == " c17" || std_string == " gnu18" ||
653
+ std_string == " c18" )
654
+ {
655
+ config.ansi_c .set_c17 ();
656
+ }
657
+
658
+ if (
659
+ std_string == " gnu2x" || std_string == " c2x" || std_string == " gnu23" ||
660
+ std_string == " c23" )
661
+ {
662
+ config.ansi_c .set_c23 ();
663
+ }
664
+
651
665
if (std_string==" c++11" || std_string==" c++1x" ||
652
666
std_string==" gnu++11" || std_string==" gnu++1x" ||
653
667
std_string==" c++1y" ||
You can’t perform that action at this time.
0 commit comments