Commit 642324bb by Ian Lance Taylor Committed by Ian Lance Taylor

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
parent dc491a25
2009-06-19 Ian Lance Taylor <iant@google.com> 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 * dse.c (struct store_info): Rename bitmap field to bmap. Change
all uses. all uses.
......
...@@ -4352,6 +4352,14 @@ finish_decl (tree decl, location_t init_loc, tree init, ...@@ -4352,6 +4352,14 @@ finish_decl (tree decl, location_t init_loc, tree init,
push_cleanup (decl, cleanup, false); 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. */ /* Given a parsed parameter declaration, decode it into a PARM_DECL. */
......
...@@ -2165,7 +2165,7 @@ ggc_pch_write_object (struct ggc_pch_data *d ATTRIBUTE_UNUSED, ...@@ -2165,7 +2165,7 @@ ggc_pch_write_object (struct ggc_pch_data *d ATTRIBUTE_UNUSED,
size_t size, bool is_string ATTRIBUTE_UNUSED) size_t size, bool is_string ATTRIBUTE_UNUSED)
{ {
unsigned order; unsigned order;
static const char emptyBytes[256]; static const char emptyBytes[256] = { 0 };
if (size < NUM_SIZE_LOOKUP) if (size < NUM_SIZE_LOOKUP)
order = size_lookup[size]; order = size_lookup[size];
......
/* Output sdb-format symbol table information from GNU compiler. /* Output sdb-format symbol table information from GNU compiler.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 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. Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -1698,7 +1698,37 @@ sdbout_init (const char *input_file_name ATTRIBUTE_UNUSED) ...@@ -1698,7 +1698,37 @@ sdbout_init (const char *input_file_name ATTRIBUTE_UNUSED)
#else /* SDB_DEBUGGING_INFO */ #else /* SDB_DEBUGGING_INFO */
/* This should never be used, but its address is needed for comparisons. */ /* 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 */ #endif /* SDB_DEBUGGING_INFO */
......
2009-06-19 Ian Lance Taylor <iant@google.com> 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. * gcc.dg/Wcxx-compat-15.c: New testcase.
2009-06-19 Ian Lance Taylor <iant@google.com> 2009-06-19 Ian Lance Taylor <iant@google.com>
......
/* { 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 };
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment