http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53905

             Bug #: 53905
           Summary: -Wformat-nonliteral gives false positives with
                    __attribute__((format(NSString,...)))
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: objc
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: naes...@gmail.com


iMac:hacking user$ gcc-fsf-4.7 --version
gcc-fsf-4.7 (GCC) 4.7.1
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

iMac:hacking user$ cat NSString_format_bug.
NSString_format_bug.m   NSString_format_bug.m~  NSString_format_bug.o
iMac:hacking user$ cat NSString_format_bug.m

#pragma GCC diagnostic error "-Wformat"
#pragma GCC diagnostic error "-Wformat-nonliteral"

@class NSString;

extern void NSLog(NSString *, ...) __attribute__((format(NSString, 1, 2)));

void foo ()
{
  NSLog(@"Hi!");
}
iMac:hacking user$ gcc-fsf-4.7 -c NSString_format_bug.m
NSString_format_bug.m: In function ‘foo’:
NSString_format_bug.m:11:3: error: format not a string literal and no format
arguments [-Werror=format-nonliteral]
cc1obj: some warnings being treated as errors

Reply via email to