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.
Jesper Skov <jskov@redhat.com> writes:
> What we really need is some GCC attribute magic one can use to mark an
> argument (intentionally) unused. Maybe a project for a rainy Sunday...
The problem is that when used in macros, the argument isn't always an argument
:-) When it's an argument, the usual practice with gcc is just
void foo(int arg) {
(void)arg;
}
but it still produces memory access in the case (that we can get when we use
it in macros):
extern int volatile arg;
void foo(void) {
(void)arg;
}
Usually you mark external variables as unused in the function by don't using
them, so it seems too much to ask gcc to have some attribute magic for it :-)
Here is my bet:
#define CYG_UNUSED_PARAM(_type_, _var_) {if(0)(void)(var);}
but I'm afraid somebody else will find a case where this doesn't work anyway
:-( Note that in this definition 'type' is also unused, and thus must be
declared as such inside the macro. This is another interesting project for
a rainy Sunday, I believe :-)
Sergei.