diff options
author | Martin Liska <mliska@suse.cz> | 2022-08-16 13:28:03 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-08-16 13:28:03 +0200 |
commit | a2c4ae994a5e5f213773b95d15f95a3cdb1f1f7d (patch) | |
tree | 237de985e6105a8d1278019437f9269a77f4442f /gcc/cp | |
parent | 091222fb0aaa09dcf90f2bc747f1d8a6a8ef1575 (diff) | |
parent | 6e790ca4615443fa395ac5cdba1ab6c87810985c (diff) | |
download | gcc-a2c4ae994a5e5f213773b95d15f95a3cdb1f1f7d.zip gcc-a2c4ae994a5e5f213773b95d15f95a3cdb1f1f7d.tar.gz gcc-a2c4ae994a5e5f213773b95d15f95a3cdb1f1f7d.tar.bz2 |
Merge branch 'master' into devel/sphinx
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/expr.cc | 4 | ||||
-rw-r--r-- | gcc/cp/typeck.cc | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/gcc/cp/expr.cc b/gcc/cp/expr.cc index 56fc11f..f3e155b 100644 --- a/gcc/cp/expr.cc +++ b/gcc/cp/expr.cc @@ -220,7 +220,7 @@ mark_use (tree expr, bool rvalue_p, bool read_p, case MODIFY_EXPR: { tree lhs = TREE_OPERAND (expr, 0); - /* [expr.ass] "A simple assignment whose left operand is of + /* [expr.ass] "An assignment whose left operand is of a volatile-qualified type is deprecated unless the assignment is either a discarded-value expression or appears in an unevaluated context." */ @@ -230,7 +230,7 @@ mark_use (tree expr, bool rvalue_p, bool read_p, && !TREE_THIS_VOLATILE (expr)) { if (warning_at (location_of (expr), OPT_Wvolatile, - "using value of simple assignment with " + "using value of assignment with " "%<volatile%>-qualified left operand is " "deprecated")) /* Make sure not to warn about this assignment again. */ diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc index 15548e5..6b38c8c 100644 --- a/gcc/cp/typeck.cc +++ b/gcc/cp/typeck.cc @@ -9136,10 +9136,14 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode, /* An expression of the form E1 op= E2. [expr.ass] says: "Such expressions are deprecated if E1 has volatile-qualified - type." We warn here rather than in cp_genericize_r because + type and op is not one of the bitwise operators |, &, ^." + We warn here rather than in cp_genericize_r because for compound assignments we are supposed to warn even if the assignment is a discarded-value expression. */ - if (TREE_THIS_VOLATILE (lhs) || CP_TYPE_VOLATILE_P (lhstype)) + if (modifycode != BIT_AND_EXPR + && modifycode != BIT_IOR_EXPR + && modifycode != BIT_XOR_EXPR + && (TREE_THIS_VOLATILE (lhs) || CP_TYPE_VOLATILE_P (lhstype))) warning_at (loc, OPT_Wvolatile, "compound assignment with %<volatile%>-qualified left " "operand is deprecated"); |