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