KOBJMETHOD: use better construct in the checking version of the macro

Big thanks to Christoph Mallon for the idea/code!
This construct has benefit of sticking much stricter to C standard and thus
keeping more compilers happy as Clang doesn't like the current construct
because it doesn't treat FUNC != NULL as a compile-time constant.

The checking version is still under 'notyet'.

Pointed out by:	ed
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
Clang help by:	rdivacky
Reviewed by:	imp
Approved by:	jhb
This commit is contained in:
avg 2009-06-11 17:21:14 +00:00
parent 2ae00ba3ff
commit ae95fce66e

View File

@ -96,7 +96,7 @@ struct kobjop_desc {
#define KOBJMETHOD(NAME, FUNC) { &NAME##_desc, (kobjop_t) FUNC }
#else /* notyet */
#define KOBJMETHOD(NAME, FUNC) \
{ &NAME##_desc, (kobjop_t) (FUNC != (NAME##_t *)NULL ? FUNC : NULL) }
{ &NAME##_desc, (kobjop_t) (1 ? FUNC : (NAME##_t *)NULL) }
#endif
/*