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

            Bug ID: 100729
           Summary: Inconsistency in -Wformat-extra-args when
                    first-to-check is 0 and format string is NULL
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wellnhofer at aevum dot de
  Target Milestone: ---

This doesn't generate a warning:

----------------------------------------------

#include <stddef.h>

__attribute__ ((format(printf, 1, 0)))
void format(const char *fmt);

void test(void) {
    format(NULL);
}

----------------------------------------------

But simply appending another parameter does:

----------------------------------------------

#include <stddef.h>

__attribute__ ((format(printf, 1, 0)))
void format(const char *fmt, int extra);

void test(void) {
    format(NULL, 0);
}

----------------------------------------------

I have no idea whether NULL format strings should generate a warning when
first-to-check is 0, but extra parameters should not change the behavior.

Reply via email to