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 15:54:45 +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>
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:
Index: line-map.h
===================================================================
--- line-map.h (revision 217418)
+++ line-map.h (working copy)
@@ -584,11 +584,12 @@ bool linemap_location_from_macro_expansi
the replacement-list of a macro expansion. */
#define linemap_check_ordinary(LINE_MAP) __extension__ \
({linemap_assert (!linemap_macro_expansion_map_p (LINE_MAP)); \
(LINE_MAP);})
#else
-#define linemap_assert(EXPR)
+/* Include EXPR, so that unused variable warnings do not occur. */
+#define linemap_assert(EXPR) ((void)(0 && (EXPR)))
#define linemap_check_ordinary(LINE_MAP) (LINE_MAP)
#endif
/* Encode and return a source_location from a column number. The
source line considered is the last source line used to call
(It really sucks that libcpp and by extension line-map cannot use gcc
code: gcc_checking_assert was already correct. What a boring
duplicated effort!)
I can commit the above as obvious tonite (if no one else takes care of
fixing it before me).
Cheers,
Manuel.