Fixed #5328 (Does not handle __attribute((xxx)) in typedefs)
This commit is contained in:
parent
b564986d5d
commit
806ef44509
|
@ -9099,7 +9099,7 @@ void Tokenizer::simplifyDeclspec()
|
||||||
void Tokenizer::simplifyAttribute()
|
void Tokenizer::simplifyAttribute()
|
||||||
{
|
{
|
||||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||||
while (Token::simpleMatch(tok, "__attribute__ (") && tok->next()->link() && tok->next()->link()->next()) {
|
while (Token::Match(tok, "__attribute__|__attribute (") && tok->next()->link() && tok->next()->link()->next()) {
|
||||||
if (Token::simpleMatch(tok->tokAt(2), "( constructor")) {
|
if (Token::simpleMatch(tok->tokAt(2), "( constructor")) {
|
||||||
// prototype for constructor is: void func(void);
|
// prototype for constructor is: void func(void);
|
||||||
if (tok->next()->link()->next()->str() == "void") // __attribute__((constructor)) void func() {}
|
if (tok->next()->link()->next()->str() == "void") // __attribute__((constructor)) void func() {}
|
||||||
|
|
|
@ -7079,6 +7079,11 @@ private:
|
||||||
ASSERT_EQUALS("short array [ 3 ] ;", tokenizeAndStringify("short array[3] __attribute__ ((aligned));"));
|
ASSERT_EQUALS("short array [ 3 ] ;", tokenizeAndStringify("short array[3] __attribute__ ((aligned));"));
|
||||||
ASSERT_EQUALS("int x [ 2 ] ;", tokenizeAndStringify("int x[2] __attribute__ ((packed));"));
|
ASSERT_EQUALS("int x [ 2 ] ;", tokenizeAndStringify("int x[2] __attribute__ ((packed));"));
|
||||||
ASSERT_EQUALS("int vecint ;", tokenizeAndStringify("int __attribute__((mode(SI))) __attribute__((vector_size (16))) vecint;"));
|
ASSERT_EQUALS("int vecint ;", tokenizeAndStringify("int __attribute__((mode(SI))) __attribute__((vector_size (16))) vecint;"));
|
||||||
|
|
||||||
|
// alternate spelling #5328
|
||||||
|
ASSERT_EQUALS("short array [ 3 ] ;", tokenizeAndStringify("short array[3] __attribute ((aligned));"));
|
||||||
|
ASSERT_EQUALS("int x [ 2 ] ;", tokenizeAndStringify("int x[2] __attribute ((packed));"));
|
||||||
|
ASSERT_EQUALS("int vecint ;", tokenizeAndStringify("int __attribute((mode(SI))) __attribute((vector_size (16))) vecint;"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void cpp0xtemplate1() {
|
void cpp0xtemplate1() {
|
||||||
|
|
Loading…
Reference in New Issue