aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2021-11-19 09:44:31 -0700
committerMartin Sebor <msebor@redhat.com>2021-11-19 09:47:57 -0700
commit16137fbb9256ef365dd498d39024eb33de1a4cd8 (patch)
tree27fd0ecb6e5cdf0b6d36a242539bfbbcd4a73df1 /gcc/cp
parentee448a523d377f9ed882dac806d2f5001bfa2432 (diff)
downloadgcc-16137fbb9256ef365dd498d39024eb33de1a4cd8.zip
gcc-16137fbb9256ef365dd498d39024eb33de1a4cd8.tar.gz
gcc-16137fbb9256ef365dd498d39024eb33de1a4cd8.tar.bz2
Restore ancient -Waddress for weak symbols [PR33925].
Resolves: PR c/33925 - gcc -Waddress lost some useful warnings PR c/102867 - -Waddress from macro expansion in readelf.c gcc/c-family/ChangeLog: PR c++/33925 PR c/102867 * c-common.c (decl_with_nonnull_addr_p): Call maybe_nonzero_address and improve handling tof defined symbols. gcc/c/ChangeLog: PR c++/33925 PR c/102867 * c-typeck.c (maybe_warn_for_null_address): Suppress warnings for code resulting from macro expansion. gcc/cp/ChangeLog: PR c++/33925 PR c/102867 * typeck.c (warn_for_null_address): Suppress warnings for code resulting from macro expansion. gcc/ChangeLog: PR c++/33925 PR c/102867 * doc/invoke.texi (-Waddress): Update. gcc/testsuite/ChangeLog: PR c++/33925 PR c/102867 * g++.dg/warn/Walways-true-2.C: Adjust to avoid a valid warning. * c-c++-common/Waddress-5.c: New test. * c-c++-common/Waddress-6.c: New test. * g++.dg/warn/Waddress-7.C: New test. * gcc.dg/Walways-true-2.c: Adjust to avoid a valid warning. * gcc.dg/weak/weak-3.c: Expect a warning.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/typeck.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index cb20329..58919aa 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -4594,9 +4594,11 @@ build_vec_cmp (tree_code code, tree type,
static void
warn_for_null_address (location_t location, tree op, tsubst_flags_t complain)
{
+ /* Prevent warnings issued for macro expansion. */
if (!warn_address
|| (complain & tf_warning) == 0
|| c_inhibit_evaluation_warnings != 0
+ || from_macro_expansion_at (location)
|| warning_suppressed_p (op, OPT_Waddress))
return;