File: symresolution-no-dangling.diff

package info (click to toggle)
systemtap 5.1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 47,964 kB
  • sloc: cpp: 80,838; ansic: 54,757; xml: 49,725; exp: 43,665; sh: 11,527; python: 5,003; perl: 2,252; tcl: 1,312; makefile: 1,006; javascript: 149; lisp: 105; awk: 101; asm: 91; java: 70; sed: 16
file content (41 lines) | stat: -rw-r--r-- 2,029 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
commit d11241bdd05bc4c745c8aef53a2725331e1a93b4
Author: Frank Ch. Eigler <fche@redhat.com>
Date:   Tue May 7 14:25:12 2024 -0400

    elaborate.cxx: gcc version compatibility hack
    
    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

diff --git a/elaborate.cxx b/elaborate.cxx
index 8bf9e6c06..88505559b 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -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
 }