@@ -263,6 +263,7 @@ class TestTokenizer : public TestFixture {
263263 TEST_CASE (removeattribute);
264264 TEST_CASE (functionAttributeBefore1);
265265 TEST_CASE (functionAttributeBefore2);
266+ TEST_CASE (functionAttributeBefore3);
266267 TEST_CASE (functionAttributeAfter);
267268 TEST_CASE (functionAttributeListBefore);
268269 TEST_CASE (functionAttributeListAfter);
@@ -3653,6 +3654,22 @@ class TestTokenizer : public TestFixture {
36533654 ASSERT (VAS_Fail && VAS_Fail->isAttributeNoreturn ());
36543655 }
36553656
3657+ void functionAttributeBefore3 () { // #10978
3658+ const char code[] = " void __attribute__((__noreturn__)) (*func_notret)(void);" ;
3659+ const char expected[] = " void ( * func_notret ) ( ) ;" ;
3660+
3661+ errout.str (" " );
3662+
3663+ // tokenize..
3664+ Tokenizer tokenizer (&settings0, this );
3665+ std::istringstream istr (code);
3666+ ASSERT (tokenizer.tokenize (istr, " test.cpp" ));
3667+ ASSERT_EQUALS (expected, tokenizer.tokens ()->stringifyList (nullptr , false ));
3668+
3669+ const Token* func_notret = Token::findsimplematch (tokenizer.tokens (), " func_notret" );
3670+ ASSERT (func_notret && func_notret->isAttributeNoreturn ());
3671+ }
3672+
36563673 void functionAttributeAfter () {
36573674 const char code[] = " void func1() __attribute__((pure)) __attribute__((nothrow)) __attribute__((const));\n "
36583675 " void func2() __attribute__((__pure__)) __attribute__((__nothrow__)) __attribute__((__const__));\n "
0 commit comments