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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to