* [PATCH]: work around solaris cpp bug with macro-arg whitespace?
@ 2007-08-17 17:40 Kaveh R. GHAZI
2007-08-26 1:31 ` [PING]: " Kaveh R. GHAZI
0 siblings, 1 reply; 2+ messages in thread
From: Kaveh R. GHAZI @ 2007-08-17 17:40 UTC (permalink / raw)
To: gcc-patches
Another problem using solaris cc for stage1. I get:
"tree.c", line 7354: invalid token: fract_type_node
"tree.c", line 7354: syntax error before or at: =
"tree.c", line 7355: invalid token: accum_type_node
"tree.c", line 7355: syntax error before or at: =
"tree.c", line 7379: cannot recover from previous errors
cc: acomp failed for tree.c
This one has to do with cpp hackery. There's layers of macro code in
tree.[ch] to set the various type nodes. One of them uses a blank
macro argument. A reduced testcase looks like this:
#define fract_type_node global_trees[TI_FRACT_TYPE]
#define sat_fract_type_node global_trees[TI_SAT_FRACT_TYPE]
#define BAR1(KIND,WIDTH,SIZE) \
sat_ ## WIDTH ## KIND ## _type_node; \
WIDTH ## KIND ## _type_node
#define BAR2(KIND,WIDTH,SIZE) \
WIDTH ## KIND ## _type_node; \
sat_ ## WIDTH ## KIND ## _type_node
#define FOO1(N1,N2) BAR1 (N1, , N2 ## _TYPE_SIZE)
#define FOO2(N1,N2) BAR2 (N1, , N2 ## _TYPE_SIZE)
FOO1(fract, FRACT)
FOO2(fract, FRACT)
The FOO1/BAR1 macro combination produces the error, the FOO2/BAR2
macros do not. The difference is that BAR2 has the order reversed so
that the empty macro arg appears first.
with solaris cc -E on the above code, I get:
global_trees [ TI_SAT_FRACT_TYPE ] ; fract_type_node
global_trees [ TI_FRACT_TYPE ] ; global_trees [ TI_SAT_FRACT_TYPE ]
#ident "acomp: Sun C 5.7 2005/01/07"
"foo.c", line 15: invalid token: fract_type_node
Notice that "fract_type_node" did not get macro-replaced by
global_trees[TI_FRACT_TYPE] in the first line.
Surely this is a solaris cc/cpp bug?
Anyway, patch below restores compiling tree.o with solaris cc, and the
bootstrap makes it into stage2.
Okay for mainline?
Thanks,
--Kaveh
2007-08-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* tree.c (MAKE_FIXED_TYPE_NODE): Reorder for solaris cc.
diff -rup orig/egcc-SVN20070817/gcc/tree.c egcc-SVN20070817/gcc/tree.c
--- orig/egcc-SVN20070817/gcc/tree.c 2007-08-17 04:30:36.000000000 -0400
+++ egcc-SVN20070817/gcc/tree.c 2007-08-17 13:26:55.402848742 -0400
@@ -7321,11 +7321,11 @@ build_common_tree_nodes_2 (int short_dou
/* Make fixed-point nodes based on sat/non-sat and signed/unsigned. */
#define MAKE_FIXED_TYPE_NODE(KIND,WIDTH,SIZE) \
+ WIDTH ## KIND ## _type_node = make_signed_ ## KIND ## _type (SIZE); \
sat_ ## WIDTH ## KIND ## _type_node = \
make_sat_signed_ ## KIND ## _type (SIZE); \
sat_unsigned_ ## WIDTH ## KIND ## _type_node = \
make_sat_unsigned_ ## KIND ## _type (SIZE); \
- WIDTH ## KIND ## _type_node = make_signed_ ## KIND ## _type (SIZE); \
unsigned_ ## WIDTH ## KIND ## _type_node = \
make_unsigned_ ## KIND ## _type (SIZE);
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PING]: work around solaris cpp bug with macro-arg whitespace?
2007-08-17 17:40 [PATCH]: work around solaris cpp bug with macro-arg whitespace? Kaveh R. GHAZI
@ 2007-08-26 1:31 ` Kaveh R. GHAZI
0 siblings, 0 replies; 2+ messages in thread
From: Kaveh R. GHAZI @ 2007-08-26 1:31 UTC (permalink / raw)
To: gcc-patches
On Fri, 17 Aug 2007, Kaveh R. GHAZI wrote:
> * tree.c (MAKE_FIXED_TYPE_NODE): Reorder for solaris cc.
>
Ping:
http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01131.html
Thanks,
--Kaveh
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-08-25 23:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-17 17:40 [PATCH]: work around solaris cpp bug with macro-arg whitespace? Kaveh R. GHAZI
2007-08-26 1:31 ` [PING]: " Kaveh R. GHAZI
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).