[llvm-commits] [llvm] r116909 - in /llvm/trunk/lib/System: RWMutex.cpp Win32/ThreadLocal.inc

Duncan Sands baldrick at free.fr
Thu Oct 21 00:38:55 PDT 2010


Hi Bill,

>> when building with assertions on, errorcode is used, so mightn't this result
>> in a warning? [*] I don't see what was wrong with casting to void: that's used
>> all over the place in LLVM already, not to mention in lots of other projects.
>>
> When I created that macro, I tested it out with that situation on GCC. It didn't
> produce a warning. Can you come up with a situation and compiler where it does?

actually, no, I can't create this kind of problem with the gcc versions I have
here.  Since ATTRIBUTE_UNUSED isn't even defined for non-gcc compilers, it
seems kind of pointless testing them :)

That said, cast-to-void has the advantage that it will (probably) work with
every compiler out there, unlike ATTRIBUTE_UNUSED which does nothing for several
of them [*].

Anyway, this discussion is fairly pointless since I believe Chris issued a
fatwa some time ago stating that cast-to-void should be used wherever possible.

Ciao,

Duncan.

[*] You might argue that ATTRIBUTE_UNUSED should just get an appropriate
definition every non-gcc compiler.  If you can come up with such a definition,
great!  But it still seems like a lot of work to get what you can already get
(without including header files) with the cast-to-void idiom.



More information about the llvm-commits mailing list