summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-c++-builtin-redecl.patch
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:14:24 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:29:45 +0100
commit29d6678fd546377459ef75cf54abeef5b969b5cf (patch)
tree8edd65790e37a00d01c3f203f773fe4b5012db18 /meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-c++-builtin-redecl.patch
parentda49de6885ee1bc424e70bc02f21f6ab920efb55 (diff)
downloadpoky-29d6678fd546377459ef75cf54abeef5b969b5cf.tar.gz
Major layout change to the packages directory
Having one monolithic packages directory makes it hard to find things and is generally overwhelming. This commit splits it into several logical sections roughly based on function, recipes.txt gives more information about the classifications used. The opportunity is also used to switch from "packages" to "recipes" as used in OpenEmbedded as the term "packages" can be confusing to people and has many different meanings. Not all recipes have been classified yet, this is just a first pass at separating things out. Some packages are moved to meta-extras as they're no longer actively used or maintained. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-c++-builtin-redecl.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-c++-builtin-redecl.patch114
1 files changed, 114 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-c++-builtin-redecl.patch b/meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-c++-builtin-redecl.patch
new file mode 100644
index 0000000000..a149eae98e
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-c++-builtin-redecl.patch
@@ -0,0 +1,114 @@
12007-10-02 Jakub Jelinek <jakub@redhat.com>
2
3 * decl.c (duplicate_decls): When redeclaring a builtin function,
4 keep the merged decl builtin whenever types match, even if new
5 decl defines a function.
6
7 * gcc.dg/builtins-65.c: New test.
8 * g++.dg/ext/builtin10.C: New test.
9
10Index: gcc/cp/decl.c
11===================================================================
12--- gcc/cp/decl.c.orig 2010-04-01 11:48:46.000000000 -0700
13+++ gcc/cp/decl.c 2010-06-25 10:10:54.749131719 -0700
14@@ -2021,23 +2021,21 @@
15 DECL_ARGUMENTS (olddecl) = DECL_ARGUMENTS (newdecl);
16 DECL_RESULT (olddecl) = DECL_RESULT (newdecl);
17 }
18+ /* If redeclaring a builtin function, it stays built in. */
19+ if (types_match && DECL_BUILT_IN (olddecl))
20+ {
21+ DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl);
22+ DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
23+ /* If we're keeping the built-in definition, keep the rtl,
24+ regardless of declaration matches. */
25+ COPY_DECL_RTL (olddecl, newdecl);
26+ }
27 if (new_defines_function)
28 /* If defining a function declared with other language
29 linkage, use the previously declared language linkage. */
30 SET_DECL_LANGUAGE (newdecl, DECL_LANGUAGE (olddecl));
31 else if (types_match)
32 {
33- /* If redeclaring a builtin function, and not a definition,
34- it stays built in. */
35- if (DECL_BUILT_IN (olddecl))
36- {
37- DECL_BUILT_IN_CLASS (newdecl) = DECL_BUILT_IN_CLASS (olddecl);
38- DECL_FUNCTION_CODE (newdecl) = DECL_FUNCTION_CODE (olddecl);
39- /* If we're keeping the built-in definition, keep the rtl,
40- regardless of declaration matches. */
41- COPY_DECL_RTL (olddecl, newdecl);
42- }
43-
44 DECL_RESULT (newdecl) = DECL_RESULT (olddecl);
45 /* Don't clear out the arguments if we're just redeclaring a
46 function. */
47Index: gcc/testsuite/gcc.dg/builtins-65.c
48===================================================================
49--- gcc/testsuite/gcc.dg/builtins-65.c.orig 2009-06-26 02:02:04.000000000 -0700
50+++ gcc/testsuite/gcc.dg/builtins-65.c 2010-06-25 10:10:54.784464429 -0700
51@@ -1,3 +1,28 @@
52+/* { dg-do compile } */
53+/* { dg-options "-O2" } */
54+
55+typedef __SIZE_TYPE__ size_t;
56+extern void __chk_fail (void);
57+extern int snprintf (char *, size_t, const char *, ...);
58+extern inline __attribute__((gnu_inline, always_inline)) int snprintf (char *a, size_t b, const char *fmt, ...)
59+{
60+ if (__builtin_object_size (a, 0) != -1UL && __builtin_object_size (a, 0) < b)
61+ __chk_fail ();
62+ return __builtin_snprintf (a, b, fmt, __builtin_va_arg_pack ());
63+}
64+extern int snprintf (char *, size_t, const char *, ...) __asm ("mysnprintf");
65+
66+char buf[10];
67+
68+int
69+main (void)
70+{
71+ snprintf (buf, 10, "%d%d\n", 10, 10);
72+ return 0;
73+}
74+
75+/* { dg-final { scan-assembler "mysnprintf" } } */
76+/* { dg-final { scan-assembler-not "__chk_fail" } } */
77 /* { dg-do link } */
78 /* { dg-options "-O2 -ffast-math" } */
79 /* { dg-require-effective-target c99_runtime } */
80Index: gcc/testsuite/g++.dg/ext/builtin10.C
81===================================================================
82--- gcc/testsuite/g++.dg/ext/builtin10.C.orig 2009-02-02 03:27:50.000000000 -0800
83+++ gcc/testsuite/g++.dg/ext/builtin10.C 2010-06-25 10:10:54.816467202 -0700
84@@ -1,3 +1,30 @@
85+// { dg-do compile }
86+// { dg-options "-O2" }
87+
88+typedef __SIZE_TYPE__ size_t;
89+extern "C" {
90+extern void __chk_fail (void);
91+extern int snprintf (char *, size_t, const char *, ...);
92+extern inline __attribute__((gnu_inline, always_inline)) int snprintf (char *a, size_t b, const char *fmt, ...)
93+{
94+ if (__builtin_object_size (a, 0) != -1UL && __builtin_object_size (a, 0) < b)
95+ __chk_fail ();
96+ return __builtin_snprintf (a, b, fmt, __builtin_va_arg_pack ());
97+}
98+extern int snprintf (char *, size_t, const char *, ...) __asm ("mysnprintf");
99+}
100+
101+char buf[10];
102+
103+int
104+main (void)
105+{
106+ snprintf (buf, 10, "%d%d\n", 10, 10);
107+ return 0;
108+}
109+
110+// { dg-final { scan-assembler "mysnprintf" } }
111+// { dg-final { scan-assembler-not "__chk_fail" } }
112 // { dg-do compile { target correct_iso_cpp_string_wchar_protos } }
113 // { dg-options "-O2 -fdump-tree-optimized" }
114