On 10/25/2017 9:06 AM, Jason Merrill wrote:
On Wed, Oct 25, 2017 at 7:20 AM, Nathan Sidwell <nat...@acm.org> wrote:
On 10/25/2017 12:03 AM, Mukesh Kapoor wrote:
Thanks for pointing this out. Checking in the front end will be difficult
because the front end gets tokens after macro expansion. I think the
difficulty of fixing this bug comes because of the requirement to maintain
backward compatibility with the option -Wliteral-suffix for -std=c++11.
IIUC the warning's intent is to catch cases of:
printf ("some format"PRIx64 ..., ...);
where there's no space between the string literals and the PRIx64 macro. I
suspect it's very common for there to be a following string-literal, so
perhaps the preprocessor could detect:
<string-literal>NON-FN-MACRO<maybe-space><string-literal>
and warn on that sequence?
Or perhaps we could limit the current behavior to when the macro
expands to a string literal?
To check this the macro will have to be expanded completely. A macro can
be defined using other macros. The header <inttypes.h> has the following
definition for PRId64:
# define __PRI64_PREFIX "l"
# define PRId64 __PRI64_PREFIX "d"
Mukesh
Jason