[LLVMbugs] [Bug 6697] New: format attribute not respected in printf warning
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Mar 24 15:31:17 PDT 2010
http://llvm.org/bugs/show_bug.cgi?id=6697
Summary: format attribute not respected in printf warning
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: Driver
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: ori at avtalion.name
CC: llvmbugs at cs.uiuc.edu
Compiling the following code:
#include <stdio.h>
#include <stdarg.h>
void myprintf(const char *format, int x, ...) __attribute__((__format__(printf,
1, 3)));
void myprintf(const char *format, int x, ...) {
va_list args;
va_start(args, x);
vprintf(format, args);
va_end(args);
}
int main() {
myprintf("%s\n", 1, "foo");
return 0;
}
Yields the warning:
format.c:13:13: warning: conversion specifies type 'char *' but the argument
has type 'int' [-Wformat]
myprintf("%s\n", 1, "foo");
~^ ~
However, the __format__ attribute clearly states that the varargs begin at 3,
not 2.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list