GCC build failed for native with your patch on 2003-04-11T06:41:30Z.

Zack Weinberg zack@codesourcery.com
Fri Apr 11 18:06:00 GMT 2003


Zack Weinberg <zack@codesourcery.com> writes:

> Geoffrey Keating <geoffk@apple.com> writes:
>
>>> I believe the appended patch should fix this bug, but I do not have
>>> access to a Darwin system to verify it.  My apologies for not looking
>>> thoroughly enough for remaining uses of IDENTIFIER_LOCAL_VALUE; this
>>> really should be the last one.
>>
>> This looks right, although I suspect that it's actually a bug that
>> #pragma unused doesn't work on file-scope objects.
>
> I could just knock out the DECL_CONTEXT line and fix that too, if you
> like - the pragma would then apply to whatever definition is visible
> in the current scope.

I've verified that the appended patch makes it possible to compile an
i686-linux -> powerpc-darwin cross compiler (cc1, cc1plus, cc1obj) and
that it seems to do the right thing for this test case:

static int foo;
static int bar;
#pragma unused (foo)

void n()
{
        int bar;
#pragma unused (bar)
}

the only message printed by cc1 or cc1obj at -W -Wall -pedantic is

test.c:2: warning: `bar' defined but not used

(cc1plus does something different, but I'm not going to worry about
that now).  I'll check this in so Darwin can bootstrap again.  If it's
decided that #pragma unused shouldn't work on file-scope objects we
can put back the DECL_CONTEXT line.

zw

        * config/darwin-c.c (darwin_pragma_unused): Use lookup_name,
        not IDENTIFIER_LOCAL_VALUE.

===================================================================
Index: config/darwin-c.c
--- config/darwin-c.c	16 Dec 2002 18:20:08 -0000	1.4
+++ config/darwin-c.c	11 Apr 2003 18:04:50 -0000
@@ -136,7 +136,7 @@ darwin_pragma_unused (pfile)
       tok = c_lex (&decl);
       if (tok == CPP_NAME && decl)
 	{
-	  tree local = IDENTIFIER_LOCAL_VALUE (decl);
+	  tree local = lookup_name (decl);
 	  if (local && (TREE_CODE (local) == PARM_DECL
 			|| TREE_CODE (local) == VAR_DECL))
 	    TREE_USED (local) = 1;



More information about the Gcc-regression mailing list