diff --git a/regression/ansi-c/gcc_attributes7/main.i b/regression/ansi-c/gcc_attributes7/main.i new file mode 100644 index 0000000000..ddb730cfd3 --- /dev/null +++ b/regression/ansi-c/gcc_attributes7/main.i @@ -0,0 +1,55 @@ +struct X { + int a; +}; + +struct S { + struct X x __attribute__((aligned( +# 81 "ring.h" 3 4 + 16 +# 81 "ring.h" + ))); + struct X x2 __attribute__((aligned( +# 82 "ring.h" 3 4 + ((( +# 82 "ring.h" + sizeof(struct X) +# 82 "ring.h" 3 4 + )+16 -1)&~(16 -1)) +# 82 "ring.h" + ))); +}; + +typedef int int8_t +# 194 "/usr/include/x86_64-linux-gnu/sys/types.h" +__attribute__( +# 194 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 +(__mode__ (__QI__)) +# 194 "/usr/include/x86_64-linux-gnu/sys/types.h" +) +# 194 "/usr/include/x86_64-linux-gnu/sys/types.h" 3 4 + ; + +int extundelete_process_dir_block(int fs, + int b +# 29 "block.h" 3 4 + __attribute__( +# 29 "block.h" + (unused) +# 29 "block.h" 3 4 + ) +# 29 "block.h" + , + int ref_offset +# 30 "block.h" 3 4 + __attribute__( +# 30 "block.h" + (unused) +# 30 "block.h" 3 4 + ) +# 30 "block.h" + , + void *priv_data); + +int main() +{ +} diff --git a/regression/ansi-c/gcc_attributes7/test.desc b/regression/ansi-c/gcc_attributes7/test.desc new file mode 100644 index 0000000000..e5548900ad --- /dev/null +++ b/regression/ansi-c/gcc_attributes7/test.desc @@ -0,0 +1,8 @@ +CORE +main.i + +^EXIT=0$ +^SIGNAL=0$ +-- +^warning: ignoring +^CONVERSION ERROR$ diff --git a/src/ansi-c/scanner.l b/src/ansi-c/scanner.l index 4e4626d927..99e8b488f7 100644 --- a/src/ansi-c/scanner.l +++ b/src/ansi-c/scanner.l @@ -195,6 +195,7 @@ string_lit ("L"|"u"|"U"|"u8")?["]{s_char}*["] %x MSC_PRAGMA %x MSC_ANNOTATION %x GCC_ATTRIBUTE1 +%x GCC_ATTRIBUTE1a %x GCC_ATTRIBUTE2 %x GCC_ATTRIBUTE3 %x GCC_ATTRIBUTE4 @@ -1346,8 +1347,22 @@ __decltype { if(PARSER.cpp98 && PARSER.mode==ansi_c_parsert::GCC) } { -"("{ws}"(" | -"("{newline}"(" { BEGIN(GCC_ATTRIBUTE2); PARSER.parenthesis_counter=0; } +{cpplineno} { + preprocessor_line(yytext, PARSER); + PARSER.set_line_no(PARSER.get_line_no()-1); + } +{ws} { /* ignore */ } +{newline} { /* ignore */ } +"(" { BEGIN(GCC_ATTRIBUTE1a); } +. { BEGIN(GRAMMAR); loc(); return yytext[0]; } +} + +{ +{cpplineno} { + preprocessor_line(yytext, PARSER); + PARSER.set_line_no(PARSER.get_line_no()-1); + } +"(" { BEGIN(GCC_ATTRIBUTE2); PARSER.parenthesis_counter=0; } {ws} { /* ignore */ } {newline} { /* ignore */ } . { BEGIN(GRAMMAR); loc(); return yytext[0]; } @@ -1386,6 +1401,10 @@ __decltype { if(PARSER.cpp98 && PARSER.mode==ansi_c_parsert::GCC) } { // an attribute we do process +{cpplineno} { + preprocessor_line(yytext, PARSER); + PARSER.set_line_no(PARSER.get_line_no()-1); + } "(" { PARSER.parenthesis_counter++; loc(); return '('; } ")" { if(PARSER.parenthesis_counter==0) { @@ -1436,6 +1455,10 @@ __decltype { if(PARSER.cpp98 && PARSER.mode==ansi_c_parsert::GCC) } { // end bit: the closing parenthesis +{cpplineno} { + preprocessor_line(yytext, PARSER); + PARSER.set_line_no(PARSER.get_line_no()-1); + } ")" { BEGIN(GRAMMAR); } {ws} { /* Throw away */ } {newline} { /* Throw away */ }