Discussion:
[Bug-apl] Misleading indentation
Kacper Gutowski
2017-05-06 10:24:40 UTC
Permalink
Attempting to compile r941 with g++ 6.3.0 fails due to it not liking
your coding style and -Werror:

Command.cc: In static member function ‘static bool Command::check_params(std::ostream&, const char*, int, const char*)’:
Command.cc:163:20: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
case '.': if (a[1] == '.' && a[2] == '.')
^~
Command.cc:164:56: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
many = true; continue; // ...
^~~~~~~~

-k
Juergen Sauermann
2017-05-06 15:12:10 UTC
Permalink
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font face="Helvetica, Arial, sans-serif">Hi Kacper,<br>
<br>
thanks, maybe fixed in <b>SVN 942</b>. No idea what the compiler
means, though.<br>
<br>
Maybe I should respond with </font><b>-Werror=misleading-warning</b><b>-since-g++6.x</b><br>
<br>
/// Jürgen<br>
<br>
 <br>
<div class="moz-cite-prefix">On 05/06/2017 12:24 PM, Kacper Gutowski
wrote:<br>
</div>
<blockquote cite="mid:***@gmail.com"
type="cite">
<pre wrap="">Attempting to compile r941 with g++ 6.3.0 fails due to it not liking
your coding style and -Werror:

Command.cc: In static member function ‘static bool Command::check_params(std::ostream&amp;, const char*, int, const char*)’:
Command.cc:163:20: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
case '.': if (a[1] == '.' &amp;&amp; a[2] == '.')
^~
Command.cc:164:56: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
many = true; continue; // ...
^~~~~~~~

-k


</pre>
</blockquote>
<br>
</body>
</html>
Kacper Gutowski
2017-05-07 02:24:46 UTC
Permalink
thanks, maybe fixed in SVN 942. No idea what the compiler means, though.
Maybe I should respond with -Werror=misleading-warning-since-g++6.x
Yes, that fixed it.
That's what you get when compiler tries to be a linter at the same time.
I believe this particular warning was supposed to catch "goto fail"-style bugs.

-k
Leslie S Satenstein
2017-05-07 04:07:18 UTC
Permalink
GCC 7 puts out a warning if the line following an if () is at the same or greater indentation than the consequence of the if()
It is done when the if () does not have arguments within { }I too solved that issue.
 Regards
 Leslie
Leslie Satenstein
Montréal Québec, Canada



From: Juergen Sauermann <***@t-online.de>
To: Kacper Gutowski <***@gmail.com>; bug-***@gnu.org
Sent: Saturday, May 6, 2017 11:12 AM
Subject: Re: [Bug-apl] Misleading indentation

Hi Kacper,

thanks, maybe fixed in SVN 942. No idea what the compiler means, though.

Maybe I should respond with -Werror=misleading-warning-since-g++6.x

/// JÃŒrgen

 
On 05/06/2017 12:24 PM, Kacper Gutowski wrote:

Attempting to compile r941 with g++ 6.3.0 fails due to it not liking
your coding style and -Werror:

Command.cc: In static member function ‘static bool Command::check_params(std::ostream&, const char*, int, const char*)’:
Command.cc:163:20: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
case '.': if (a[1] == '.' && a[2] == '.')
^~
Command.cc:164:56: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
many = true; continue; // ...
^~~~~~~~

-k

Continue reading on narkive:
Loading...