This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Please, take '-Wmisleading-indentation' out of -Wall
- From: Andrew Haley <aph at redhat dot com>
- To: Antonio Diaz Diaz <antonio at gnu dot org>, gcc at gcc dot gnu dot org
- Date: Fri, 6 May 2016 13:25:20 +0100
- Subject: Re: Please, take '-Wmisleading-indentation' out of -Wall
- Authentication-results: sourceware.org; auth=none
- References: <572A2029 dot 6030106 at gnu dot org> <1462386029 dot 14738 dot 43 dot camel at redhat dot com> <572A4F0A dot 2070304 at gmail dot com> <572B9764 dot 8050008 at gnu dot org>
On 05/05/2016 07:56 PM, Antonio Diaz Diaz wrote:
> Take this example http://gcc.gnu.org/ml/gcc-patches/2016-03/msg00261.html
>
> The user sees this:
>
> if (flagA) // GUARD
> foo (0); // BODY
> #if SOME_CONDITION_THAT_DOES_NOT_HOLD
> if (flagB)
> #endif
> foo (1); // NEXT
Surely this misleading code is exactly what we should be warning about.
It could be like this, and far less misleadingly:
if (flagA) // GUARD
foo (0); // BODY
#if SOME_CONDITION_THAT_DOES_NOT_HOLD
if (flagB)
#endif
{
foo (1); // NEXT
}
Better for the reader, nothing to warn about.
Andrew.