diff options
author | Jason Merrill <jason@redhat.com> | 2022-12-01 22:58:28 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2022-12-20 21:01:44 -0500 |
commit | 302485a70a33f3a86e85ad9051de2b51c5dc0bc0 (patch) | |
tree | 534f842bc26f4d4d286508c401f22d56b97abdab /include | |
parent | a996888327c2248b59db7244333740c2b51578c9 (diff) | |
download | gcc-302485a70a33f3a86e85ad9051de2b51c5dc0bc0.zip gcc-302485a70a33f3a86e85ad9051de2b51c5dc0bc0.tar.gz gcc-302485a70a33f3a86e85ad9051de2b51c5dc0bc0.tar.bz2 |
c++: source position of lambda captures [PR84471]
If the DECL_VALUE_EXPR of a VAR_DECL has EXPR_LOCATION set, then any use of
that variable looks like it has that location, which leads to the debugger
jumping back and forth for both lambdas and structured bindings.
Rather than fix all the uses, it seems simplest to remove any EXPR_LOCATION
when setting DECL_VALUE_EXPR. So the cp/ hunks aren't necessary, but they
avoid the need to unshare to remove the location.
PR c++/84471
PR c++/107504
gcc/cp/ChangeLog:
* coroutines.cc (transform_local_var_uses): Don't
specify a location for DECL_VALUE_EXPR.
* decl.cc (cp_finish_decomp): Likewise.
gcc/ChangeLog:
* fold-const.cc (protected_set_expr_location_unshare): Not static.
* tree.h: Declare it.
* tree.cc (decl_value_expr_insert): Use it.
include/ChangeLog:
* ansidecl.h (ATTRIBUTE_WARN_UNUSED_RESULT): Add __.
gcc/testsuite/ChangeLog:
* g++.dg/tree-ssa/value-expr1.C: New test.
* g++.dg/tree-ssa/value-expr2.C: New test.
* g++.dg/analyzer/pr93212.C: Move warning.
Diffstat (limited to 'include')
-rw-r--r-- | include/ansidecl.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/ansidecl.h b/include/ansidecl.h index 056a03e..4da8069 100644 --- a/include/ansidecl.h +++ b/include/ansidecl.h @@ -279,7 +279,7 @@ So instead we use the macro below and test it against specific values. */ /* Attribute `warn_unused_result' was valid as of gcc 3.3. */ #ifndef ATTRIBUTE_WARN_UNUSED_RESULT # if GCC_VERSION >= 3003 -# define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result)) +# define ATTRIBUTE_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__)) # else # define ATTRIBUTE_WARN_UNUSED_RESULT # endif |