NoobOverflow
NoobOverflow

Reputation: 1288

"-Weverything" puts a "Varargs argument missing, but tolerated as an extension" warning at each NSAssert

After I added the new -Weverything to Clang's other warning flags, I started getting this warning for all of my NSAsserts:

Varargs argument missing, but tolerated as an extension

How can I fix this or, alternatively, suppress this warning?

Upvotes: 3

Views: 729

Answers (1)

Lily Ballard
Lily Ballard

Reputation: 185691

If you really want to avoid this warning, stick a nil as an extra argument. It appears that -Wpedantic doesn't like having a varargs argument with no value, so if you have NSAssert(condition, @"static string") you're not providing an argument for the varargs spot (NSAssert looks like NSAssert(condition, format, ...)). By sticking nil on the end you're providing a value for the varargs argument but there's no cost to it.

Upvotes: 8

Related Questions