Permit preprocessor command within __attribute__

This commit is contained in:
Michael Tautschnig 2016-04-11 16:12:41 +02:00
parent 49644fc37a
commit ad24b5a9b9
3 changed files with 88 additions and 2 deletions

View File

@ -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()
{
}

View File

@ -0,0 +1,8 @@
CORE
main.i
^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring
^CONVERSION ERROR$

View File

@ -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)
}
<GCC_ATTRIBUTE1>{
"("{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]; }
}
<GCC_ATTRIBUTE1a>{
{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)
}
<GCC_ATTRIBUTE3>{ // 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)
}
<GCC_ATTRIBUTE5>{ // 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 */ }