This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


> <<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


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