This is the mail archive of the
ecos-discuss@sourceware.cygnus.com
mailing list for the eCos project.
Re: CYG_INSTRUMENT_CLOCK+PowerPC+FPU problem.
- to: ecos-discuss at sourceware dot cygnus dot com
- Subject: Re: [ECOS] CYG_INSTRUMENT_CLOCK+PowerPC+FPU problem.
- From: Jesper Skov <jskov at redhat dot com>
- Date: 16 May 2000 08:48:54 +0200
- References: <87vh0vu9z4.fsf@osv.javad.ru>
>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