<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Clang ignores -Wno-format-extra-args"
   href="https://llvm.org/bugs/show_bug.cgi?id=27159">27159</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang ignores -Wno-format-extra-args
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.8
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>royger@freebsd.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Clang 3.8 seems to ignore -Wno-format-extra-args, here is the result:

cc -isystem /usr/local/include -Wno-ignored-attributes -Qunused-arguments
-Wno-header-guard -Wno-tautological-compare -Wno-format-extra-args -isystem
/usr/local/include -fstack-protector -fno-strict-aliasing -O2
-fomit-frame-pointer -m64 -fno-strict-aliasing -std=gnu99 -Wall
-Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-local-typedefs  
-O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall
-Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-local-typedefs  
-D__XEN_TOOLS__ -MMD -MF .subdirs-install.d -D_LARGEFILE_SOURCE
-D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls  -O1 -fno-omit-frame-pointer
-m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes
-Wdeclaration-after-statement -Wno-unused-local-typedefs   -D__XEN_TOOLS__ -MMD
-MF .subdir-install-libxl.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-fno-optimize-sibling-calls  -O1 -fno-omit-frame-pointer -m64 -g
-fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes
-Wdeclaration-after-statement -Wno-unused-local-typedefs   -D__XEN_TOOLS__ -MMD
-MF .libxl_internal.o.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-fno-optimize-sibling-calls  -Werror -Wno-format-zero-length
-Wmissing-declarations -Wno-declaration-after-statement -Wformat-nonliteral -I.
-fPIC -pthread
-I/usr/ports/sysutils/xen-tools/work/xen-4.5.2/tools/libxl/../../tools/libxc/include
-I/usr/ports/sysutils/xen-tools/work/xen-4.5.2/tools/libxl/../../tools/include
-I/usr/ports/sysutils/xen-tools/work/xen-4.5.2/tools/libxl/../../tools/libxc/include
-I/usr/ports/sysutils/xen-tools/work/xen-4.5.2/tools/libxl/../../tools/include
-I/usr/ports/sysutils/xen-tools/work/xen-4.5.2/tools/libxl/../../tools/xenstore/include
-I/usr/ports/sysutils/xen-tools/work/xen-4.5.2/tools/libxl/../../tools/include 
 -Wshadow -include
/usr/ports/sysutils/xen-tools/work/xen-4.5.2/tools/libxl/../../tools/config.h 
-c -o libxl_internal.o libxl_internal.c
libxl_internal.c:25:54: error: data argument not used by format string
      [-Werror,-Wformat-extra-args]
    libxl__log(ctx, XTL_CRITICAL, ENOMEM, 0,0, func, L);
                                                     ^
libxl_internal.c:24:17: note: expanded from macro 'L'
          func, (unsigned long)nmemb, (unsigned long)size
                ^
libxl_internal.c:26:21: error: data argument not used by format string
      [-Werror,-Wformat-extra-args]
    fprintf(stderr, L);
                    ^
libxl_internal.c:24:17: note: expanded from macro 'L'
          func, (unsigned long)nmemb, (unsigned long)size
                ^
2 errors generated.
/usr/ports/sysutils/xen-tools/work/xen-4.5.2/tools/libxl/../../tools/Rules.mk:100:
recipe for target 'libxl_internal.o' failed
gmake[5]: *** [libxl_internal.o] Error 1
gmake[5]: *** Waiting for unfinished jobs....

The code in question is:

void libxl__alloc_failed(libxl_ctx *ctx, const char *func,
                         size_t nmemb, size_t size) {
#define M "libxl: FATAL ERROR: memory allocation failure"
#define L (size ? M " (%s, %lu x %lu)\n" : M " (%s)\n"), \
          func, (unsigned long)nmemb, (unsigned long)size
    libxl__log(ctx, XTL_CRITICAL, ENOMEM, 0,0, func, L);
    fprintf(stderr, L);
    fflush(stderr);
    _exit(-1);
#undef M
#undef L
}

Which of course has the issues reported by clang, but AFAICT
-Wno-format-extra-args should prevent those warnings from appearing.

Roger.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>