Taming Snow leopard: Format not a string literal and format arguments

I am porting MacTrek to OS X 10.6 native (from 10.4) and i got the “Format not a string literal and format arguments” error a couple of hundred times.

Source of the problem is:

#define LLLog if([[NSUserDefaults standardUserDefaults]boolForKey:@"LLLogDisabled"]!=YES)NSLog

Apparently NSLog now expects a formatted string and not a regular string.

If you want get rid of the warning “format not a string literal and no format arguments” once and for all, you can disable the GCC warning setting “Typecheck Calls to printf/scanf” (GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = NO) in your target’s build settings.

or go for changing stuff like:

LLLog([NSString stringWithFormat: @"JTrekController.appendOutput %@", output]);

into:

LLLog(@"JTrekController.appendOutput %@", output);

Advertisements
Tagged with: ,
Posted in Code
One comment on “Taming Snow leopard: Format not a string literal and format arguments
  1. […] Taming Snow leopard: Format not a string literal and format arguments January 2010 3 […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories
%d bloggers like this: