Subject: Re: pkg/27216: devel/anjuta doesn"t compile (and some others pkg like devel/exctags)
To: None <zul@epiknet.org, pkgsrc-bugs@netbsd.org>
From: Martijn van Buul <pino@dohd.org>
List: pkgsrc-bugs
Date: 10/11/2004 10:53:09
In netbsd.pkgsrc.bugs, you wrote:

> anjuta failed to compile exiting with the following error :
>
> gcc -DHAVE_CONFIG_H -I. -I. -I.. -I./include -I/usr/pkg/include/glib/glib-2.0 -I/usr/pkg/lib/glib-2.0/include    -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2  -O2 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2 -c args.c
> In file included from /usr/include/machine/endian.h:3,
>                  from /usr/include/sys/types.h:98,
>                  from /usr/include/stdlib.h:41,
>                  from vstring.h:18,
>                  from entry.h:20,
>                  from debug.h:20,
>                  from args.c:21:
> /usr/include/sys/endian.h:179: error: parse error before "__attribute__"
> /usr/include/sys/endian.h:184: error: `u' undeclared here (not in a function)
> /usr/include/sys/endian.h:185: error: conflicting types for `p'

*snip*

> I have seen the same problem in excflags compilation

That's probably because anjuta seems to have assimilated exctags ;)

I know a workaround - I haven't come around to send-PR'ing it, because 
I'm not really sure what needs to be fixed (/usr/include/sys/cdefs.h or
the packages..), but newer versions of cdefs.h (at least 1.57 has it)
seem to do the same thing as debug.h from anjuta / exctags does: #defining
a macro for __attribute__((__unused__)).

cdefs.h uses a #define __unused		__attribute__((__unused__))

while exctags uses

#define __unused__	__attribute__((__unused__))

The problem is that anjuta/exctags uses "__unused__" as a macro name -
a rather silly thing to do, if you ask me -, and cdefs.h / edian.h is included 
*after* this #define, making the macro in endian.h expand to

__attribute__((__attribute__((__unused__))))

And that ain't going to work. 

A dirty workaround would be to replace line #31 of general.h (both exctags
as well as anjuta (in tagmanager/) ) with something like

#include <sys/cdefs.h>
#define __unused__ __unused

Which is just as dirty, but at least it works. A better way would be to
rename those __unused__ occurrances to something that doesn't case a name
clash.

-- 
    Martijn van Buul -  Pienjo@c64.org - http://www.stack.nl/~martijnb/
	 Geek code: G--  - Visit OuterSpace: mud.stack.nl 3333
 The most exciting phrase to hear in science, the one that heralds new
discoveries, is not 'Eureka!' (I found it!) but 'That's funny ...' Isaac Asimov