Skip to content

Commit ab2ce3b

Browse files
committed
Ignore some more attributes
Detected when using -Wunsupported
1 parent cdebce3 commit ab2ce3b

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

tccgen.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4013,11 +4013,27 @@ static void parse_attribute(AttributeDef *ad)
40134013
case TOK_NODEBUG2:
40144014
ad->a.nodebug = 1;
40154015
break;
4016+
case TOK_USED1:
4017+
case TOK_USED2:
40164018
case TOK_UNUSED1:
40174019
case TOK_UNUSED2:
40184020
/* currently, no need to handle it because tcc does not
4019-
track unused objects */
4021+
track used/unused objects */
40204022
break;
4023+
case TOK_CONST1:
4024+
case TOK_CONST2:
4025+
case TOK_CONST3:
4026+
case TOK_PURE1:
4027+
case TOK_PURE2:
4028+
/* ignored */
4029+
break;
4030+
case TOK_NOINLINE:
4031+
/* ignored */
4032+
break;
4033+
case TOK_FORMAT1:
4034+
case TOK_FORMAT2:
4035+
/* ignored */
4036+
goto skip_param;
40214037
case TOK_NORETURN1:
40224038
case TOK_NORETURN2:
40234039
ad->f.func_noreturn = 1;
@@ -4091,6 +4107,7 @@ static void parse_attribute(AttributeDef *ad)
40914107
default:
40924108
tcc_warning_c(warn_unsupported)("'%s' attribute ignored", get_tok_str(t, NULL));
40934109
/* skip parameters */
4110+
skip_param:
40944111
if (tok == '(') {
40954112
int parenthesis = 0;
40964113
do {

tcctok.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
DEF(TOK_CONST1, "const")
2424
DEF(TOK_CONST2, "__const") /* gcc keyword */
2525
DEF(TOK_CONST3, "__const__") /* gcc keyword */
26+
DEF(TOK_PURE1, "pure")
27+
DEF(TOK_PURE2, "__pure__")
2628
DEF(TOK_VOLATILE1, "volatile")
2729
DEF(TOK_VOLATILE2, "__volatile") /* gcc keyword */
2830
DEF(TOK_VOLATILE3, "__volatile__") /* gcc keyword */
@@ -114,8 +116,12 @@
114116
DEF(TOK_WEAK2, "__weak__")
115117
DEF(TOK_ALIAS1, "alias")
116118
DEF(TOK_ALIAS2, "__alias__")
119+
DEF(TOK_USED1, "used")
120+
DEF(TOK_USED2, "__used__")
117121
DEF(TOK_UNUSED1, "unused")
118122
DEF(TOK_UNUSED2, "__unused__")
123+
DEF(TOK_FORMAT1, "format")
124+
DEF(TOK_FORMAT2, "__format__")
119125
DEF(TOK_NODEBUG1, "nodebug")
120126
DEF(TOK_NODEBUG2, "__nodebug__")
121127
DEF(TOK_CDECL1, "cdecl")
@@ -140,6 +146,7 @@
140146
DEF(TOK_DESTRUCTOR2, "__destructor__")
141147
DEF(TOK_ALWAYS_INLINE1, "always_inline")
142148
DEF(TOK_ALWAYS_INLINE2, "__always_inline__")
149+
DEF(TOK_NOINLINE, "__noinline__")
143150

144151
DEF(TOK_MODE, "__mode__")
145152
DEF(TOK_MODE_QI, "__QI__")

0 commit comments

Comments
 (0)