aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2009-06-19 15:32:43 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2009-06-19 15:32:43 +0000
commit642324bb16ffe88f0aa81c4ced9bdc1ba63471ab (patch)
treefe9acae7789cd322367a02a4039509a1a001b489 /gcc/c-decl.c
parentdc491a250a946a50bdea3813e9f1f67d368e348b (diff)
downloadgcc-642324bb16ffe88f0aa81c4ced9bdc1ba63471ab.zip
gcc-642324bb16ffe88f0aa81c4ced9bdc1ba63471ab.tar.gz
gcc-642324bb16ffe88f0aa81c4ced9bdc1ba63471ab.tar.bz2
ggc-page.c (ggc_pch_write_object): Initialize emptyBytes.
./: * 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. From-SVN: r148710
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 57cf389..8234e01 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. */