| 4e1ad211 | 27-Mar-2014 |
Jed Brown <jed@jedbrown.org> |
PetscDefined: test whether a configuration macro is defined without #ifdef
This allows testing configuration macros from normal code, thus avoiding unused variable warnings and allowing the compiler
PetscDefined: test whether a configuration macro is defined without #ifdef
This allows testing configuration macros from normal code, thus avoiding unused variable warnings and allowing the compiler to check for syntax errors throughout all alternatives. This uses C99-style variadic macros with a second expansion to appease MSVC's non-conforming implementation of variadic macros.
This trick was introduced by "comex" on Google+ in response to a question posed by Linus Torvalds. https://plus.google.com/+LinusTorvalds/posts/9gntjh57dXt
This technique (modulo MSVC support) was implemented in the Linux kernel by Paul Gortmaker: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=69349c2dc01c489eccaa4c472542c08e370c6d7e
show more ...
|