[LLVMbugs] [Bug 18280] New: -Wformat does not warn for inlined functions

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Dec 19 03:23:45 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=18280

            Bug ID: 18280
           Summary: -Wformat does not warn for inlined functions
           Product: clang
           Version: 3.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicholas at nicholaswilson.me.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

When I give an inlined definition to a function, the warning about "non-literal
format string" goes away.

For example:

---
#include <stdarg.h>
#include <stdio.h>
const char* dummy();
class Test1 {
public:
  Test1(const char* fmt, ...)  __attribute__((format(printf,2,3)));
};
class Test2 {
public:
  Test2(const char* fmt, ...)  __attribute__((format(printf,2,3)))
  { va_list a; va_start(a, fmt); vprintf(fmt, a); va_end(a); }
};

void tester() {
  Test1 t1(dummy());
  Test2 t2(dummy());
}
---

This compiles with no warning for t2 on clang ("clang++ -c test.cpp"), but
produces warnings for both cases using GCC ("g++ -c test.cpp").

-- 
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/20131219/7b7c1920/attachment.html>


More information about the llvm-bugs mailing list