You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Jernej Turnsek <je...@gmail.com> on 2022/09/27 10:37:10 UTC

New UNUSED macro not working

Hi,

when compiling LuaJIT on NuttX with new UNUSED macro I get following error:

LuaJIT/src/lj_frame.h:70:61: error: lvalue required as unary '&' operand
   70 | #define setframe_gc(f, p, tp) (setgcref((f)->fr.func, (p)),
UNUSED(tp))

What was the reason to change UNUSED macro from:

#  define UNUSED(a) ((void)(1 || (a)))

to

#  define UNUSED(a) ((void)(1 || &(a)))

Thanks,
Jernej

Re: New UNUSED macro not working

Posted by TimH <Ti...@jti.uk.com.INVALID>.
I would think that your variable (a) does not meet the requirement of the & operator (The operand of the address-of operator can be either a function designator or an l-value that designates an object that is not a bit field and is not declared with the register storage-class specifier.)

If so the fix that was pushed is not a full and final fix, although it extends - but also changes - the scope of the macro.

Regards,

Tim.

> On 27 Sep 2022, at 18:19, Jernej Turnsek <je...@gmail.com> wrote:
> 
> Hi Alan,
> 
> I understand that it should support more variables, but the fact is that
> the code, which used to compile, doesn't anymore.
> 
> Maybe others will have the same problem, when porting from Linux to NuttX?
> 
> Jernej
> 
>> On Tue, Sep 27, 2022 at 2:55 PM Alan C. Assis <ac...@gmail.com> wrote:
>> 
>> Hi Jernej,
>> 
>> There is a discussion about it here:
>> 
>> https://github.com/apache/incubator-nuttx/pull/6779
>> 
>> The issue with previous implementation was it only worked for integers
>> variable.
>> 
>> BR,
>> 
>> Alan
>> 
>>> On 9/27/22, Jernej Turnsek <je...@gmail.com> wrote:
>>> Hi,
>>> 
>>> when compiling LuaJIT on NuttX with new UNUSED macro I get following
>> error:
>>> 
>>> LuaJIT/src/lj_frame.h:70:61: error: lvalue required as unary '&' operand
>>>   70 | #define setframe_gc(f, p, tp) (setgcref((f)->fr.func, (p)),
>>> UNUSED(tp))
>>> 
>>> What was the reason to change UNUSED macro from:
>>> 
>>> #  define UNUSED(a) ((void)(1 || (a)))
>>> 
>>> to
>>> 
>>> #  define UNUSED(a) ((void)(1 || &(a)))
>>> 
>>> Thanks,
>>> Jernej
>>> 
>> 

Re: New UNUSED macro not working

Posted by Jernej Turnsek <je...@gmail.com>.
Hi Alan,

I understand that it should support more variables, but the fact is that
the code, which used to compile, doesn't anymore.

Maybe others will have the same problem, when porting from Linux to NuttX?

Jernej

On Tue, Sep 27, 2022 at 2:55 PM Alan C. Assis <ac...@gmail.com> wrote:

> Hi Jernej,
>
> There is a discussion about it here:
>
> https://github.com/apache/incubator-nuttx/pull/6779
>
> The issue with previous implementation was it only worked for integers
> variable.
>
> BR,
>
> Alan
>
> On 9/27/22, Jernej Turnsek <je...@gmail.com> wrote:
> > Hi,
> >
> > when compiling LuaJIT on NuttX with new UNUSED macro I get following
> error:
> >
> > LuaJIT/src/lj_frame.h:70:61: error: lvalue required as unary '&' operand
> >    70 | #define setframe_gc(f, p, tp) (setgcref((f)->fr.func, (p)),
> > UNUSED(tp))
> >
> > What was the reason to change UNUSED macro from:
> >
> > #  define UNUSED(a) ((void)(1 || (a)))
> >
> > to
> >
> > #  define UNUSED(a) ((void)(1 || &(a)))
> >
> > Thanks,
> > Jernej
> >
>

Re: New UNUSED macro not working

Posted by "Alan C. Assis" <ac...@gmail.com>.
Hi Jernej,

There is a discussion about it here:

https://github.com/apache/incubator-nuttx/pull/6779

The issue with previous implementation was it only worked for integers variable.

BR,

Alan

On 9/27/22, Jernej Turnsek <je...@gmail.com> wrote:
> Hi,
>
> when compiling LuaJIT on NuttX with new UNUSED macro I get following error:
>
> LuaJIT/src/lj_frame.h:70:61: error: lvalue required as unary '&' operand
>    70 | #define setframe_gc(f, p, tp) (setgcref((f)->fr.func, (p)),
> UNUSED(tp))
>
> What was the reason to change UNUSED macro from:
>
> #  define UNUSED(a) ((void)(1 || (a)))
>
> to
>
> #  define UNUSED(a) ((void)(1 || &(a)))
>
> Thanks,
> Jernej
>