[Buildroot] Qtopia4 Failure

Thiago A. Corrêa thiago.correa at gmail.com
Mon Sep 24 01:41:24 UTC 2007


Sure. There are all sort of valid code that a define breaks:

class MyClass
{
    MyClass() : index( 0 )
    {}
};

class MyOtherClass
{
    int index() const { return 0; }
}


A define claims the name index as if it were a keyword. It is a well
known issue.

How about change it to a function that wrapps the strchr()?
According to this:
http://www.opengroup.org/onlinepubs/000095399/functions/index.html
it used to be a function anyway.

At least it would give the compiler a chance to figure out by the scope.

One other good solution would be to patch mplayer not to use this define.


On 9/24/07, Adam Hawes <adam at infocab.com.au> wrote:
> On Mon, 2007-09-24 at 01:56 +0100, Thiago A. Corrêa wrote:
> > shouldn't you patch uClib instead? Claiming index with a define is
> > really stupid on the part of the library. Others, including myself use
> > index as variable names quite often.
>
> Do you use index()?  The macro accepts 2 arguments and the pre-processor
> only seems to baulk when you use a function or method called index(...).
> Variable names appear unproblematic.
>
> Fixing uClibc would be the sensible thing to do, and uClibc actually has
> a configuration option to turn off the legacy macros.  Turning them off,
> however, breaks compatibility with a few things (mplayer was the most
> recent one I found that wouldn't build with SUSv3 macros disabled).
>
> I found it easier to patch Qtopia because it was the only thing that
> didn't like the macros that I have found thus far.
>
> So please keep in mind that there is not one universal solution - there
> are a few options depending on the needs.  My patch fixes Qtopia for
> those people who need the SUSv3 legacy macros in other places.  For
> everyone else there's the configuration option of the library!
>
> Regards,
> A
>
>
>



More information about the buildroot mailing list