summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-c++-builtin-redecl.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-c++-builtin-redecl.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-c++-builtin-redecl.patch115
1 files changed, 0 insertions, 115 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-c++-builtin-redecl.patch b/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-c++-builtin-redecl.patch
deleted file mode 100644
index a2dcedeab3..0000000000
--- a/meta/recipes-devtools/gcc/gcc-4.5.1/fedora/gcc43-c++-builtin-redecl.patch
+++ /dev/null
@@ -1,115 +0,0 @@
1Upstream-Status: Inappropriate [distribution: fedora]
22007-10-02 Jakub Jelinek <jakub@redhat.com>
3
4 * decl.c (duplicate_decls): When redeclaring a builtin function,
5 keep the merged decl builtin whenever types match, even if new
6 decl defines a function.
7
8 * gcc.dg/builtins-65.c: New test.
9 * g++.dg/ext/builtin10.C: New test.
10
11Index: gcc/cp/decl.c
12===================================================================
13--- gcc/cp/decl.c.orig 2010-04-01 11:48:46.000000000 -0700
14+++ gcc/cp/decl.c 2010-06-25 10:10:54.749131719 -0700
15@@ -2021,23 +2021,21 @@
16 DECL_ARGUMENTS (olddecl) = DECL_ARGUMENTS (newdecl);
17 DECL_RESULT (olddecl) = DECL_RESULT (newdecl);
18 }
19+ /* If redeclaring a builtin function, it stays built in. */
20+ if (types_match && DECL_BUILT_IN (olddecl))
21+ {
22+ DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl);
23+ DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
24+ /* If we're keeping the built-in definition, keep the rtl,
25+ regardless of declaration matches. */
26+ COPY_DECL_RTL (olddecl, newdecl);
27+ }
28 if (new_defines_function)
29 /* If defining a function declared with other language
30 linkage, use the previously declared language linkage. */
31 SET_DECL_LANGUAGE (newdecl, DECL_LANGUAGE (olddecl));
32 else if (types_match)
33 {
34- /* If redeclaring a builtin function, and not a definition,
35- it stays built in. */
36- if (DECL_BUILT_IN (olddecl))
37- {
38- DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl);
39- DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
40- /* If we're keeping the built-in definition, keep the rtl,
41- regardless of declaration matches. */
42- COPY_DECL_RTL (olddecl, newdecl);
43- }
44-
45 DECL_RESULT (newdecl) = DECL_RESULT (olddecl);
46 /* Don't clear out the arguments if we're just redeclaring a
47 function. */
48Index: gcc/testsuite/gcc.dg/builtins-65.c
49===================================================================
50--- gcc/testsuite/gcc.dg/builtins-65.c.orig 2009-06-26 02:02:04.000000000 -0700
51+++ gcc/testsuite/gcc.dg/builtins-65.c 2010-06-25 10:10:54.784464429 -0700
52@@ -1,3 +1,28 @@
53+/* { dg-do compile } */
54+/* { dg-options "-O2" } */
55+
56+typedef __SIZE_TYPE__ size_t;
57+extern void __chk_fail (void);
58+extern int snprintf (char *, size_t, const char *, ...);
59+extern inline __attribute__((gnu_inline, always_inline)) int snprintf (char *a, size_t b, const char *fmt, ...)
60+{
61+ if (__builtin_object_size (a, 0) != -1UL && __builtin_object_size (a, 0) < b)
62+ __chk_fail ();
63+ return __builtin_snprintf (a, b, fmt, __builtin_va_arg_pack ());
64+}
65+extern int snprintf (char *, size_t, const char *, ...) __asm ("mysnprintf");
66+
67+char buf[10];
68+
69+int
70+main (void)
71+{
72+ snprintf (buf, 10, "%d%d\n", 10, 10);
73+ return 0;
74+}
75+
76+/* { dg-final { scan-assembler "mysnprintf" } } */
77+/* { dg-final { scan-assembler-not "__chk_fail" } } */
78 /* { dg-do link } */
79 /* { dg-options "-O2 -ffast-math" } */
80 /* { dg-require-effective-target c99_runtime } */
81Index: gcc/testsuite/g++.dg/ext/builtin10.C
82===================================================================
83--- gcc/testsuite/g++.dg/ext/builtin10.C.orig 2009-02-02 03:27:50.000000000 -0800
84+++ gcc/testsuite/g++.dg/ext/builtin10.C 2010-06-25 10:10:54.816467202 -0700
85@@ -1,3 +1,30 @@
86+// { dg-do compile }
87+// { dg-options "-O2" }
88+
89+typedef __SIZE_TYPE__ size_t;
90+extern "C" {
91+extern void __chk_fail (void);
92+extern int snprintf (char *, size_t, const char *, ...);
93+extern inline __attribute__((gnu_inline, always_inline)) int snprintf (char *a, size_t b, const char *fmt, ...)
94+{
95+ if (__builtin_object_size (a, 0) != -1UL && __builtin_object_size (a, 0) < b)
96+ __chk_fail ();
97+ return __builtin_snprintf (a, b, fmt, __builtin_va_arg_pack ());
98+}
99+extern int snprintf (char *, size_t, const char *, ...) __asm ("mysnprintf");
100+}
101+
102+char buf[10];
103+
104+int
105+main (void)
106+{
107+ snprintf (buf, 10, "%d%d\n", 10, 10);
108+ return 0;
109+}
110+
111+// { dg-final { scan-assembler "mysnprintf" } }
112+// { dg-final { scan-assembler-not "__chk_fail" } }
113 // { dg-do compile { target correct_iso_cpp_string_wchar_protos } }
114 // { dg-options "-O2 -fdump-tree-optimized" }
115