discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gcc warnings


From: David Chisnall
Subject: Re: gcc warnings
Date: Wed, 17 Aug 2011 14:28:50 +0100

On 17 Aug 2011, at 14:22, Andreas Höschler wrote:

> Hi all,
> 
> I am cross-building on GNUstep/Solaris and MacOSX. When I build code like 
> 
>     NSString *message = @"some string"
>     [NSException raise:NSInternalInconsistencyException format:message];
> 
> on MacOSX 10.6 using GNUstep make, gcc gives the following warning
> 
>       SOEditingContext.m:3574: warning: format not a string literal and no 
> format arguments

Any vaguely-recent compiler will give you the same warning.

> Any idea how to get rid of that one?

Yes, use a constant string, not a variable, for the format string.  Here, you 
are assigning the constant string to a variable and then passing it as the 
format string.  The compiler can not tell at this point that the string is 
constant (it can only tell that after doing data-flow analysis, which doesn't 
happen until much later).

David


reply via email to

[Prev in Thread] Current Thread [Next in Thread]