Skip to content

Conversation

firewave
Copy link
Collaborator

No description provided.

@firewave
Copy link
Collaborator Author

This fixes the issue but I am not convinced this is the full fix. It seems there is a parseDefine() call which should not be happening since a macro is being re-defined.

@firewave
Copy link
Collaborator Author

This fixes the issue but I am not convinced this is the full fix. It seems there is a parseDefine() call which should not be happening since a macro is being re-defined.

The GNU compilers both only show a warning, so this fix should be fine.

a.cpp:2:9: warning: 'e' macro redefined [-Wmacro-redefined]
    2 | #define e
      |         ^
a.cpp:1:9: note: previous definition is here
    1 | #define e(...)__VA_OPT__()
      |         ^
a.cpp:2:9: warning: ‘e’ redefined
    2 | #define e
      |         ^
a.cpp:1:9: note: this is the location of the previous definition
    1 | #define e(...)__VA_OPT__()
      |         ^

@firewave firewave marked this pull request as ready for review August 30, 2025 19:04
{
const char code[] = "#define e(...)__VA_OPT__()\n"
"#define e\n";
(void)preprocess(code, simplecpp::DUI());
Copy link
Owner

Choose a reason for hiding this comment

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

I assume this has to be executed by some valgrind or sanitizer to detect the issue? i.e. if I just compile and run then this test does not ensure there is no leak?
It feels a bit misplaced somehow but maybe writing a separate test for it is overkill.. but well a comment would be nice?

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, obviously you need to run a leak checker.

I assumed the test name leak was enough. I can add a comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added some comments.

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