From 4b6e0bb9523efe00100311f94f44cfd9faa633c1 Mon Sep 17 00:00:00 2001 From: "mark@chromium.org" Date: Tue, 5 Nov 2013 16:53:55 +0000 Subject: [PATCH] NSLocalizedString compatibility (10.8 SDK and clang trunk -Wformat-extra-args) Apparently, as of the 10.8 SDK, Apple has quietly decided that the first argument to NSLocalizedString is supposed to be usable as-is as a format string, instead of simply being the key to obtain a usable format string. The recent clang trunk enforces this, resulting in build breaks like crash_report_sender.m:560:14: error: data argument not used by format string [-Werror,-Wformat-extra-args] displayName]; ^ Breaking the result of NSLocalizedString into a temporary NSString* is enough to suppress the warning. BUG=chromium:314109 R=thakis@chromium.org Review URL: https://breakpad.appspot.com/674003 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1230 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/client/mac/sender/crash_report_sender.m | 24 ++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/client/mac/sender/crash_report_sender.m b/src/client/mac/sender/crash_report_sender.m index 37eb255e..88d26fb0 100644 --- a/src/client/mac/sender/crash_report_sender.m +++ b/src/client/mac/sender/crash_report_sender.m @@ -555,13 +555,13 @@ doCommandBySelector:(SEL)commandSelector { displayName = [[uploader_ parameters] objectForKey:@BREAKPAD_PRODUCT]; if ([self isOnDemand]) { - return [NSString - stringWithFormat:NSLocalizedString(@"noCrashDialogHeader", @""), - displayName]; + // Local variable to pacify clang's -Wformat-extra-args. + NSString* format = NSLocalizedString(@"noCrashDialogHeader", @""); + return [NSString stringWithFormat:format, displayName]; } else { - return [NSString - stringWithFormat:NSLocalizedString(@"crashDialogHeader", @""), - displayName]; + // Local variable to pacify clang's -Wformat-extra-args. + NSString* format = NSLocalizedString(@"crashDialogHeader", @""); + return [NSString stringWithFormat:format, displayName]; } } @@ -576,13 +576,13 @@ doCommandBySelector:(SEL)commandSelector { vendor = @"unknown vendor"; if ([self isOnDemand]) { - return [NSString - stringWithFormat:NSLocalizedString(@"noCrashDialogMsg", @""), - vendor, displayName]; + // Local variable to pacify clang's -Wformat-extra-args. + NSString* format = NSLocalizedString(@"noCrashDialogMsg", @""); + return [NSString stringWithFormat:format, vendor, displayName]; } else { - return [NSString - stringWithFormat:NSLocalizedString(@"crashDialogMsg", @""), - vendor]; + // Local variable to pacify clang's -Wformat-extra-args. + NSString* format = NSLocalizedString(@"crashDialogMsg", @""); + return [NSString stringWithFormat:format, vendor]; } }