Skip to content

Conversation

@autoantwort
Copy link
Contributor

No description provided.

@firewave
Copy link
Collaborator

Thanks for your contribution.

Please avoid adding test-only code in the production code. See e04019c for an approach. If you inherit from ProjectConfiguration the added function could be moved into the test code and the additional constructor and moved implementation could me made protected.

tokenlist.createAst();
for (const Token *tok = tokenlist.front(); tok; tok = tok->next()) {
if (tok->str() == "(" && tok->astOperand1() && tok->astOperand2()) {
// TODO: this is wrong - it is Contains() not Equals()
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should have filed a ticket for this since fixing it is a behavior change. Are you able to do that or should I file one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could you do that? :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Will do later. I want to have a reproducer first.

@firewave firewave marked this pull request as draft December 16, 2025 20:44
@autoantwort
Copy link
Contributor Author

Please avoid adding test-only code in the production code. See e04019c for an approach. If you inherit from ProjectConfiguration the added function could be moved into the test code and the additional constructor and moved implementation could me made protected.

Currently ProjectConfiguration and ConditionalGroup are an implementation detail and defined in the cpp file. I would have to move the classes to the header. Then they become an public interface only because of test-only code.
My thought was that exposing a single test-only function is better than exposing two complete implementation details classes.

@firewave
Copy link
Collaborator

Currently ProjectConfiguration and ConditionalGroup are an implementation detail and defined in the cpp file.

Sorry that I missed that.

I would have to move the classes to the header. Then they become an public interface only because of test-only code.
My thought was that exposing a single test-only function is better than exposing two complete implementation details classes.

Let's get the CI to pass first and the other stuff addressed and then I will have another look. It won't be merged before we made the 2.19 release anyways.

@autoantwort autoantwort force-pushed the fix-14334 branch 7 times, most recently from a327364 to e674fb6 Compare December 17, 2025 17:57
@autoantwort autoantwort requested a review from firewave December 30, 2025 22:37
@autoantwort autoantwort marked this pull request as ready for review December 30, 2025 22:37
@autoantwort autoantwort force-pushed the fix-14334 branch 3 times, most recently from 0818e64 to f0810d5 Compare December 31, 2025 02:27
if (startsHere(i, "$(Configuration."))
{
initialized = true;
if (startsHere(i, "Contains("))
Copy link
Owner

Choose a reason for hiding this comment

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

is it possible to have spaces.. Contains ( ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Never have seen this, but it seems to be possible.

Copy link
Owner

Choose a reason for hiding this comment

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

I would assume that these expressions can be handwritten? So some spaces should be expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I already have added support here

@autoantwort autoantwort force-pushed the fix-14334 branch 3 times, most recently from c1c4c5e to 35be150 Compare January 2, 2026 16:29
@autoantwort autoantwort force-pushed the fix-14334 branch 3 times, most recently from bf81c63 to f9f9c64 Compare January 3, 2026 18:52
@autoantwort
Copy link
Contributor Author

The selfcheck failure seems like an cppcheck error:
With 4f9f852 I get the error

Run supprs="--suppress=unusedFunction:lib/errorlogger.h:196"
lib/importproject.cpp:1676:21: style: The function 'selectVsConfigurations' is never used. [unusedFunction]
void ImportProject::selectVsConfigurations(Platform::Type platform, const std::vector<std::string> &configurations)
                    ^
lib/importproject.cpp:1700:39: style: The function 'getVSConfigs' is never used. [unusedFunction]
std::list<std::string> ImportProject::getVSConfigs()
                                      ^

without I get

Run ./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x060000 -DQ_MOC_OUTPUT_REVISION=69 -DQT_CHARTS_LIB -DQT_MOC_HAS_STRINGDATA --enable=unusedFunction,information --exception-handling -rp=. --project=cmake.output.notest/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr
lib/importproject.cpp:1677:0: information: Unmatched suppression: unusedFunction [unmatchedSuppression]
void ImportProject::selectVsConfigurations(Platform::Type platform, const std::vector<std::string> &configurations)
^
lib/importproject.cpp:1702:0: information: Unmatched suppression: unusedFunction [unmatchedSuppression]
std::list<std::string> ImportProject::getVSConfigs()
^

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2026

@autoantwort
Copy link
Contributor Author

I only rebased with main

Copy link
Owner

@danmar danmar left a comment

Choose a reason for hiding this comment

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

Why don't you tokenize as before? That would get rid of a lot of the string handling. And it is more flexible it will allow spaces between tokens. As far as I see your code requires for instance that there is no spaces in $(Configuration) .

throw std::runtime_error("Expecting a start of a string!");
}
auto start = ++i;
while (i < expr.length() && expr[i] != '\'') ++i;
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
while (i < expr.length() && expr[i] != '\'') ++i;
i = expr.find('\'', i);

}
auto start = ++i;
while (i < expr.length() && expr[i] != '\'') ++i;
std::string string = expr.substr(start, i - start);
Copy link
Owner

Choose a reason for hiding this comment

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

I feel that the string can be created below after checking if i is valid.

@autoantwort
Copy link
Contributor Author

Why don't you tokenize as before? That would get rid of a lot of the string handling. And it is more flexible it will allow spaces between tokens. As far as I see your code requires for instance that there is no spaces in $(Configuration) .

Because I only know that it didn't worked. Does the tokenizer know how to tokenize in strings? Feel free do create a PR at my feature branch :)

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.

3 participants