This is the mail archive of the
mailing list for the GCC project.
Re: Criteria for a warning to be in -Wall? (was: Re: a warning to implement)
- From: Robert Lipe <robertlipe at usa dot net>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 6 Feb 2002 18:31:28 -0600
- Subject: Re: Criteria for a warning to be in -Wall? (was: Re: a warning to implement)
- References: <20020207001204.27B8DF28BE@nile.gnat.com>
> <<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:
optimization_options (level, size)
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. */
if (level > 1)
flag_schedule_insns = 0;
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.