petdance/scratch — Issue #1348: Error detecting attributes (g++-3.3)
Author: petdance
Created: 2011-11-01 05:40:00+00:00
State: open
Labels: bug, configure, Pri-normal, Sev-medium

{{{
I'm forwarding this to Trac so it doesn't get lost. The original problem
manifested itself on the openbsd smoker in the gcc compile farm, but is
likely more general than that.

--
Andy Dougherty	doughera@lafayette.edu

---------- Forwarded message ----------
Date: Mon, 25 Jul 2011 19:53:31 -0400 (EDT)
From: Andy Dougherty
To: Jonathan "Duke" Leto
Cc: parrot-dev
Subject: Re: compile error on openbsd with g++

On Sat, 23 Jul 2011, Andy Dougherty wrote:

> On Fri, 22 Jul 2011, Jonathan "Duke" Leto wrote:
>
> > gcc (GCC) 3.3.5 (propolice)

> > On Fri, Jul 22, 2011 at 10:49 AM, Jonathan "Duke" Leto
> > wrote:
> > > Howdy,
> > >
> > > Just got the openbsd smoker in the farm working again, and it hit a
> > > compile error:
> > >
> > > https://gist.github.com/1099956
>
> Without seeing both the output of Configure.pl --verbose and the
> preprocessed output of src/string/api.c, it's hard to be sure, but this
> looks like the sort of thing you get when parrot's detection of attributes
> is wrong.
>
> In particular, the gcc-3.3/HASATTRIBUTE_UNUSED combination is tricky: It
> works in gcc-3.3, but fails in g++-3.3.

I haven't tested this at all, but I suspect that the issue is that the
Configure.pl probe doesn't use the attribute in the same way as parrot
does. (The inline probe has the same problem. See TT #1943).

It's likely that a rather trivial patch like the one below will fix this
immediate problem, but since my last 2 attempts to do something useful for
attribute detection were rejected, I'm unwilling to work any harder at it.

diff --git a/config/auto/attributes/test_c.in b/config/auto/attributes/test_c.in
index eb5262c..896da8b 100644
--- a/config/auto/attributes/test_c.in
+++ b/config/auto/attributes/test_c.in
@@ -42,7 +42,7 @@ coldfunc(int x);

static int
-useless(void) { int x __attribute__unused__; return 0; }
+useless(int x __attribute__unused__) { int y __attribute__unused__; return 0; }

/* as long as the file compiles, everything is okay */

--
Andy Dougherty	doughera@lafayette.edu

}}}

Originally http://trac.parrot.org/parrot/ticket/2164