diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-19 15:32:43 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-19 15:32:43 +0000 |
commit | 1a7c0ccb66f80bda54058561162b5446b9d9d1c9 (patch) | |
tree | fe9acae7789cd322367a02a4039509a1a001b489 /gcc/c-decl.c | |
parent | 843bd2fa78007c193692f6382edf3b6b5c2d3a62 (diff) | |
download | gcc-1a7c0ccb66f80bda54058561162b5446b9d9d1c9.tar.gz |
./:
* ggc-page.c (ggc_pch_write_object): Initialize emptyBytes.
* sdbout.c (sdb_debug_hooks): Initialize non-SDB_DEBUGGING_INFO
version.
* c-decl.c (finish_decl): If -Wc++-compat, warn about
uninitialized const.
testsuite/:
* gcc.dg/Wcxx-compat-17.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148710 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 57cf389dc73..8234e0124ea 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -4352,6 +4352,14 @@ finish_decl (tree decl, location_t init_loc, tree init, push_cleanup (decl, cleanup, false); } } + + if (warn_cxx_compat + && TREE_CODE (decl) == VAR_DECL + && TREE_READONLY (decl) + && !DECL_EXTERNAL (decl) + && DECL_INITIAL (decl) == NULL_TREE) + warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wc___compat, + "uninitialized const %qD is invalid in C++", decl); } /* Given a parsed parameter declaration, decode it into a PARM_DECL. */ |