This is the mail archive of the gcc-bugs@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]

[Bug c/52952] Wformat location info is bad (wrong column number)


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952

Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #27466|0                           |1
        is obsolete|                            |

--- Comment #30 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> ---
Created attachment 33647
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33647&action=edit
create locations from loc + offset

This variant works for simple strings. However, it cannot handle even simple
macros:

format.c:1:18: warning: format â%dâ expects a matching âintâ argument
[-Wformat=]
 #define FORMAT "%d"
                  ^
format.c:8:24: warning: format â%dâ expects a matching âintâ argument
[-Wformat=]
    __builtin_printf("a" FORMAT);
                        ^

whereas Clang can:

format.c:7:20: warning: more '%' conversions than data arguments [-Wformat]
  __builtin_printf(FORMAT);
                   ^
format.c:1:18: note: expanded from macro 'FORMAT'
#define FORMAT "%d"
                ~^
format.c:8:25: warning: more '%' conversions than data arguments [-Wformat]
   __builtin_printf("a" FORMAT);
                        ^
format.c:1:18: note: expanded from macro 'FORMAT'
#define FORMAT "%d"
                ~^

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