Fix for Apple?

View: New views
3 Messages — Rating Filter:   Alert me  

Fix for Apple?

by Laurent Michel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

As I port on the head revision of lightning, I did get a problem with this:

#ifdef __APPLE__
/* Stack must stay 16-byte aligned: */
# define jit_prepare_i(ni)      (((ni & 0x3) \
                                  ? SUBLir(4 * ((((ni) + 3) & ~(0x3)) - (ni)), JIT_SP) \
                                  : (void)0), \
                                 _jitl.argssize += (((ni) + 3) & ~(0x3)))

#define jit_allocai(n)                                          \
  jit_allocai_internal ((n), (_jitl.alloca_slack - (n)) & 15)

#else
# define jit_prepare_i(ni)      (_jitl.argssize += (ni))

#define jit_allocai(n)                                          \
  jit_allocai_internal ((n), 0)
#endif


It won't compile (with Apple's g++) on apple because of the (void)0  bit in the prepare_i macro.

I changed it to

#ifdef __APPLE__
/* Stack must stay 16-byte aligned: */
# define jit_prepare_i(ni)      (((ni & 0x3) \
                                  ? SUBLir(4 * ((((ni) + 3) & ~(0x3)) - (ni)), JIT_SP) \
                                  : (int)0), \
                                 _jitl.argssize += (((ni) + 3) & ~(0x3)))

#define jit_allocai(n)                                          \
  jit_allocai_internal ((n), (_jitl.alloca_slack - (n)) & 15)

#else
# define jit_prepare_i(ni)      (_jitl.argssize += (ni))

#define jit_allocai(n)                                          \
  jit_allocai_internal ((n), 0)
#endif


--
  Laurent






_______________________________________________
Lightning mailing list
Lightning@...
http://lists.gnu.org/mailman/listinfo/lightning

smime.p7s (5K) Download Attachment

Re: Fix for Apple?

by Paolo Bonzini-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> #ifdef __APPLE__
> /* Stack must stay 16-byte aligned: */
> # define jit_prepare_i(ni)      (((ni & 0x3) \
>                                   ? SUBLir(4 * ((((ni) + 3) & ~(0x3)) -
> (ni)), JIT_SP) \

I instead added a (void) in front of the SUBLir.

Paolo


_______________________________________________
Lightning mailing list
Lightning@...
http://lists.gnu.org/mailman/listinfo/lightning

Re: Fix for Apple?

by Laurent Michel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Jun 11, 2008, at 11:03 AM, Paolo Bonzini wrote:


#ifdef __APPLE__
/* Stack must stay 16-byte aligned: */
# define jit_prepare_i(ni)      (((ni & 0x3) \
                                 ? SUBLir(4 * ((((ni) + 3) & ~(0x3)) - (ni)), JIT_SP) \

I instead added a (void) in front of the SUBLir.

Paolo

I added that on my end (on top of your patch). It works fine now.


--
  Laurent






_______________________________________________
Lightning mailing list
Lightning@...
http://lists.gnu.org/mailman/listinfo/lightning

smime.p7s (5K) Download Attachment