@@ -594,27 +594,25 @@ scflags parse_scflags(int specbits)
594
594
scf |= scf_async ;
595
595
if (specbits & 1 << RID_NORACE )
596
596
scf |= scf_norace ;
597
+ if (specbits & 1 << RID_NORETURN )
598
+ scf |= scf_noreturn ;
597
599
598
600
return scf ;
599
601
}
600
602
601
603
void check_variable_scflags (scflags scf ,
602
604
location l , const char * kind , const char * name )
603
605
{
604
- const char * badqual = NULL ;
605
- void (* msg )(location l , const char * format , ...) = error_with_location ;
606
+ static const char fmt_msg [] = "%s `%s' declared `%s'" ;
606
607
607
608
/* default already covered in parse_declarator */
609
+ /* gcc just warns inline and _Noreturn for variable. */
608
610
if (scf & scf_inline )
609
- {
610
- badqual = "inline" ;
611
- msg = pedwarn_with_location ; /* this is what gcc does */
612
- }
611
+ pedwarn_with_location (l , fmt_msg , kind , name , "inline" );
612
+ if (scf & scf_noreturn )
613
+ pedwarn_with_location (l , fmt_msg , kind , name , "_Noreturn" );
613
614
if (scf & scf_async )
614
- badqual = "async" ;
615
-
616
- if (badqual )
617
- msg (l , "%s `%s' declared `%s'" , kind , name , badqual );
615
+ error_with_location (l , fmt_msg , kind , name , "async" );
618
616
}
619
617
620
618
void check_array_size (expression size , const char * printname )
@@ -3628,6 +3626,7 @@ static char *rid_name_int(int id)
3628
3626
case RID_TASK : return "task" ;
3629
3627
case RID_DEFAULT : return "default" ;
3630
3628
case RID_NORACE : return "norace" ;
3629
+ case RID_NORETURN : return "_Noreturn" ;
3631
3630
default : assert (0 ); return NULL ;
3632
3631
}
3633
3632
}
0 commit comments