Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up override warning for NDEBUG builds #351

Merged
merged 1 commit into from
Mar 9, 2017

Conversation

ChrisDodd
Copy link
Contributor

Somewhat messy way of avoiding compile time warnings for various build settings.

ir/visitor.h Outdated
#ifdef NDEBUG
#define override_unless_NDEBUG
#else
#define override_unless_NDEBUG override
Copy link
Contributor

Choose a reason for hiding this comment

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

How about the following pattern?

#ifdef NDEBUG
#define P4C_OVERRIDE_METHOD(...) __VA_ARGS__
#else
#define P4C_OVERRIDE_METHOD(...) __VA_ARGS__ = override
#endif

P4C_OVERRIDE_METHOD(void check_clone(const Visitor *));

And put the macro in a common utils.h file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The macro should probably have NDEBUG in its name somewhere, since its specific to compiling with NDEBUG to disable assertion checks. Or just take out the whole thing (make the check unconditional) and don't worry about the efficiency.

@ChrisDodd
Copy link
Contributor Author

Here's a cleaner way of getting the same effect without having to do all kinds of ifdef stuff.

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