build gdc with gcc 4.2.2

Ingo Oeser ioe-news at rameria.de
Sat Nov 24 06:13:52 PST 2007


Hi Arthur,

nice to see that happening!

Arthur Loiret wrote:

> I've been able to build gdc with gcc-4.2, it stills segfault sometimes
> and is unable to build phobos/tango for now, but it's a beginning and
> can compile short D files.

I've been trying to do the same some months ago.
 
> --- gcc/tree.h  2007-11-15 14:21:01.000000000 +0100
> +++ gcc/tree.h  2007-11-15 14:22:05.000000000 +0100
> @@ -3535,6 +3535,19 @@
>  
>  extern tree build_nt (enum tree_code, ...);
>  
> +/* Still required by gdc */
> +#if GCC_VERSION >= 3000 || __STDC_VERSION__ >= 199901L
> +/* Use preprocessor trickery to map "build" to "buildN" where N is the
> +   expected number of arguments.  This is used for both efficiency (no
> +   varargs), and checking (verifying number of passed arguments).  */
> +#define build(code, ...) \
> +  _buildN1(build, _buildC1(__VA_ARGS__))(code, __VA_ARGS__)
> +#define _buildN1(BASE, X)       _buildN2(BASE, X)
> +#define _buildN2(BASE, X)       BASE##X
> +#define _buildC1(...)          
> _buildC2(__VA_ARGS__,9,8,7,6,5,4,3,2,1,0,0) +#define
> _buildC2(x,a1,a2,a3,a4,a5,a6,a7,a8,a9,c,...) c +#endif
> +
>  extern tree build0_stat (enum tree_code, tree MEM_STAT_DECL);
>  #define build0(c,t) build0_stat (c,t MEM_STAT_INFO)
>  extern tree build1_stat (enum tree_code, tree, tree MEM_STAT_DECL);

That's more (short term) maintainable than my approach. I patched the D glue
layer, fixed up the callers and provided build2() and build3() for compilers
below GCC 4.0.x. 

David, would you accept a patch from me, which does ONLY that?

> I'm currently trying to fix ICEs, the problems seems to come from
> gimple.

Yes, I have seen the same and my vacation was over, so I stopped it.

I have some questions for some parts of that patch. I'll mail them to you.


Best Regards

Ingo Oeser


More information about the D.gnu mailing list