Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, every test run using
make
(for example:make testall
) causes two compilation warnings. These occur due to the redefinition of the assert macro. On my machine (Mac M1), these warnings look something like this:Since these warnings do not indicate anything about students' code, I suggest that we silence these so as not to confuse students. This can be done by using the
#pragma
directive, as implemented in this PR.Here is a short description of each of the
#pragma
directives used in this PR:#pragma clang diagnostic push
: This directive saves the current state of all diagnostic settings. It's used to create a stack of diagnostic states so that temporary changes can be made to the diagnostic settings and then revert back to the previous state.#pragma clang diagnostic ignored "-Wmacro-redefined"
: This directive tells the Clang compiler to ignore the specific warning identified by -Wmacro-redefined. This is exactly what is triggered by the assert redefinition, so we want to silence this.#pragma clang diagnostic pop
: After the block of code where the redefinition warning is suppressed, this directive restores the previous state of the diagnostic settings that were saved by#pragma clang diagnostic push
. This ensures that any changes to the diagnostic settings are only temporary and do not affect the rest of the code.