Criteria for a warning to be in -Wall? (was: Re: a warning to implement)

Robert Lipe robertlipe@usa.net
Wed Feb 6 16:36:00 GMT 2002


> <<I'd have a strong preference for something that doesn't rely on GCC
> extension.   __attribute((unused)) is just as icky in a portable project
> as magic /* ARGSUNUSED */ comments recognized by others.
> >>
> 
> Sure, that's understandable, but using
> 
>  int a = a;
> 
> on the grounds that, even though there is no guarantee, it just happens
> to work, is to me the antithesis of writing clean portable code!

I hear you and it annoys me, too.

So show us another alternative to shut up the warning with zero runtime
cost that is still portable code.  Let's start with an example in our
own back yard:

void
optimization_options (level, size)
     int level;
     int size ATTRIBUTE_UNUSED;
{
  /* For -O2 and beyond, turn off -fschedule-insns by default.  It tends to
     make the problem with not enough registers even worse.  */
#ifdef INSN_SCHEDULING
  if (level > 1)
    flag_schedule_insns = 0;
#endif
}

I find the ATTRIBUTE_UNUSED more unsightly than a 'size = size' in there
becuase it requires extra effort to make it go away on gcc-not.

RJL



More information about the Gcc mailing list