This is the mail archive of the ecos-discuss@sourceware.cygnus.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: CYG_INSTRUMENT_CLOCK+PowerPC+FPU problem.



>The problem is that when either _arg1_ or _arg2_ are volatile, the
>CYG_UNUSED_PARAM leaves reference to the argument. I mean gcc still put
>instruction(s) that fetch the value of the argument, because volatile
>specification prevents it from just ignoring the code. Consider:
>
>int volatile iv;
>void foo(void) {
>  CYG_UNUSED_PARAM(int, iv);
>}
>
>This produces the following code for 'foo':
>
>void foo(void) {
>  int tmp1 = iv;
>  int tmp2 = tmp1;
>  tmp1 = tmp2;
>}
>
>and gcc will produce load (or address access) instruction for 'tmp1 = iv'
>statement.


I just had an idea. Maybe we could change the CYG_UNUSED_PARAM to:

#define CYG_UNUSED_PARAM(_type_, _var_) \
    if (0) { if ((_var_) == (_var_)); }

That would always work without any overhead, wouldn't it?

Jesper

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]