aboutsummaryrefslogtreecommitdiff
path: root/gcc/attribs.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-08-04 09:40:24 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2011-08-04 09:40:24 +0200
commit8dd00781e17a65c4344681e13f763f8b41880c61 (patch)
tree7fb650606fc204d2c6c911f55570dd8f43df158c /gcc/attribs.c
parent9434c32ec698e22420295be3bccf9d2c91967859 (diff)
downloadgcc-8dd00781e17a65c4344681e13f763f8b41880c61.zip
gcc-8dd00781e17a65c4344681e13f763f8b41880c61.tar.gz
gcc-8dd00781e17a65c4344681e13f763f8b41880c61.tar.bz2
re PR middle-end/49905 (Better sanity checking on sprintf src & dest to produce warning for dodgy code ?)
PR middle-end/49905 * tree.h (init_attributes): New prototype. * attribs.c (init_attributes): No longer static. * decl.c (cxx_init_decl_processing): Add alloc_size (1) attribute for operator new and operator new []. Call init_attributes. * g++.dg/ext/builtin-object-size3.C: New test. From-SVN: r177316
Diffstat (limited to 'gcc/attribs.c')
-rw-r--r--gcc/attribs.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/attribs.c b/gcc/attribs.c
index 98a6310..9448c0c 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -34,8 +34,6 @@ along with GCC; see the file COPYING3. If not see
#include "hashtab.h"
#include "plugin.h"
-static void init_attributes (void);
-
/* Table of the tables of attributes (common, language, format, machine)
searched. */
static const struct attribute_spec *attribute_tables[4];
@@ -107,12 +105,15 @@ eq_attr (const void *p, const void *q)
/* Initialize attribute tables, and make some sanity checks
if --enable-checking. */
-static void
+void
init_attributes (void)
{
size_t i;
int k;
+ if (attributes_initialized)
+ return;
+
attribute_tables[0] = lang_hooks.common_attribute_table;
attribute_tables[1] = lang_hooks.attribute_table;
attribute_tables[2] = lang_hooks.format_attribute_table;