This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PR c/52952] More precise locations within format strings
- From: Manuel López-Ibáñez <lopezibanez at gmail dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: Andreas Schwab <schwab at suse dot de>, Gcc Patch List <gcc-patches at gcc dot gnu dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>, Dodji Seketeli <dodji at redhat dot com>, Jason Merrill <jason at redhat dot com>
- Date: Wed, 12 Nov 2014 16:04:57 +0100
- Subject: Re: [PR c/52952] More precise locations within format strings
- Authentication-results: sourceware.org; auth=none
- References: <CAESRpQCBPF9n7yHz=UJ9ykA+tPsR5d26JM_c_C-fW3=ByU0RyA at mail dot gmail dot com> <mvm1tp87azi dot fsf at hawking dot suse dot de> <CAESRpQCKSigAGOCvT2CAAnEzyELrbn2ZYnJ2tD-c30sPq2Zd+Q at mail dot gmail dot com> <20141112143843 dot GK29791 at redhat dot com> <CAESRpQDO8NVsXr0oHJQe5LEgP67iyx6nTXspiwrKyn9Vp4cN1g at mail dot gmail dot com>
On 12 November 2014 15:54, Manuel López-Ibáñez <lopezibanez@gmail.com> wrote:
> On 12 November 2014 15:38, Marek Polacek <polacek@redhat.com> wrote:
>> On Wed, Nov 12, 2014 at 03:35:06PM +0100, Manuel López-Ibáñez wrote:
>>> > ../../libcpp/line-map.c:667:65: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
>>>
>>> I just (r217418) bootstrapped this code and it did not produce this
>>> error (or warning). Could you give more details?
>>
>> Have you tried the bootstrap without checking enabled?
>
> Indeed, the error is due to linemap_assert definition. My patch just
> exposes the bug. This should fix it:
And I think GCC is wrong to wan here. The point of the Wempty-body
warning is to catch things like:
if(a);
return 2;
return 3;
However,
if(a)
;
return 2;
seems intentional. Clang++ does not warn on the latter and it prints
for the former:
warning: if statement has empty body [-Wempty-body]
if(a);
^
note: put the semicolon on a separate line to silence this warning
which seems a nice way to silence the warning instead of ugly { ; }
Cheers,
Manuel.