Discussion:
Annoying gcc warnings on MacOSX 10.6
Andreas Höschler
2011-08-17 13:19:30 UTC
Permalink
Hi all,

when building code like

NSString *message = ...
[NSException raise:NSInternalInconsistencyException format:message];

on MacOSX 10.6, gcc give sthe following warning

SOEditingContext.m:3574: warning: format not a string literal and no format arguments

Any idea how to get rid of these warnings?

Thanks a lot,

Andreas
Gary L. Wade
2011-08-17 14:17:41 UTC
Permalink
Read the documentation for NSException and follow it.

- Gary L. Wade (Sent from my iPhone)
Post by Andreas Höschler
Hi all,
when building code like
NSString *message = ...
[NSException raise:NSInternalInconsistencyException format:message];
on MacOSX 10.6, gcc give sthe following warning
SOEditingContext.m:3574: warning: format not a string literal and no format arguments
Any idea how to get rid of these warnings?
Thanks a lot,
Andreas
Andreas Höschler
2011-08-17 14:25:48 UTC
Permalink
Hi Gary,
Post by Gary L. Wade
Read the documentation for NSException and follow it.
Got it!

Regards,

Andreas
Christiaan Hofman
2011-08-17 16:53:13 UTC
Permalink
Post by Andreas Höschler
Hi all,
when building code like
NSString *message = ...
[NSException raise:NSInternalInconsistencyException format:message];
on MacOSX 10.6, gcc give sthe following warning
SOEditingContext.m:3574: warning: format not a string literal and no format arguments
Any idea how to get rid of these warnings?
Thanks a lot,
Andreas
[NSException raise:NSInternalInconsistencyException format:@"%@", message];

The "message" can contains %-characters which will lead to (further) exceptions/crashes. You may know that it doesn't, but that's not relevant, the point is that the compiler doesn't know and you may include them by mistake.

Christiaan

Loading...