From: Manuel López-Ibáñez Date: Tue, 26 Feb 2008 14:04:09 +0000 (+0000) Subject: re PR c/34351 (Please get us the "volatile register" warning back) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=16302dafcfbd3eb8dae336b721b72f426a64ebaa;p=gcc.git re PR c/34351 (Please get us the "volatile register" warning back) 2008-02-26 Manuel Lopez-Ibanez PR 34351 * doc/invoke.texi (-Wall): Add -Wvolatile-register-var. * c-opts.c (c_common_handle_option): Wall enables Wvolatile-register-var. * common.opt: Move Wvolatile-register-var to... * c.opt: ...here. testsuite/ * gcc.dg/pr34351.c: New. From-SVN: r132675 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fefe8c2f3dd..4d11666e715 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2008-02-26 Manuel Lopez-Ibanez + + PR 34351 + * doc/invoke.texi (-Wall): Add -Wvolatile-register-var. + * c-opts.c (c_common_handle_option): Wall enables + Wvolatile-register-var. + * common.opt: Move Wvolatile-register-var to... + * c.opt: ...here. + 2008-02-26 Manuel Lopez-Ibanez * common.opt (Wlarger-than=): New. diff --git a/gcc/c-opts.c b/gcc/c-opts.c index 4cb76872be3..1a59ac46964 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -407,6 +407,7 @@ c_common_handle_option (size_t scode, const char *arg, int value) if (warn_strict_overflow == -1) warn_strict_overflow = value; warn_array_bounds = value; + warn_volatile_register_var = value; /* Only warn about unknown pragmas that are not in system headers. */ diff --git a/gcc/c.opt b/gcc/c.opt index 72165b96660..d3f81b0e1c7 100644 --- a/gcc/c.opt +++ b/gcc/c.opt @@ -465,6 +465,10 @@ Wvla C ObjC C++ ObjC++ Var(warn_vla) Init(-1) Warning Warn if a variable length array is used +Wvolatile-register-var +C ObjC C++ ObjC++ Var(warn_volatile_register_var) Warning +Warn when a register variable is declared volatile + Wwrite-strings C ObjC C++ ObjC++ Var(warn_write_strings) Warning In C++, nonzero means warn about deprecated conversion from string literals to `char *'. In C, similar warning, except that the conversion is of course not deprecated by the ISO C standard. diff --git a/gcc/common.opt b/gcc/common.opt index 5c62510f700..48a1f80c3e1 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -232,10 +232,6 @@ Wunused-variable Common Var(warn_unused_variable) Warning Warn when a variable is unused -Wvolatile-register-var -Common Var(warn_register_var) Warning -Warn when a register variable is declared volatile - Wcoverage-mismatch Common RejectNegative Var(warn_coverage_mismatch) Warning Warn instead of error in case profiles in -fprofile-use do not match diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 6a80373e43d..7e444c0370c 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -2683,6 +2683,7 @@ Options} and @ref{Objective-C and Objective-C++ Dialect Options}. -Wunused-label @gol -Wunused-value @gol -Wunused-variable @gol +-Wvolatile-register-var @gol } Note that some warning flags are not implied by @option{-Wall}. Some of @@ -4017,7 +4018,8 @@ the variable length array. @opindex Wno-volatile-register-var Warn if a register variable is declared volatile. The volatile modifier does not inhibit all optimizations that may eliminate reads -and/or writes to register variables. +and/or writes to register variables. This warning is enabled by +@option{-Wall}. @item -Wdisabled-optimization @opindex Wdisabled-optimization diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8fb14f23f53..ee8eea17bc5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2008-02-26 Manuel Lopez-Ibanez + + * gcc.dg/pr34351.c: New. + 2008-02-26 Manuel Lopez-Ibanez * gcc.dg/Wlarger-than2.c: New. diff --git a/gcc/testsuite/gcc.dg/pr34351.c b/gcc/testsuite/gcc.dg/pr34351.c new file mode 100644 index 00000000000..90dcfa1e5f7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr34351.c @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +register int * volatile x asm ("r13"); /* { dg-warning "optimization may eliminate reads and/or writes to register variables" } */