./: * 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
+2009-06-19 Ian Lance Taylor <iant@google.com>
+
+ * 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.
+
2009-06-19 Ian Lance Taylor <iant@google.com>
* dse.c (struct store_info): Rename bitmap field to bmap. Change
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. */
size_t size, bool is_string ATTRIBUTE_UNUSED)
{
unsigned order;
- static const char emptyBytes[256];
+ static const char emptyBytes[256] = { 0 };
if (size < NUM_SIZE_LOOKUP)
order = size_lookup[size];
/* Output sdb-format symbol table information from GNU compiler.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
+ 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GCC.
#else /* SDB_DEBUGGING_INFO */
/* This should never be used, but its address is needed for comparisons. */
-const struct gcc_debug_hooks sdb_debug_hooks;
+const struct gcc_debug_hooks sdb_debug_hooks =
+{
+ 0, /* init */
+ 0, /* finish */
+ 0, /* define */
+ 0, /* undef */
+ 0, /* start_source_file */
+ 0, /* end_source_file */
+ 0, /* begin_block */
+ 0, /* end_block */
+ 0, /* ignore_block */
+ 0, /* source_line */
+ 0, /* begin_prologue */
+ 0, /* end_prologue */
+ 0, /* end_epilogue */
+ 0, /* begin_function */
+ 0, /* end_function */
+ 0, /* function_decl */
+ 0, /* global_decl */
+ 0, /* type_decl */
+ 0, /* imported_module_or_decl */
+ 0, /* deferred_inline_function */
+ 0, /* outlining_inline_function */
+ 0, /* label */
+ 0, /* handle_pch */
+ 0, /* var_location */
+ 0, /* switch_text_section */
+ 0, /* set_name */
+ 0 /* start_end_main_source_file */
+};
+
#endif /* SDB_DEBUGGING_INFO */
+2009-06-19 Ian Lance Taylor <iant@google.com>
+
+ * gcc.dg/Wcxx-compat-17.c: New testcase.
+
2009-06-19 Ian Lance Taylor <iant@google.com>
* gcc.dg/Wcxx-compat-15.c: New testcase.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Wc++-compat" } */
+const int v1; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+const char * const v2; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+struct s { int f1; int f2; };
+const struct s v3; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+const int v4 = 1;
+const char * const v5 = 0;
+const struct s v6 = { 0, 0 };
+const struct s v7 = { 0 };
+void
+f()
+{
+ const int v11; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ const char * const v12; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ const struct s v13; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ const int v14 = 1;
+ const char * const v15 = 0;
+ const struct s v16 = { 0, 0 };
+ const struct s v17 = { 0 };
+}