public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] [c++] suppress redundant null-addr warn in pfn from pmfn
@ 2023-02-23 13:56 Alexandre Oliva
0 siblings, 0 replies; 5+ messages in thread
From: Alexandre Oliva @ 2023-02-23 13:56 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:40750f7c4cc2693bdb15e924d9edfa2ed230b996
commit 40750f7c4cc2693bdb15e924d9edfa2ed230b996
Author: Alexandre Oliva <oliva@adacore.com>
Date: Thu Feb 23 10:30:35 2023 -0300
[c++] suppress redundant null-addr warn in pfn from pmfn
When TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_delta, when
we warn about comparing a pointer-to-member-function with NULL, we
also warn about comparing the pointer-to-function extracted from it
with NULL, which is redundant. Suppress the redundant warning.
for gcc/cp/ChangeLog
* typeck.cc (cp_build_binary_op): Suppress redundant warning
for pfn null test in pmfn test with vbit-in-delta.
Diff:
---
gcc/cp/typeck.cc | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
index 4afb5e4f0d4..d5a3e501d8e 100644
--- a/gcc/cp/typeck.cc
+++ b/gcc/cp/typeck.cc
@@ -5780,11 +5780,18 @@ cp_build_binary_op (const op_location_t &location,
pfn0 = pfn_from_ptrmemfunc (op0);
delta0 = delta_from_ptrmemfunc (op0);
- e1 = cp_build_binary_op (location,
- EQ_EXPR,
- pfn0,
- build_zero_cst (TREE_TYPE (pfn0)),
- complain);
+ {
+ /* If we will warn below about a null-address compare
+ involving the orig_op0 ptrmemfunc, we'd likely also
+ warn about the pfn0's null-address compare, and
+ that would be redundant, so suppress it. */
+ warning_sentinel ws (warn_address);
+ e1 = cp_build_binary_op (location,
+ EQ_EXPR,
+ pfn0,
+ build_zero_cst (TREE_TYPE (pfn0)),
+ complain);
+ }
e2 = cp_build_binary_op (location,
BIT_AND_EXPR,
delta0,
^ permalink raw reply [flat|nested] 5+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] [c++] suppress redundant null-addr warn in pfn from pmfn
@ 2023-02-23 14:02 Alexandre Oliva
0 siblings, 0 replies; 5+ messages in thread
From: Alexandre Oliva @ 2023-02-23 14:02 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:df2a5fb13e68e7302fe591c778b7ecbed69dc717
commit df2a5fb13e68e7302fe591c778b7ecbed69dc717
Author: Alexandre Oliva <oliva@adacore.com>
Date: Thu Feb 23 11:01:14 2023 -0300
[c++] suppress redundant null-addr warn in pfn from pmfn
When TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_delta, when
we warn about comparing a pointer-to-member-function with NULL, we
also warn about comparing the pointer-to-function extracted from it
with NULL, which is redundant. Suppress the redundant warning.
for gcc/cp/ChangeLog
* typeck.cc (cp_build_binary_op): Suppress redundant warning
for pfn null test in pmfn test with vbit-in-delta.
Diff:
---
gcc/cp/typeck.cc | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
index 4afb5e4f0d4..d5a3e501d8e 100644
--- a/gcc/cp/typeck.cc
+++ b/gcc/cp/typeck.cc
@@ -5780,11 +5780,18 @@ cp_build_binary_op (const op_location_t &location,
pfn0 = pfn_from_ptrmemfunc (op0);
delta0 = delta_from_ptrmemfunc (op0);
- e1 = cp_build_binary_op (location,
- EQ_EXPR,
- pfn0,
- build_zero_cst (TREE_TYPE (pfn0)),
- complain);
+ {
+ /* If we will warn below about a null-address compare
+ involving the orig_op0 ptrmemfunc, we'd likely also
+ warn about the pfn0's null-address compare, and
+ that would be redundant, so suppress it. */
+ warning_sentinel ws (warn_address);
+ e1 = cp_build_binary_op (location,
+ EQ_EXPR,
+ pfn0,
+ build_zero_cst (TREE_TYPE (pfn0)),
+ complain);
+ }
e2 = cp_build_binary_op (location,
BIT_AND_EXPR,
delta0,
^ permalink raw reply [flat|nested] 5+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] [c++] suppress redundant null-addr warn in pfn from pmfn
@ 2023-02-23 13:48 Alexandre Oliva
0 siblings, 0 replies; 5+ messages in thread
From: Alexandre Oliva @ 2023-02-23 13:48 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:02a8cd676d3f6b82842092a18a696709ac3c4b6d
commit 02a8cd676d3f6b82842092a18a696709ac3c4b6d
Author: Alexandre Oliva <oliva@adacore.com>
Date: Thu Feb 23 10:30:35 2023 -0300
[c++] suppress redundant null-addr warn in pfn from pmfn
When TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_delta, when
we warn about comparing a pointer-to-member-function with NULL, we
also warn about comparing the pointer-to-function extracted from it
with NULL, which is redundant. Suppress the redundant warning.
for gcc/cp/ChangeLog
* typeck.cc (cp_build_binary_op): Suppress redundant warning
for pfn null test in pmfn test with vbit-in-delta.
Diff:
---
gcc/cp/typeck.cc | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
index 4afb5e4f0d4..d5a3e501d8e 100644
--- a/gcc/cp/typeck.cc
+++ b/gcc/cp/typeck.cc
@@ -5780,11 +5780,18 @@ cp_build_binary_op (const op_location_t &location,
pfn0 = pfn_from_ptrmemfunc (op0);
delta0 = delta_from_ptrmemfunc (op0);
- e1 = cp_build_binary_op (location,
- EQ_EXPR,
- pfn0,
- build_zero_cst (TREE_TYPE (pfn0)),
- complain);
+ {
+ /* If we will warn below about a null-address compare
+ involving the orig_op0 ptrmemfunc, we'd likely also
+ warn about the pfn0's null-address compare, and
+ that would be redundant, so suppress it. */
+ warning_sentinel ws (warn_address);
+ e1 = cp_build_binary_op (location,
+ EQ_EXPR,
+ pfn0,
+ build_zero_cst (TREE_TYPE (pfn0)),
+ complain);
+ }
e2 = cp_build_binary_op (location,
BIT_AND_EXPR,
delta0,
^ permalink raw reply [flat|nested] 5+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] [c++] suppress redundant null-addr warn in pfn from pmfn
@ 2023-02-23 13:26 Alexandre Oliva
0 siblings, 0 replies; 5+ messages in thread
From: Alexandre Oliva @ 2023-02-23 13:26 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:1fba9cea22261af307613acb804513b7a807b8b4
commit 1fba9cea22261af307613acb804513b7a807b8b4
Author: Alexandre Oliva <oliva@adacore.com>
Date: Wed Feb 22 12:33:21 2023 -0300
[c++] suppress redundant null-addr warn in pfn from pmfn
When TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_delta, when
we warn about comparing a pointer-to-member-function with NULL, we
also warn about comparing the pointer-to-function extracted from it
with NULL, which is redundant. Suppress the redundant warning.
for gcc/cp/ChangeLog
* typeck.cc (cp_build_binary_op): Suppress redundant warning
for pfn null test in pmfn test with vbit-in-delta.
Diff:
---
gcc/cp/typeck.cc | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
index 4afb5e4f0d4..d5a3e501d8e 100644
--- a/gcc/cp/typeck.cc
+++ b/gcc/cp/typeck.cc
@@ -5780,11 +5780,18 @@ cp_build_binary_op (const op_location_t &location,
pfn0 = pfn_from_ptrmemfunc (op0);
delta0 = delta_from_ptrmemfunc (op0);
- e1 = cp_build_binary_op (location,
- EQ_EXPR,
- pfn0,
- build_zero_cst (TREE_TYPE (pfn0)),
- complain);
+ {
+ /* If we will warn below about a null-address compare
+ involving the orig_op0 ptrmemfunc, we'd likely also
+ warn about the pfn0's null-address compare, and
+ that would be redundant, so suppress it. */
+ warning_sentinel ws (warn_address);
+ e1 = cp_build_binary_op (location,
+ EQ_EXPR,
+ pfn0,
+ build_zero_cst (TREE_TYPE (pfn0)),
+ complain);
+ }
e2 = cp_build_binary_op (location,
BIT_AND_EXPR,
delta0,
^ permalink raw reply [flat|nested] 5+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] [c++] suppress redundant null-addr warn in pfn from pmfn
@ 2023-02-22 17:23 Alexandre Oliva
0 siblings, 0 replies; 5+ messages in thread
From: Alexandre Oliva @ 2023-02-22 17:23 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:f62e89fd7a4b182eb554e05d17ad558426d399b1
commit f62e89fd7a4b182eb554e05d17ad558426d399b1
Author: Alexandre Oliva <oliva@adacore.com>
Date: Wed Feb 22 12:33:21 2023 -0300
[c++] suppress redundant null-addr warn in pfn from pmfn
When TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_delta, when
we warn about comparing a pointer-to-member-function with NULL, we
also warn about comparing the pointer-to-function extracted from it
with NULL, which is redundant. Suppress the redundant warning.
for gcc/cp/ChangeLog
* typeck.cc (cp_build_binary_op): Suppress redundant warning
for pfn null test in pmfn test with vbit-in-delta.
Diff:
---
gcc/cp/typeck.cc | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
index 4afb5e4f0d4..d5a3e501d8e 100644
--- a/gcc/cp/typeck.cc
+++ b/gcc/cp/typeck.cc
@@ -5780,11 +5780,18 @@ cp_build_binary_op (const op_location_t &location,
pfn0 = pfn_from_ptrmemfunc (op0);
delta0 = delta_from_ptrmemfunc (op0);
- e1 = cp_build_binary_op (location,
- EQ_EXPR,
- pfn0,
- build_zero_cst (TREE_TYPE (pfn0)),
- complain);
+ {
+ /* If we will warn below about a null-address compare
+ involving the orig_op0 ptrmemfunc, we'd likely also
+ warn about the pfn0's null-address compare, and
+ that would be redundant, so suppress it. */
+ warning_sentinel ws (warn_address);
+ e1 = cp_build_binary_op (location,
+ EQ_EXPR,
+ pfn0,
+ build_zero_cst (TREE_TYPE (pfn0)),
+ complain);
+ }
e2 = cp_build_binary_op (location,
BIT_AND_EXPR,
delta0,
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-02-23 14:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-23 13:56 [gcc(refs/users/aoliva/heads/testme)] [c++] suppress redundant null-addr warn in pfn from pmfn Alexandre Oliva
-- strict thread matches above, loose matches on Subject: below --
2023-02-23 14:02 Alexandre Oliva
2023-02-23 13:48 Alexandre Oliva
2023-02-23 13:26 Alexandre Oliva
2023-02-22 17:23 Alexandre Oliva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).