Skip to content

Fix #14604 & #10343: Implicit return type in typedefs#8457

Open
ludviggunne wants to merge 3 commits intocppcheck-opensource:mainfrom
ludviggunne:14604-10343
Open

Fix #14604 & #10343: Implicit return type in typedefs#8457
ludviggunne wants to merge 3 commits intocppcheck-opensource:mainfrom
ludviggunne:14604-10343

Conversation

@ludviggunne
Copy link
Copy Markdown
Collaborator

No description provided.

@sonarqubecloud
Copy link
Copy Markdown

Comment thread lib/tokenize.cpp
if (tok->str() == "typedef") {
if (Token::simpleMatch(tok, "typedef ( *") && Token::simpleMatch(tok->linkAt(1), ") ("))
// Implicit return type
tok->insertToken("int");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensure that Token::isImplicitInt will be true

ASSERT_EQUALS(" <typedef-info>\n"
" <info name=\"pfi\" file=\"file.c\" line=\"1\" column=\"1\" used=\"0\" isFunctionPointer=\"1\">\n"
" <token line=\"1\" column=\"1\" str=\"typedef\"/>\n"
" <token line=\"1\" column=\"0\" str=\"int\"/>\n"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to say that this int is implicit somehow. I suggest adding an isImplicitInt attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants