aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
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/c
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/c')
-rw-r--r--gcc/c/c-typeck.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 782414f..50d7010 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -11588,7 +11588,10 @@ build_vec_cmp (tree_code code, tree type,
static void
maybe_warn_for_null_address (location_t loc, tree op, tree_code code)
{
- if (!warn_address || warning_suppressed_p (op, OPT_Waddress))
+ /* Prevent warnings issued for macro expansion. */
+ if (!warn_address
+ || warning_suppressed_p (op, OPT_Waddress)
+ || from_macro_expansion_at (loc))
return;
if (TREE_CODE (op) == NOP_EXPR)