Search Linux Wireless

Re: [stable] Failed Build of modules for 2.6.27.9-159

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 20, 2009 at 2:08 PM, Kyle McMartin <kyle@xxxxxxxxxxxxx> wrote:
> On Tue, Jan 20, 2009 at 01:16:30PM -0800, Luis R. Rodriguez wrote:
>> As Michael pointed out -- its tough, in fact I am not sure how to do this with
>> static inlines. Advice on how to do this is welcomed. I have no clue.
>>
>
> In this case, where a header will be providing a static inline, and you
> need to provide a stub function, and you're unable to test on a typedef,
> you'll have to use a weak function.
>
> kyle@phobos ~ $ cat foo.c
> #include "bar.h"
> #include "compat.h"
>
> int main(void) {
>        int a = 0;
>
>        a = foo(a);
>
>        return a;
> }
>
> kyle@phobos ~ $ cat compat.h
> int __attribute__((weak)) foo(int x);
>
> kyle@phobos ~ $ cat bar.h
> static inline int foo(int a) {
>        return a;
> }
>
> kyle@phobos ~ $ cat compat.c
> int __attribute__((weak)) foo(int a)
> {
>        return a+1;
> }
>
> kyle@phobos ~ $ gcc -Wall -O2 -o foo foo.c compat.c
> kyle@phobos ~ $ ./foo
> kyle@phobos ~ $ echo $?
> 0
>
> Seems to work ok and not whinge about the double definition.

Thanks Kyle, that's pretty neat, unfortunately my compat.c includes
compat.h and since compat.h includes pci.h the compiler nags about the
double header redefinition of foo() where pci.h already has that
present (on those systems only). Essentially I'd need a way for
systems without foo() to define the header line and for systems that
already have it to not add the line. Know any trick for that?

Any particular strong reason to add that pci inline onto FC10 headers?

  Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux