]> sourceware.org Git - systemtap.git/commitdiff
elaborate.cxx: gcc version compatibility hack
authorFrank Ch. Eigler <fche@redhat.com>
Tue, 7 May 2024 18:25:12 +0000 (14:25 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Tue, 7 May 2024 18:25:12 +0000 (14:25 -0400)
Suppress -Wdangling-pointer for a construct that appears valid, but
one particular GCC snapshot version complains about.

In constructor ‘symresolution_info::symresolution_info(systemtap_session&, bool)’,
inlined from ‘int semantic_pass_symbols(systemtap_session&)’ at ../systemtap/elaborate.cxx:1872:28:
../systemtap/elaborate.cxx:2659:21: error: storing the address of local variable ‘sym’ in ‘*s.systemtap_session::symbol_resolver’ [-Werror=dangling-pointer=]
 2659 |   s.symbol_resolver = this; // save resolver for early PR25841 function resolution
      |   ~~~~~~~~~~~~~~~~~~^~~~~~
../systemtap/elaborate.cxx: In function ‘int semantic_pass_symbols(systemtap_session&)’:
../systemtap/elaborate.cxx:1872:22: note: ‘sym’ declared here
 1872 |   symresolution_info sym (s);
      |                      ^~~
../systemtap/elaborate.cxx:1870:43: note: ‘s’ declared here
 1870 | semantic_pass_symbols (systemtap_session& s)
      |                        ~~~~~~~~~~~~~~~~~~~^
cc1plus: all warnings being treated as errors

elaborate.cxx

index 8bf9e6c0619629efe18d471ca65bc3c0c0db8b90..88505559b82e2ec099e5202b05da3798f641ecde 100644 (file)
@@ -2655,8 +2655,13 @@ semantic_pass (systemtap_session& s)
 symresolution_info::symresolution_info (systemtap_session& s, bool omniscient_unmangled):
   session (s), unmangled_p(omniscient_unmangled), current_function (0), current_probe (0)
 {
+  #pragma GCC diagnostic push
+  // c10s early snapshot GCC complains about this construct, which is
+  // made safe via our dtor usage
+  #pragma GCC diagnostic ignored "-Wdangling-pointer"
   saved_session_symbol_resolver = s.symbol_resolver;
   s.symbol_resolver = this; // save resolver for early PR25841 function resolution
+  #pragma GCC diagnostic pop
 }
 
 
This page took 0.038422 seconds and 5 git commands to generate.