[llvm-bugs] [Bug 27159] New: Clang ignores -Wno-format-extra-args

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 31 03:44:38 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27159

            Bug ID: 27159
           Summary: Clang ignores -Wno-format-extra-args
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: royger at freebsd.org
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160331/5fd10114/attachment.html>


More information about the llvm-bugs mailing list