summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-cpp-pragma.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-cpp-pragma.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-cpp-pragma.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-cpp-pragma.patch284
1 files changed, 284 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-cpp-pragma.patch b/meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-cpp-pragma.patch
new file mode 100644
index 0000000000..00d37bd7ce
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.5.0/fedora/gcc43-cpp-pragma.patch
@@ -0,0 +1,284 @@
12008-02-26 Jakub Jelinek <jakub@redhat.com>
2
3 * c-ppoutput.c (scan_translation_unit): Handle CPP_PRAGMA
4 and CPP_PRAGMA_EOL.
5 * c-pragma.c (pragma_ns_name): New typedef.
6 (registered_pp_pragmas): New variable.
7 (c_pp_lookup_pragma): New function.
8 (c_register_pragma_1): If flag_preprocess_only, do nothing
9 for non-expanded pragmas, for expanded ones push pragma's
10 namespace and name into registered_pp_pragmas vector.
11 (c_invoke_pragma_handler): Register OpenMP pragmas even when
12 flag_preprocess_only, don't register GCC pch_preprocess
13 pragma if flag_preprocess_only.
14 * c-opts.c (c_common_init): Call init_pragma even if
15 flag_preprocess_only.
16 * c-pragma.c (c_pp_lookup_pragma): New prototype.
17 * config/darwin.h (DARWIN_REGISTER_TARGET_PRAGMAS): Don't call
18 cpp_register_pragma if flag_preprocess_only.
19
20 * gcc.dg/gomp/preprocess-1.c: New test.
21
22--- gcc/c-ppoutput.c.jj 2008-01-26 18:01:16.000000000 +0100
23+++ gcc/c-ppoutput.c 2008-02-26 22:54:57.000000000 +0100
24@@ -1,6 +1,6 @@
25 /* Preprocess only, using cpplib.
26- Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007
27- Free Software Foundation, Inc.
28+ Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007,
29+ 2008 Free Software Foundation, Inc.
30 Written by Per Bothner, 1994-95.
31
32 This program is free software; you can redistribute it and/or modify it
33@@ -177,7 +177,24 @@ scan_translation_unit (cpp_reader *pfile
34 avoid_paste = false;
35 print.source = NULL;
36 print.prev = token;
37- cpp_output_token (token, print.outf);
38+ if (token->type == CPP_PRAGMA)
39+ {
40+ const char *space;
41+ const char *name;
42+
43+ maybe_print_line (token->src_loc);
44+ fputs ("#pragma ", print.outf);
45+ c_pp_lookup_pragma (token->val.pragma, &space, &name);
46+ if (space)
47+ fprintf (print.outf, "%s %s", space, name);
48+ else
49+ fprintf (print.outf, "%s", name);
50+ print.printed = 1;
51+ }
52+ else if (token->type == CPP_PRAGMA_EOL)
53+ maybe_print_line (token->src_loc);
54+ else
55+ cpp_output_token (token, print.outf);
56
57 if (token->type == CPP_COMMENT)
58 account_for_newlines (token->val.str.text, token->val.str.len);
59--- gcc/c-pragma.c.jj 2008-02-15 18:43:03.000000000 +0100
60+++ gcc/c-pragma.c 2008-02-26 22:59:44.000000000 +0100
61@@ -1,6 +1,6 @@
62 /* Handle #pragma, system V.4 style. Supports #pragma weak and #pragma pack.
63 Copyright (C) 1992, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
64- 2006, 2007 Free Software Foundation, Inc.
65+ 2006, 2007, 2008 Free Software Foundation, Inc.
66
67 This file is part of GCC.
68
69@@ -872,6 +872,61 @@ DEF_VEC_ALLOC_O (pragma_handler, heap);
70
71 static VEC(pragma_handler, heap) *registered_pragmas;
72
73+typedef struct
74+{
75+ const char *space;
76+ const char *name;
77+} pragma_ns_name;
78+
79+DEF_VEC_O (pragma_ns_name);
80+DEF_VEC_ALLOC_O (pragma_ns_name, heap);
81+
82+static VEC(pragma_ns_name, heap) *registered_pp_pragmas;
83+
84+struct omp_pragma_def { const char *name; unsigned int id; };
85+static const struct omp_pragma_def omp_pragmas[] = {
86+ { "atomic", PRAGMA_OMP_ATOMIC },
87+ { "barrier", PRAGMA_OMP_BARRIER },
88+ { "critical", PRAGMA_OMP_CRITICAL },
89+ { "flush", PRAGMA_OMP_FLUSH },
90+ { "for", PRAGMA_OMP_FOR },
91+ { "master", PRAGMA_OMP_MASTER },
92+ { "ordered", PRAGMA_OMP_ORDERED },
93+ { "parallel", PRAGMA_OMP_PARALLEL },
94+ { "section", PRAGMA_OMP_SECTION },
95+ { "sections", PRAGMA_OMP_SECTIONS },
96+ { "single", PRAGMA_OMP_SINGLE },
97+ { "threadprivate", PRAGMA_OMP_THREADPRIVATE }
98+};
99+
100+void
101+c_pp_lookup_pragma (unsigned int id, const char **space, const char **name)
102+{
103+ const int n_omp_pragmas = sizeof (omp_pragmas) / sizeof (*omp_pragmas);
104+ int i;
105+
106+ for (i = 0; i < n_omp_pragmas; ++i)
107+ if (omp_pragmas[i].id == id)
108+ {
109+ *space = "omp";
110+ *name = omp_pragmas[i].name;
111+ return;
112+ }
113+
114+ if (id >= PRAGMA_FIRST_EXTERNAL
115+ && (id < PRAGMA_FIRST_EXTERNAL
116+ + VEC_length (pragma_ns_name, registered_pp_pragmas)))
117+ {
118+ *space = VEC_index (pragma_ns_name, registered_pp_pragmas,
119+ id - PRAGMA_FIRST_EXTERNAL)->space;
120+ *name = VEC_index (pragma_ns_name, registered_pp_pragmas,
121+ id - PRAGMA_FIRST_EXTERNAL)->name;
122+ return;
123+ }
124+
125+ gcc_unreachable ();
126+}
127+
128 /* Front-end wrappers for pragma registration to avoid dragging
129 cpplib.h in almost everywhere. */
130
131@@ -881,13 +936,29 @@ c_register_pragma_1 (const char *space,
132 {
133 unsigned id;
134
135- VEC_safe_push (pragma_handler, heap, registered_pragmas, &handler);
136- id = VEC_length (pragma_handler, registered_pragmas);
137- id += PRAGMA_FIRST_EXTERNAL - 1;
138-
139- /* The C++ front end allocates 6 bits in cp_token; the C front end
140- allocates 7 bits in c_token. At present this is sufficient. */
141- gcc_assert (id < 64);
142+ if (flag_preprocess_only)
143+ {
144+ pragma_ns_name ns_name;
145+
146+ if (!allow_expansion)
147+ return;
148+
149+ ns_name.space = space;
150+ ns_name.name = name;
151+ VEC_safe_push (pragma_ns_name, heap, registered_pp_pragmas, &ns_name);
152+ id = VEC_length (pragma_ns_name, registered_pp_pragmas);
153+ id += PRAGMA_FIRST_EXTERNAL - 1;
154+ }
155+ else
156+ {
157+ VEC_safe_push (pragma_handler, heap, registered_pragmas, &handler);
158+ id = VEC_length (pragma_handler, registered_pragmas);
159+ id += PRAGMA_FIRST_EXTERNAL - 1;
160+
161+ /* The C++ front end allocates 6 bits in cp_token; the C front end
162+ allocates 7 bits in c_token. At present this is sufficient. */
163+ gcc_assert (id < 64);
164+ }
165
166 cpp_register_deferred_pragma (parse_in, space, name, id,
167 allow_expansion, false);
168@@ -921,24 +992,8 @@ c_invoke_pragma_handler (unsigned int id
169 void
170 init_pragma (void)
171 {
172- if (flag_openmp && !flag_preprocess_only)
173+ if (flag_openmp)
174 {
175- struct omp_pragma_def { const char *name; unsigned int id; };
176- static const struct omp_pragma_def omp_pragmas[] = {
177- { "atomic", PRAGMA_OMP_ATOMIC },
178- { "barrier", PRAGMA_OMP_BARRIER },
179- { "critical", PRAGMA_OMP_CRITICAL },
180- { "flush", PRAGMA_OMP_FLUSH },
181- { "for", PRAGMA_OMP_FOR },
182- { "master", PRAGMA_OMP_MASTER },
183- { "ordered", PRAGMA_OMP_ORDERED },
184- { "parallel", PRAGMA_OMP_PARALLEL },
185- { "section", PRAGMA_OMP_SECTION },
186- { "sections", PRAGMA_OMP_SECTIONS },
187- { "single", PRAGMA_OMP_SINGLE },
188- { "threadprivate", PRAGMA_OMP_THREADPRIVATE }
189- };
190-
191 const int n_omp_pragmas = sizeof (omp_pragmas) / sizeof (*omp_pragmas);
192 int i;
193
194@@ -947,8 +1002,9 @@ init_pragma (void)
195 omp_pragmas[i].id, true, true);
196 }
197
198- cpp_register_deferred_pragma (parse_in, "GCC", "pch_preprocess",
199- PRAGMA_GCC_PCH_PREPROCESS, false, false);
200+ if (!flag_preprocess_only)
201+ cpp_register_deferred_pragma (parse_in, "GCC", "pch_preprocess",
202+ PRAGMA_GCC_PCH_PREPROCESS, false, false);
203
204 #ifdef HANDLE_PRAGMA_PACK
205 #ifdef HANDLE_PRAGMA_PACK_WITH_EXPANSION
206--- gcc/c-opts.c.jj 2008-02-26 22:53:23.000000000 +0100
207+++ gcc/c-opts.c 2008-02-26 22:54:57.000000000 +0100
208@@ -1,5 +1,5 @@
209 /* C/ObjC/C++ command line option handling.
210- Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
211+ Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
212 Free Software Foundation, Inc.
213 Contributed by Neil Booth.
214
215@@ -1239,6 +1239,9 @@ c_common_init (void)
216 if (version_flag)
217 c_common_print_pch_checksum (stderr);
218
219+ /* Has to wait until now so that cpplib has its hash table. */
220+ init_pragma ();
221+
222 if (flag_preprocess_only)
223 {
224 finish_options ();
225@@ -1246,9 +1249,6 @@ c_common_init (void)
226 return false;
227 }
228
229- /* Has to wait until now so that cpplib has its hash table. */
230- init_pragma ();
231-
232 return true;
233 }
234
235--- gcc/c-pragma.h.jj 2008-01-26 18:01:16.000000000 +0100
236+++ gcc/c-pragma.h 2008-02-26 22:54:57.000000000 +0100
237@@ -1,6 +1,6 @@
238 /* Pragma related interfaces.
239 Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
240- 2007 Free Software Foundation, Inc.
241+ 2007, 2008 Free Software Foundation, Inc.
242
243 This file is part of GCC.
244
245@@ -124,4 +124,6 @@ extern enum cpp_ttype pragma_lex (tree *
246 extern enum cpp_ttype c_lex_with_flags (tree *, location_t *, unsigned char *,
247 int);
248
249+extern void c_pp_lookup_pragma (unsigned int, const char **, const char **);
250+
251 #endif /* GCC_C_PRAGMA_H */
252--- gcc/config/darwin.h.jj 2008-02-11 14:48:12.000000000 +0100
253+++ gcc/config/darwin.h 2008-02-26 22:54:57.000000000 +0100
254@@ -892,8 +892,9 @@ enum machopic_addr_class {
255
256 #define DARWIN_REGISTER_TARGET_PRAGMAS() \
257 do { \
258- cpp_register_pragma (parse_in, NULL, "mark", \
259- darwin_pragma_ignore, false); \
260+ if (!flag_preprocess_only) \
261+ cpp_register_pragma (parse_in, NULL, "mark", \
262+ darwin_pragma_ignore, false); \
263 c_register_pragma (0, "options", darwin_pragma_options); \
264 c_register_pragma (0, "segment", darwin_pragma_ignore); \
265 c_register_pragma (0, "unused", darwin_pragma_unused); \
266--- gcc/testsuite/gcc.dg/gomp/preprocess-1.c.jj 2008-02-26 22:54:57.000000000 +0100
267+++ gcc/testsuite/gcc.dg/gomp/preprocess-1.c 2008-02-26 22:54:57.000000000 +0100
268@@ -0,0 +1,16 @@
269+/* { dg-do preprocess } */
270+
271+void foo (void)
272+{
273+ int i1, j1, k1;
274+#define p parallel
275+#define P(x) private (x##1)
276+#define S(x) shared (x##1)
277+#define F(x) firstprivate (x##1)
278+#pragma omp p P(i) \
279+ S(j) \
280+ F(k)
281+ ;
282+}
283+
284+/* { dg-final { scan-file preprocess-1.i "(^|\n)#pragma omp parallel private \\(i1\\) shared \\(j1\\) firstprivate \\(k1\\)($|\n)" } } */