Subject: Re: cross compile on solaris fails using SunStudio Compiler
To: None <current-users@netbsd.org>
From: Kurt Schreiner <ks@ub.uni-mainz.de>
List: current-users
Date: 09/06/2006 11:27:45
On Tue, Sep 05, 2006 at 10:30:21PM +0200, Alan Barrett wrote:
> On Tue, 05 Sep 2006, David Laight wrote:
> > IIRC __inline is a gcc-ism, because 'inline' was a valid user variable name
> > before being added to C (posibly via C++) in C99.
> > Possibly _inline is valid, in any case a simple #define will suffice.
> > 
> > The  '__attribute__ ((unused))' is definitely a gcc-ism.
> > One of the NetBSD header files (maybe sys/cdefs.h) might contain something
> > that should be used instead of '__attribute__ ((unused))' so that it
> > can be #defined to the appropraite string (if any) for the compiler.
> 
> src/sys/sys/cdefs.h already defines both __inline and __attribute__(foo)
> to the empty string if it thinks that the compiler won't like them.  I
> don't know what's going wrong with the compiler detection, or perhaps
> the wrong <sys/cdefs.h> is being used.
Hm, looking at cc -E output I can see sys/cdefs.h beeing used:

[...]
# 1 "/u/NetBSD/arch/i386/obj/tools/compat/include/sys/cdefs.h"
[...]

BUT: This file is empty!

ls -l /u/NetBSD/arch/i386/obj/tools/compat/include/sys/cdefs.h
-rw-r-----   1 ks       nbstaff        0 Sep  5 16:29 /u/NetBSD/arch/i386/obj/tools/compat/include/sys/cdefs.h
 
HM! Is this ok so?

Anyway, as sys/cdefs.h is empty, there is no preprocessor "magic"
to #define __inline away...
Hm, but '__attribute__ ((unused))' is reduced to '' in cc -E output:

[...]
static __inline int isonum_711(u_char *) ;
static __inline int isonum_712(char *) ;
[...]

Couldn't find a #define for this in the #include-d header files,
seems sun cc (the preprocessor) "knows" __attribute__(foobar)?!

The cheap trick would be to just #define __inline /*nothing*/
in src/usr.sbin/makefs/cd9660.c somewhere but what would be
TRT(C) to do in this case? 

Kurt