warning: if statement has empty body

Clang is giving bogus warning for the following case. Taken from opencflite.

CFBag.c:946:92: warning: if statement has empty body
    if (CFDictionary || CFSet) CF_OBJC_FUNCDISPATCH0(__kCFHashTypeID, CFIndex, hc, "count");
                                                                                           ^
CFBag.c:958:91: warning: if statement has empty body
    if (CFSet) CF_OBJC_FUNCDISPATCH1(__kCFHashTypeID, CFIndex, hc, "countForObject:", key);
                                                                                          ^
CFBag.c:1024:116: warning: if statement has empty body
    if (CFDictionary) CF_OBJC_FUNCDISPATCH2(__kCFHashTypeID, Boolean, hc, "_getValue:forKey:", (any_t *)value, key);
                                                                                                                   ^

Why do you believe this is bogus? What does CF_OBJC_FUNCDISPATCH0 expand to, if anything? What is the preprocessed output (if you're using ccc, add -save-temps and look at CFBag.i)

Shantonu

never mind then.
  code expands to
  if (0) ;
So what is the purpose of this kind of coding.

For two reasons, first, there is a space following the closing ) on the condition, and second, because there is a word after the condition, before the ;.

It's just bad, CF_OBJC_FUNCDISPATCH? should expand to (void)0 or
`do { } while (0)` or anything similar that the compiler will optimize
out and is a valid expression, when it's meant to do nothing.

Defining it to expand to nothing is just bad. For example, had you
written something like:

`if (CF_OBJC_FUNCDISPATCH(...), 10)` it would result in a compilation
failure instead of just a warning. Arguably this kind of coding style is
even worse, but ...

Apparently, it looks like all this is last minute
hack because only part of the code was open sourced by Apple.

#define CFDictionary 0
#define CFSet 0
#define CFBag 0
#undef CFBag
#define CFBag 1

So things like the above violate all kind of coding style for Cocoa framework.
Why it was code this way in the first place is beyond my comprehension.

CF_OBJC_FUNCDISPATCH expands to (void(0)), if it is __WIN32__.

CoreFoundation in principle could be great standard library that goes with the C compiler (Clang).
but l am sure Apple wouldn't want that and license would preclude it too.
After seeing this kind of kludge, I am reluctant to advocate it.