re PR c++/18150 (Should enable -Wsequence-point for C++)
authorDirk Mueller <dmueller@suse.com>
Tue, 7 Feb 2006 21:47:55 +0000 (21:47 +0000)
committerDirk Mueller <mueller@gcc.gnu.org>
Tue, 7 Feb 2006 21:47:55 +0000 (21:47 +0000)
2006-02-07  Dirk Mueller  <dmueller@suse.com>

       PR c++/18150
       * doc/invoke.texi (-Wsequence-point): Update documentation
       that -Wsequence-point is implemented for C++ as well.

From-SVN: r110719

gcc/ChangeLog
gcc/doc/invoke.texi

index da642fadff14d958084d257bb801217eec0035ad..6149afe467b0344bbe1353037f4293c78b1423d4 100644 (file)
@@ -1,3 +1,9 @@
+2006-02-07  Dirk Mueller  <dmueller@suse.com>
+
+       PR c++/18150
+       * doc/invoke.texi (-Wsequence-point): Update documentation
+       that -Wsequence-point is implemented for C++ as well.
+
 2006-02-07  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        * config/sol26.h (CPP_SUBTARGET_SPEC): Accept -pthread.
index d68e94d31e6d4984292d8bb6d6ddc0cad989cf43..798d4e79cbb2aef6936b88a31073d24ce1190c43 100644 (file)
@@ -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.
-
-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
+of sequence point rules in the C and C++ standards.
+
+The C and C++ standards 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,11 +2547,11 @@ 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
-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
-stored.''.  If a program breaks these rules, the results on any
+have undefined behavior; the C and C++ standards specify 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 stored.''.  If a program breaks these rules, the results on any
 particular implementation are entirely unpredictable.
 
 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
@@ -2560,16 +2560,13 @@ diagnosed by this option, and it may give an occasional false positive
 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