-
Notifications
You must be signed in to change notification settings - Fork 606
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
Silence gcc new/delete warnings for texturesys #3944
Silence gcc new/delete warnings for texturesys #3944
Conversation
60ae11b
to
9dd8adc
Compare
src/libtexture/texturesys.cpp
Outdated
#pragma GCC diagnostic push | ||
#if __GNUC__ > 10 | ||
# pragma GCC diagnostic ignored "-Wmismatched-new-delete" | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have macros defined in platform.h for these things. In the parlance we use through the rest of the code base, this would be
OIIO_PRAGMA_WARNING_PUSH
#if OIIO_GNUC_VERSION > 100000
OIIO_GCC_ONLY_PRAGMA(diagnostic ignored "-Wmismatched-new-delete")
#endif
...
OIIO_PRAGMA_WARNING_POP
I admit that for this small example, this is not especially any more clear than the raw pragmas you used. But the point is that it'll always work properly, no future non-gcc compiler will complain about those GCC pragma (which I am kinda superstitious about, even though CI shows it appears to be fine on the compilers we test).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, I've updated the pull request to use the existing macros.
I also edited the comment as this now only applies to GCC (as your macros explicitly single out that compiler). Usually clang respects gcc pragmas, but I don't have a clang toolchain easily available, and I guess the existing CI builders haven't complained so far
Signed-off-by: Shootfast <[email protected]>
Signed-off-by: Larry Gritz <[email protected]>
I took the liberty of pushing a fix to the clang-format CI complaints. If this passes CI, I will merge. |
One day I will remember to run the clang-format pass first 😅 |
No prob. It was tricky in this case because I guess clang-format is ok with the One day I (or hopefully somebody else?) will figure out how to do a special GitHub action that will take a failed CI clang-format test and automatically turn it into an appended comment on the PR with the suggested diff of changes that can be merged in a single click. Actually, it appears there are a number of such implementations in the GitHub Action marketplace, the main task is probably to figure out which one suits our needs. |
…eFoundation#3944) Disable GCC warnings around mismatched new/delete for shared_texturesys creation Signed-off-by: Shootfast <[email protected]> Signed-off-by: Larry Gritz <[email protected]> Co-authored-by: Larry Gritz <[email protected]>
Description
Disable GCC warnings around mismatched new/delete for shared_texturesys creation
Tests
Checklist:
have previously submitted a Contributor License Agreement
(individual, and if there is any way my
employers might think my programming belongs to them, then also
corporate).
(adding new test cases if necessary).