fix false warning by gcc version 12 only#209
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.
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.
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.
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.