diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index abdc0cfba..017bda918 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -9099,7 +9099,7 @@ void Tokenizer::simplifyDeclspec() void Tokenizer::simplifyAttribute() { 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")) { // prototype for constructor is: void func(void); if (tok->next()->link()->next()->str() == "void") // __attribute__((constructor)) void func() {} diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 9bd022fb0..87d857c6b 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -7079,6 +7079,11 @@ private: 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;")); + + // 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() {