[PATCH] Document that -Wsequence-point works for C++ as well

Dirk Mueller dmueller@suse.de
Tue Feb 7 21:17:00 GMT 2006


Hi, 

okay for 4.1 and trunk?


2006-02-07  Dirk Mueller  <dmueller@suse.com>

        PR c++/18150
        * invoke.texi (-Wsequence-point): Document that the
        warning is implemented for C++ as well.

--- doc/invoke.texi
+++ doc/invoke.texi
@@ -2526,14 +2526,14 @@ This warning is enabled by @option{-Wall
 @item -Wsequence-point
 @opindex Wsequence-point
 Warn about code that may have undefined semantics because of violations
-of sequence point rules in the C standard.
+of sequence point rules in the C/C++ standard.
 
-The C standard defines the order in which expressions in a C program are
-evaluated in terms of @dfn{sequence points}, which represent a partial
-ordering between the execution of parts of the program: those executed
-before the sequence point, and those executed after it.  These occur
-after the evaluation of a full expression (one which is not part of a
-larger expression), after the evaluation of the first operand of a
+The C/C++ standard defines the order in which expressions in a C/C++ 
+program are evaluated in terms of @dfn{sequence points}, which represent
+a partial ordering between the execution of parts of the program: those
+executed before the sequence point, and those executed after it.  These
+occur after the evaluation of a full expression (one which is not part
+of a larger expression), after the evaluation of the first operand of a
 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
 function is called (but after the evaluation of its arguments and the
 expression denoting the called function), and in certain other places.
@@ -2547,7 +2547,7 @@ ruled that function calls do not overlap
 
 It is not specified when between sequence points modifications to the
 values of objects take effect.  Programs whose behavior depends on this
-have undefined behavior; the C standard specifies that ``Between the
+have undefined behavior; the C/C++ standard specifies that ``Between the
 previous and next sequence point an object shall have its stored value
 modified at most once by the evaluation of an expression.  Furthermore,
 the prior value shall be read only to determine the value to be
@@ -2560,16 +2560,13 @@ diagnosed by this option, and it may giv
 result, but in general it has been found fairly effective at detecting
 this sort of problem in programs.
 
-The present implementation of this option only works for C programs.  A
-future implementation may also work for C++ programs.
-
-The C standard is worded confusingly, therefore there is some debate
+The standard is worded confusingly, therefore there is some debate
 over the precise meaning of the sequence point rules in subtle cases.
 Links to discussions of the problem, including proposed formal
 definitions, may be found on the GCC readings page, at
 @w{@uref{http://gcc.gnu.org/readings.html}}.
 
-This warning is enabled by @option{-Wall}.
+This warning is enabled by @option{-Wall} for C and C++.
 
 @item -Wreturn-type
 @opindex Wreturn-type



More information about the Gcc-patches mailing list