-
Notifications
You must be signed in to change notification settings - Fork 23
fix false warning by gcc version 12 only #209
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
base: master
Are you sure you want to change the base?
Conversation
70e6d2c to
c5c04bb
Compare
src/ioc/reftrackioc.cpp
Outdated
| // No locking. assume only interactive iocsh use | ||
| static epics::RefSnapshot savedSnap; | ||
|
|
||
| #if __GNUC__ == 12 |
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.
I am not enthusiastic about filling up source files with blocks like this to silence specific false positive warnings, especially those occurring with only a single compiler series.
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.
My preferred way would have been to put -Wno-dangling-pointer into the Makefile, but I don't know how to do this for gcc 12 only (much older gcc versions as used by VxWorks would not understand that option).
So I see 4 other options:
- We declare gcc 12 unsuitable for EPICS.
- We never check for dangling pointers.
- We give up on having a warning-free code base.
- You modify
refsave()so that it does not use a local variable. Maybe a global one?
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.
I found a way to do it in the Makefile instead of the code. New approach pushed.
That one disables the warning for the whole file, not only for the one function.
|
❌ Build pvAccessCPP 1.0.121 failed (commit 8fe2d80cc2 by @dirk-zimoch) |
|
❌ Build pvAccessCPP 1.0.122 failed (commit bee4d8076a by @dirk-zimoch) |
c5c04bb to
79d3062
Compare
|
❌ Build pvAccessCPP 1.0.128 failed (commit b1891f0286 by @dirk-zimoch) |
Fix false (?) warning in
pvAccessCPP/src/ioc/reftrackioc.cpp
Lines 51 to 59 in 1492b3d
It seems gcc 12 does not like the fact that
savedSnap.swap(snap)references a local variable (snap).Other c++11 capable gcc versions (tested 8 ... 14) do not show a warning here. Neither does clang or MSVC.