This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PR c/52952] More precise locations within format strings


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]