Skip to content

Commit a7edfcd

Browse files
committed
cc: implement ISO C11 _Noreturn function specifier
this keyword is removed for C23 and above for C standard lower then C11 is implemented as extension
1 parent cc41d26 commit a7edfcd

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

bld/cc/c/cscan.c

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -219,19 +219,27 @@ TOKEN KwLookup( const char *buf, size_t len )
219219
/*
220220
* look up id in keyword table
221221
*/
222-
if( CompVars.cstd < STD_C99 ) {
223-
switch( token ) {
224-
case T__BOOL:
225-
case T_INLINE:
226-
if( CompFlags.extensions_enabled )
227-
break;
228-
/* fall through */
229-
case T_RESTRICT:
230-
case T__COMPLEX:
231-
case T__IMAGINARY:
232-
case T___OW_IMAGINARY_UNIT:
222+
switch( token ) {
223+
case T__BOOL:
224+
case T_INLINE:
225+
if( CompVars.cstd < STD_C99
226+
&& !CompFlags.extensions_enabled )
227+
return( T_ID );
228+
break;
229+
case T__COMPLEX:
230+
case T_RESTRICT:
231+
case T__IMAGINARY:
232+
case T___OW_IMAGINARY_UNIT:
233+
if( CompVars.cstd < STD_C99 ) {
233234
return( T_ID );
234235
}
236+
break;
237+
case T__NORETURN:
238+
if( CompVars.cstd >= STD_C23
239+
|| CompVars.cstd < STD_C11
240+
&& !CompFlags.extensions_enabled )
241+
return( T_ID );
242+
break;
235243
}
236244
keyword = Tokens[token];
237245
if( *keyword == buf[0] ) {

0 commit comments

Comments
 (0)