[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-bugs
Subject:    [LLVMbugs] [Bug 15114] New: Format attribute should not require variadic function
From:       bugzilla-daemon () llvm ! org
Date:       2013-01-29 20:33:00
Message-ID: bug-15114-206 () http ! llvm ! org/bugs/
[Download RAW message or body]

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

             Bug #: 15114
           Summary: Format attribute should not require variadic function
           Product: clang
           Version: 3.2
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs@nondot.org
        ReportedBy: msharov@users.sourceforge.net
                CC: dgregor@apple.com, llvmbugs@cs.uiuc.edu
    Classification: Unclassified


clang makes it impossible to write a template printf wrapper without a warning:

template <typename... T>
inline void LogError (const char* fmt, T... args)
{ printf (fmt, args...); }

Produces the -Wformat-security error, "fmt is not a string literal". With gcc
it is possible to declare such a function with
__attribute__((__format__(printf,1,2))). clang complains that this attribute
requires a variadic function. Using (printf,1,0) is allowed, but still produces
the security error.

This example uses a variadic template, but simple wrappers with a fixed number
of arguments should also be possible to tag with the format attribute.

-- 
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.
_______________________________________________
LLVMbugs mailing list
LLVMbugs@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic