C/C++ PATCH to implement -Wmultiline-expansion (PR c/80116)

Pedro Alves palves@redhat.com
Wed Jun 7 19:02:00 GMT 2017


Hi Marek,

Nice warning!  Just to confirm, would the patch warn with code like:

 const char *
 target_xfer_status_to_string (enum target_xfer_status status)
 {
#define CASE(X) case X: return #X
   switch (status)
     {
       CASE(TARGET_XFER_E_IO);
       CASE(TARGET_XFER_UNAVAILABLE);
     default:
       return "<unknown>";
     }
#undef CASE
 };

?

I think it shouldn't, but I couldn't tell from the tests,
and the only similar instance I found in gcc is guarded
behind an #ifdef (in eh_data_format_name).

Thanks,
Pedro Alves



More information about the Gcc-patches mailing list