Skip to content

simplecpp 1.9.0 - #8775

Draft
glankk wants to merge 5 commits into
cppcheck-opensource:mainfrom
glankk:simplecpp-1.9.0
Draft

simplecpp 1.9.0#8775
glankk wants to merge 5 commits into
cppcheck-opensource:mainfrom
glankk:simplecpp-1.9.0

Conversation

@glankk

@glankk glankk commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@glankk
glankk marked this pull request as ready for review August 5, 2026 05:18
@glankk
glankk marked this pull request as draft August 5, 2026 05:19
Comment thread test/testpreprocessor.cpp
simplecpp::OutputList outputList;
simplecpp::TokenList tokens(code,files,"test.c",&outputList);
simplecpp::DUI dui;
simplecpp::TokenList tokens(code,files,"test.c",dui,&outputList);

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.

Let's just use {} for empty DUIs.

Comment thread lib/cppcheck.cpp
const auto f = [&file, data, size, this](std::vector<std::string>& files, simplecpp::OutputList* outputList) {
simplecpp::DUI dui;
dui.std = mSettings.standards.getStdForLanguage(file.lang());
return simplecpp::TokenList{{data, size}, files, file.spath(), dui, outputList};

@ludviggunne ludviggunne Aug 5, 2026

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.

Maybe it would be good with some preprocessor tests for this. I.e. skip the trailing newline and run as both C and C++. And preferably something that tests both checkBuffer and checkFile, not sure in which scenarios these are called.

*/
Macro(const std::string &name, const std::string &value, std::vector<std::string> &f) : nameTokDef(nullptr), files(f), tokenListDefine(f), valueDefinedInCode_(false) {
const std::string def(name + ' ' + value);
const std::string def(name + ' ' + value + '\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.

Is there an issue that can be recreated with simplecpp only that exposes this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

There aren't really any symptoms because the Macro constructor just discards any warnings or errors from the tokenizer, but I think it's good to add this to prevent any future problems.

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