gnustep-dev
[Top][All Lists]
Advanced

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

Re: problems compiling NSAnimation.m


From: Richard Frith-Macdonald
Subject: Re: problems compiling NSAnimation.m
Date: Thu, 10 May 2007 12:48:24 +0100


On 10 May 2007, at 12:35, Nicola Pero wrote:


On May 8, 2007, at 11:14 PM, Riccardo wrote:

Hi,

trying to compile NSAnimation on older compilers is a nightmare (like gcc 2.95). I fixed some trivial stuff, but then stopped: the main problem is the _NSANIMATION_LOCK macro. Since this macro defines a variable in it,

#define _NSANIMATION_LOCK           \
  BOOL __gs_isLocked = NO;          \
  if (_isThreaded)                  \
  {                                 \
    __gs_isLocked = YES;            \
    NSDebugFLLog(@"NSAnimationLock",\
                 @"%@ LOCK %@",self,[NSThread currentThread]);\
    [_isAnimatingLock lock];        \
  }


it causes a hidden "c99-ism" everywhere. If the definition of __gs_isLocked inside the macron can be avoided or the macroitself can be avoided, I think the code would be cleaner.


This looks pretty bad, not only because it doesn't compile with GCC 2.95, but also because that variable defined in the middle of nowhere is very ugly ... unclear scope (what happens if you have two _NSANIMATION_LOCK in sequence ? is the same variable being used or different variables ?) ... ;-)

I fixed this to make __gs_isLocked an ivar rather than declaring it locally (which was pretty suboptimal). I also fixed a bug in the unlock macro (it was setting the lag to the wrong value), and added assertions to check that the macro is not misused.

Is there a flag we can pass to ask GCC to refuse c99-isms ? There must be one.

Not that I know of ... and I did look for it once before.

  Shall we add this to the core library makefiles ?  That way we are
more positive that the code should compile with 2.95 because nobody will be able to commit c99-isms without breaking compilation with all versions
of GCC. :-)

I'd certainly like such a flag to be added if you can find one.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]