NSAssert/NSCAssert with NS_BLOCK_ASSERTIONS defined emits warning when assert has no variadic parameters

Originator:greg
Number:rdar://22384053 Date Originated:21-Aug-2015 04:11 PM
Status:Open Resolved:
Product:iOS SDK Product Version:Xcode-beta (7A176x)
Classification:Other Bug Reproducible:Always
 
Summary:
With preprocessor definition DNS_BLOCK_ASSERTIONS, NSAssert and NSCAssert emit a warning 
"Must specify at least one argument for '...' parameter of variadic macro" when not specifying a printf-style argument.

Steps to Reproduce:
NSAssert(NO, @"This is an assert without printf args");

Compile with -DNS_BLOCK_ASSERTIONS=1

Expected Results:
No warning.

Actual Results:
Warning: Must specify at least one argument for '...' parameter of variadic macro.

Regression:
Also exists in iOS 8.

Notes:
Probably just need to change lines 134-136 of Foundation/NSException.h to something like the following, to match the style used for when NS_BLOCK_ASSERTIONS is not defined:

#if !defined(_NSAssertBody)
#define NSAssert(condition, desc, ...)	\
    do {				\
	__PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \
        __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS \
    } while(0)
#endif

...similarly for NSCAssert.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!