Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error detecting attributes (g++-3.3) #491

Open
ghost opened this issue Jul 27, 2011 · 3 comments
Open

Error detecting attributes (g++-3.3) #491

ghost opened this issue Jul 27, 2011 · 3 comments

Comments

@ghost
Copy link

ghost commented Jul 27, 2011

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 <doughera@lafayette.edu>
To: Jonathan "Duke" Leto <jonathan@leto.net>
Cc: parrot-dev <parrot-dev@lists.parrot.org>
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
> > <jonathan@leto.net> 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

@ghost
Copy link
Author

ghost commented Jul 27, 2011

This message has 0 attachment(s)

@jkeenan
Copy link
Contributor

jkeenan commented Jul 27, 2011

440 byte attachment from jkeenan
at http://trac.parrot.org/parrot/raw-attachment/ticket/2164/tt2164.doughera.patch

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 */

@jkeenan
Copy link
Contributor

jkeenan commented Jul 27, 2011

I have converted Andy Dougherty's patch to an attachment. I tried it out on both Linux/i386 and Darwin/PPC with no harm; all tests PASS. However, in both cases I was using gcc or g++ 4+. So, it still needs to be tested for the case for which it was designed.

kid51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant