diff options
author | Joseph Myers <jsm28@gcc.gnu.org> | 2000-10-11 22:54:33 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2000-10-11 22:54:33 +0100 |
commit | bb58bec5cf51bf1cadf8e2462a61e965806f5c6e (patch) | |
tree | dbad9f895b3de111042fcb0bf7dd74fc9cdd6f68 /gcc/c-decl.c | |
parent | d0b43a40b5395e51595342a2b41dad2b44cf9a09 (diff) | |
download | gcc-bb58bec5cf51bf1cadf8e2462a61e965806f5c6e.zip gcc-bb58bec5cf51bf1cadf8e2462a61e965806f5c6e.tar.gz gcc-bb58bec5cf51bf1cadf8e2462a61e965806f5c6e.tar.bz2 |
c-typeck.c (check_modify_expr): New function.
* c-typeck.c (check_modify_expr): New function.
(build_modify_expr): Call it if warn_sequence_point.
* c-decl.c (warn_sequence_point): New variable.
(c_decode_option): Handle -Wsequence-point and
-Wno-sequence-point. Enable -Wsequence-point as part of -Wall.
* c-tree.h (warn_sequence_point): Declare.
* invoke.texi (-Wsequence-point): Document.
* toplev.c (documented_lang_options): Add -Wsequence-point and
-Wno-sequence-point.
Original work by Michael Meeks, 16 Jun 1998.
testsuite:
* gcc.dg/sequence-pt-1.c: New test.
From-SVN: r36840
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 39e0b4a..de45da7 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -497,6 +497,10 @@ int warn_float_equal = 0; int warn_multichar = 1; +/* Nonzero means warn about possible violations of sequence point rules. */ + +int warn_sequence_point; + /* The variant of the C language being processed. */ c_language_kind c_language = clk_c; @@ -765,6 +769,10 @@ c_decode_option (argc, argv) warn_return_type = 1; else if (!strcmp (p, "-Wno-return-type")) warn_return_type = 0; + else if (!strcmp (p, "-Wsequence-point")) + warn_sequence_point = 1; + else if (!strcmp (p, "-Wno-sequence-point")) + warn_sequence_point = 0; else if (!strcmp (p, "-Wcomment")) ; /* cpp handles this one. */ else if (!strcmp (p, "-Wno-comment")) @@ -826,6 +834,7 @@ c_decode_option (argc, argv) warn_format = 1; warn_char_subscripts = 1; warn_parentheses = 1; + warn_sequence_point = 1; warn_missing_braces = 1; /* We set this to 2 here, but 1 in -Wmain, so -ffreestanding can turn it off only if it's not explicit. */ |