Implement P1152R4: Deprecating some uses of volatile.
authorMarek Polacek <mpolacek@gcc.gnu.org>
Thu, 29 Aug 2019 03:11:50 +0000 (03:11 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Thu, 29 Aug 2019 03:11:50 +0000 (03:11 +0000)
commit8a902edbbdb53a00209e88b6182457941ff196a9
tree076d856b22bc8d9eda1ac6a617c05a42fe929c7e
parent737c5bac68732abe28a374658fe85396f92b9ef5
Implement P1152R4: Deprecating some uses of volatile.

PR c++/91361
* c-opts.c (c_common_post_options): Enable -Wvolatile by
default for C++2a, unless -Wno-deprecated.
* c.opt (Wvolatile): New warning.

* cp-gimplify.c (cp_fold): Set TREE_THIS_VOLATILE.
* decl.c (grokdeclarator): Warn about a volatile-qualified structured
binding and return type.
(grokparms): Warn about a volatile-qualified function parameter.
* expr.c (mark_use) <case MODIFY_EXPR>: Emit a -Wvolatile warning.
* typeck.c (cp_build_unary_op): Emit a -Wvolatile warning for pre and
post ++/-- on a volatile operand.
(genericize_compound_lvalue): Use a better location.  Don't lose
TREE_THIS_VOLATILE.
(cp_build_modify_expr): Emit a -Wvolatile warning for a compound
assignment whose LHS is volatile-qualified.  Build the assignment with
a more precise location.

* doc/invoke.texi: Document -Wvolatile.

* c-c++-common/Wbool-operation-1.c: Use -Wno-volatile in C++.
* c-c++-common/gomp/atomic-1.c: Likewise.
* c-c++-common/gomp/atomic-9.c: Likewise.
* c-c++-common/gomp/depend-iterator-1.c: Likewise.
* c-c++-common/gomp/loop-1.c: Adjust warning location for C++.
* c-c++-common/gomp/order-3.c: Likewise.
* c-c++-common/pr69733.c: Use -Wno-volatile in C++.
* c-c++-common/spec-barrier-2.c: Likewise.
* c-c++-common/tm/pr54893.c: Likewise.
* g++.dg/cpp0x/pr65327.C: Add dg-warning.
* g++.dg/cpp0x/rv-conv2.C: Likewise.
* g++.dg/cpp0x/rv1n.C: Likewise.
* g++.dg/cpp0x/rv1p.C: Likewise.
* g++.dg/cpp0x/rv2n.C: Likewise.
* g++.dg/cpp0x/rv2p.C: Likewise.
* g++.dg/cpp0x/rv3n.C: Likewise.
* g++.dg/cpp0x/rv3p.C: Likewise.
* g++.dg/cpp0x/rv4n.C: Likewise.
* g++.dg/cpp0x/rv4p.C: Likewise.
* g++.dg/cpp0x/rv5n.C: Likewise.
* g++.dg/cpp0x/rv5p.C: Likewise.
* g++.dg/cpp0x/rv6n.C: Likewise.
* g++.dg/cpp0x/rv6p.C: Likewise.
* g++.dg/cpp0x/rv7n.C: Likewise.
* g++.dg/cpp0x/rv7p.C: Likewise.
* g++.dg/cpp0x/rv8p.C: Likewise.
* g++.dg/cpp0x/trailing14.C: Use -Wno-volatile.
* g++.dg/cpp1y/new1.C: Add dg-warning.
* g++.dg/cpp2a/volatile1.C: New test.
* g++.dg/cpp2a/volatile2.C: New test.
* g++.dg/cpp2a/volatile3.C: New test.
* g++.dg/cpp2a/volatile4.C: New test.
* g++.dg/expr/bool3.C: Add dg-warning.
* g++.dg/expr/bool4.C: Likewise.
* g++.dg/expr/cond9.C: Likewise.
* g++.dg/ext/vector25.C: Likewise.
* g++.dg/gomp/depend-iterator-1.C: Use -Wno-volatile.
* g++.dg/inherit/covariant21.C: Add dg-warning.
* g++.dg/init/ref18.C: Likewise.
* g++.dg/ipa/pr63838.C: Likewise.
* g++.dg/overload/rvalue2.C: Likewise.
* g++.dg/parse/semicolon4.C: Likewise.
* g++.dg/warn/Wreturn-type-4.C: Likewise.
* g++.dg/warn/pr36069.C: Likewise.
* g++.old-deja/g++.mike/p9506.C: Likewise.
* g++.old-deja/g++.other/volatile1.C: Likewise.

From-SVN: r275022
57 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-opts.c
gcc/c-family/c.opt
gcc/cp/ChangeLog
gcc/cp/cp-gimplify.c
gcc/cp/decl.c
gcc/cp/expr.c
gcc/cp/typeck.c
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/Wbool-operation-1.c
gcc/testsuite/c-c++-common/gomp/atomic-1.c
gcc/testsuite/c-c++-common/gomp/atomic-9.c
gcc/testsuite/c-c++-common/gomp/depend-iterator-1.c
gcc/testsuite/c-c++-common/gomp/loop-1.c
gcc/testsuite/c-c++-common/gomp/order-3.c
gcc/testsuite/c-c++-common/pr69733.c
gcc/testsuite/c-c++-common/spec-barrier-2.c
gcc/testsuite/c-c++-common/tm/pr54893.c
gcc/testsuite/g++.dg/cpp0x/pr65327.C
gcc/testsuite/g++.dg/cpp0x/rv-conv2.C
gcc/testsuite/g++.dg/cpp0x/rv1n.C
gcc/testsuite/g++.dg/cpp0x/rv1p.C
gcc/testsuite/g++.dg/cpp0x/rv2n.C
gcc/testsuite/g++.dg/cpp0x/rv2p.C
gcc/testsuite/g++.dg/cpp0x/rv3n.C
gcc/testsuite/g++.dg/cpp0x/rv3p.C
gcc/testsuite/g++.dg/cpp0x/rv4n.C
gcc/testsuite/g++.dg/cpp0x/rv4p.C
gcc/testsuite/g++.dg/cpp0x/rv5n.C
gcc/testsuite/g++.dg/cpp0x/rv5p.C
gcc/testsuite/g++.dg/cpp0x/rv6n.C
gcc/testsuite/g++.dg/cpp0x/rv6p.C
gcc/testsuite/g++.dg/cpp0x/rv7n.C
gcc/testsuite/g++.dg/cpp0x/rv7p.C
gcc/testsuite/g++.dg/cpp0x/rv8p.C
gcc/testsuite/g++.dg/cpp0x/trailing14.C
gcc/testsuite/g++.dg/cpp1y/new1.C
gcc/testsuite/g++.dg/cpp2a/volatile1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/volatile2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/volatile3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/volatile4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/expr/bool3.C
gcc/testsuite/g++.dg/expr/bool4.C
gcc/testsuite/g++.dg/expr/cond9.C
gcc/testsuite/g++.dg/ext/vector25.C
gcc/testsuite/g++.dg/gomp/depend-iterator-1.C
gcc/testsuite/g++.dg/inherit/covariant21.C
gcc/testsuite/g++.dg/init/ref18.C
gcc/testsuite/g++.dg/ipa/pr63838.C
gcc/testsuite/g++.dg/overload/rvalue2.C
gcc/testsuite/g++.dg/parse/semicolon4.C
gcc/testsuite/g++.dg/warn/Wreturn-type-4.C
gcc/testsuite/g++.dg/warn/pr36069.C
gcc/testsuite/g++.old-deja/g++.mike/p9506.C
gcc/testsuite/g++.old-deja/g++.other/volatile1.C