Skip to content

Conversation

@firewave
Copy link
Collaborator

When Preprocessor was not set in Tokenizer it was bypassing some logic. We should not be doing that as it might cause tests to behave differently than production code.

The static Settings are dangerous as the objects are mutable. #4798 will start to address that.

TestType was also using the settings quite inconsistently. There's obviously some room for cleanups.

@firewave firewave changed the title some Tokenizer construction cleanups some Tokenizer construction and related other cleanups Feb 16, 2023
}

void checkNoMemset_(const char* file, int line, const char code[], const Settings &settings) {
void checkNoMemset_(const char* file, int line, const char code[], Settings &settings) {
Copy link
Owner

Choose a reason for hiding this comment

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

is settings changed? then I'd prefer to pass it by pointer.

Copy link
Collaborator Author

@firewave firewave Feb 24, 2023

Choose a reason for hiding this comment

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

That will be addressed by #4798 and subsequent changes.

And we should/need to get rid of pointers and not introduce new ones. They are essentially outlawed in C++20 with being replaced by various constructs and containers.

Copy link
Owner

Choose a reason for hiding this comment

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

Well it used to work with a const reference but now you add a preprocessor object then it does not work anymore. Is it required to add the preprocessor here?
I think it would be better if the Preprocessor argument would not be a Settings& settings. I would suggest it's changed to a pointer or something.

I find it dangerous when there is so much changes and there can be subtle issues here and there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, because the Preprocessor changes the Settings. That's why they cannot be shared between tests and we need to create a fresh one or properly reset them between tests. That will be changed in the referenced PR to make all objects const unless they need to be and then make them local ones that do not cause modifications to still into other tests.

It's "iterative" (actually the following PR is quite big but follow ups will be smaller).

I find it dangerous when there is so much changes and there can be subtle issues here and there.

Actually there's a lot of subtle issues which are obfuscated by all the pointers and non-const and such. Those will be all gone after the refactoring is done.

@danmar danmar merged commit 8f5f06a into danmar:main Mar 2, 2023
@firewave firewave deleted the tokenize branch March 2, 2023 20:51
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