summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Nagy <robert@cvs.openbsd.org>2010-02-24 11:50:07 +0000
committerRobert Nagy <robert@cvs.openbsd.org>2010-02-24 11:50:07 +0000
commitc1d5065ae6bd5a2f60108ab421c7cc5a8fab6530 (patch)
treecd0c26f095aec8ec0d38d15e192c6c6652489770
parent8999d490ee046a9945f3ab4b8584742c678a334a (diff)
merge more local changes:
- disable unsafe builtins - create a stub for -Wbounded - move strict aliasing to -O3
-rw-r--r--gnu/gcc/gcc/builtins.c4
-rw-r--r--gnu/gcc/gcc/c-common.c15
-rw-r--r--gnu/gcc/gcc/c-common.h2
-rw-r--r--gnu/gcc/gcc/common.opt2
-rw-r--r--gnu/gcc/gcc/opts.c2
5 files changed, 23 insertions, 2 deletions
diff --git a/gnu/gcc/gcc/builtins.c b/gnu/gcc/gcc/builtins.c
index 27f19894cc7..f6c00447aa6 100644
--- a/gnu/gcc/gcc/builtins.c
+++ b/gnu/gcc/gcc/builtins.c
@@ -5924,9 +5924,11 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
break;
case BUILT_IN_STRCPY:
+#ifndef NO_UNSAFE_BUILTINS
target = expand_builtin_strcpy (fndecl, arglist, target, mode);
if (target)
return target;
+#endif
break;
case BUILT_IN_STRNCPY:
@@ -5942,9 +5944,11 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
break;
case BUILT_IN_STRCAT:
+#ifndef NO_UNSAFE_BUILTINS
target = expand_builtin_strcat (fndecl, arglist, target, mode);
if (target)
return target;
+#endif
break;
case BUILT_IN_STRNCAT:
diff --git a/gnu/gcc/gcc/c-common.c b/gnu/gcc/gcc/c-common.c
index b5ea60818f2..63c5fe00188 100644
--- a/gnu/gcc/gcc/c-common.c
+++ b/gnu/gcc/gcc/c-common.c
@@ -295,6 +295,9 @@ int flag_zero_link = 0;
contained are to replace one(s) previously loaded. */
int flag_replace_objc_classes = 0;
+/* Warn about buffer size mismatches. */
+int warn_bounded;
+
/* C/ObjC language option variables. */
@@ -545,6 +548,7 @@ static tree handle_cleanup_attribute (tree *, tree, tree, int, bool *);
static tree handle_warn_unused_result_attribute (tree *, tree, tree, int,
bool *);
static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *);
+static tree handle_bounded_attribute (tree *, tree, tree, int, bool *);
static void check_function_nonnull (tree, tree);
static void check_nonnull_arg (void *, tree, unsigned HOST_WIDE_INT);
@@ -624,6 +628,8 @@ const struct attribute_spec c_common_attribute_table[] =
handle_deprecated_attribute },
{ "vector_size", 1, 1, false, true, false,
handle_vector_size_attribute },
+ { "bounded", 3, 4, false, true, false,
+ handle_bounded_attribute },
{ "visibility", 1, 1, false, false, false,
handle_visibility_attribute },
{ "tls_model", 1, 1, true, false, false,
@@ -4645,6 +4651,15 @@ handle_mode_attribute (tree *node, tree name, tree args,
return NULL_TREE;
}
+static tree
+handle_bounded_attribute (tree *ARG_UNUSED (node), tree ARG_UNUSED (name),
+ tree ARG_UNUSED (args),
+ int ARG_UNUSED (flags), bool *no_add_attrs)
+{
+ *no_add_attrs = true;
+ return NULL_TREE;
+}
+
/* Handle a "section" attribute; arguments as in
struct attribute_spec.handler. */
diff --git a/gnu/gcc/gcc/c-common.h b/gnu/gcc/gcc/c-common.h
index 633990a3a35..391edcefd6d 100644
--- a/gnu/gcc/gcc/c-common.h
+++ b/gnu/gcc/gcc/c-common.h
@@ -414,6 +414,8 @@ extern int warn_unknown_pragmas; /* Tri state variable. */
extern int warn_format;
+/* Warn about buffer size mismatches. */
+extern int warn_bounded;
/* C/ObjC language option variables. */
diff --git a/gnu/gcc/gcc/common.opt b/gnu/gcc/gcc/common.opt
index 360a4827b2c..d0724e40540 100644
--- a/gnu/gcc/gcc/common.opt
+++ b/gnu/gcc/gcc/common.opt
@@ -1092,7 +1092,7 @@ Common Report Var(flag_wrapv)
Assume signed arithmetic overflow wraps around
fzero-initialized-in-bss
-Common Report Var(flag_zero_initialized_in_bss) Init(1)
+Common Report Var(flag_zero_initialized_in_bss) Init(0)
Put zero initialized data in the bss section
g
diff --git a/gnu/gcc/gcc/opts.c b/gnu/gcc/gcc/opts.c
index 34d01c287e9..c9c5504c73d 100644
--- a/gnu/gcc/gcc/opts.c
+++ b/gnu/gcc/gcc/opts.c
@@ -497,7 +497,6 @@ decode_options (unsigned int argc, const char **argv)
flag_schedule_insns_after_reload = 1;
#endif
flag_regmove = 1;
- flag_strict_aliasing = 0;
flag_strict_overflow = 1;
#if !defined(OPENBSD_NATIVE) && !defined(OPENBSD_CROSS)
flag_delete_null_pointer_checks = 1;
@@ -517,6 +516,7 @@ decode_options (unsigned int argc, const char **argv)
if (optimize >= 3)
{
+ flag_strict_aliasing = 1;
flag_inline_functions = 1;
flag_unswitch_loops = 1;
flag_gcse_after_reload = 1;