Ignore some more attributes

Detected when using -Wunsupported
This commit is contained in:
herman ten brugge
2025-11-04 15:03:19 +01:00
parent cdebce3079
commit ab2ce3b13a
2 changed files with 25 additions and 1 deletions

View File

@@ -4013,11 +4013,27 @@ redo:
case TOK_NODEBUG2: case TOK_NODEBUG2:
ad->a.nodebug = 1; ad->a.nodebug = 1;
break; break;
case TOK_USED1:
case TOK_USED2:
case TOK_UNUSED1: case TOK_UNUSED1:
case TOK_UNUSED2: case TOK_UNUSED2:
/* currently, no need to handle it because tcc does not /* currently, no need to handle it because tcc does not
track unused objects */ track used/unused objects */
break; break;
case TOK_CONST1:
case TOK_CONST2:
case TOK_CONST3:
case TOK_PURE1:
case TOK_PURE2:
/* ignored */
break;
case TOK_NOINLINE:
/* ignored */
break;
case TOK_FORMAT1:
case TOK_FORMAT2:
/* ignored */
goto skip_param;
case TOK_NORETURN1: case TOK_NORETURN1:
case TOK_NORETURN2: case TOK_NORETURN2:
ad->f.func_noreturn = 1; ad->f.func_noreturn = 1;
@@ -4091,6 +4107,7 @@ redo:
default: default:
tcc_warning_c(warn_unsupported)("'%s' attribute ignored", get_tok_str(t, NULL)); tcc_warning_c(warn_unsupported)("'%s' attribute ignored", get_tok_str(t, NULL));
/* skip parameters */ /* skip parameters */
skip_param:
if (tok == '(') { if (tok == '(') {
int parenthesis = 0; int parenthesis = 0;
do { do {

View File

@@ -23,6 +23,8 @@
DEF(TOK_CONST1, "const") DEF(TOK_CONST1, "const")
DEF(TOK_CONST2, "__const") /* gcc keyword */ DEF(TOK_CONST2, "__const") /* gcc keyword */
DEF(TOK_CONST3, "__const__") /* gcc keyword */ DEF(TOK_CONST3, "__const__") /* gcc keyword */
DEF(TOK_PURE1, "pure")
DEF(TOK_PURE2, "__pure__")
DEF(TOK_VOLATILE1, "volatile") DEF(TOK_VOLATILE1, "volatile")
DEF(TOK_VOLATILE2, "__volatile") /* gcc keyword */ DEF(TOK_VOLATILE2, "__volatile") /* gcc keyword */
DEF(TOK_VOLATILE3, "__volatile__") /* gcc keyword */ DEF(TOK_VOLATILE3, "__volatile__") /* gcc keyword */
@@ -114,8 +116,12 @@
DEF(TOK_WEAK2, "__weak__") DEF(TOK_WEAK2, "__weak__")
DEF(TOK_ALIAS1, "alias") DEF(TOK_ALIAS1, "alias")
DEF(TOK_ALIAS2, "__alias__") DEF(TOK_ALIAS2, "__alias__")
DEF(TOK_USED1, "used")
DEF(TOK_USED2, "__used__")
DEF(TOK_UNUSED1, "unused") DEF(TOK_UNUSED1, "unused")
DEF(TOK_UNUSED2, "__unused__") DEF(TOK_UNUSED2, "__unused__")
DEF(TOK_FORMAT1, "format")
DEF(TOK_FORMAT2, "__format__")
DEF(TOK_NODEBUG1, "nodebug") DEF(TOK_NODEBUG1, "nodebug")
DEF(TOK_NODEBUG2, "__nodebug__") DEF(TOK_NODEBUG2, "__nodebug__")
DEF(TOK_CDECL1, "cdecl") DEF(TOK_CDECL1, "cdecl")
@@ -140,6 +146,7 @@
DEF(TOK_DESTRUCTOR2, "__destructor__") DEF(TOK_DESTRUCTOR2, "__destructor__")
DEF(TOK_ALWAYS_INLINE1, "always_inline") DEF(TOK_ALWAYS_INLINE1, "always_inline")
DEF(TOK_ALWAYS_INLINE2, "__always_inline__") DEF(TOK_ALWAYS_INLINE2, "__always_inline__")
DEF(TOK_NOINLINE, "__noinline__")
DEF(TOK_MODE, "__mode__") DEF(TOK_MODE, "__mode__")
DEF(TOK_MODE_QI, "__QI__") DEF(TOK_MODE_QI, "__QI__")