The __IS_FREEBSD__ macro in vm_basic_defs.h uses "defined" in
the definition. That is undefined behavior and the FreeBSD default
compiler, clang (LLVM), warns about this pervasively misused
construct. With all warnings equivalent to an error, builds fail.
The object-like macro __IS_FREEBSD__ has been rewritten in a manner
acceptable to the current C standard.
Open-vm-tools pull request: https://github.com/vmware/open-vm-tools/pull/136
The VMware Guest Components Team
+
+Contributors to open-vm-tools:
+
+Steve Wills Correct __IS_FREEBSD__ macro in vm_basic_defs.h (clang)
+ - https://github.com/vmware/open-vm-tools/pull/136
#include "vm_basic_types.h" // For INLINE.
/* Checks for FreeBSD, filtering out VMKERNEL. */
-#define __IS_FREEBSD__ (!defined(VMKERNEL) && defined(__FreeBSD__))
+#if !defined(VMKERNEL) && defined(__FreeBSD__)
+#define __IS_FREEBSD__ 1
+#else
+#define __IS_FREEBSD__ 0
+#endif
#define __IS_FREEBSD_VER__(ver) (__IS_FREEBSD__ && __FreeBSD_version >= (ver))
#if defined _WIN32 && defined USERLEVEL
#include <stddef.h> /*
- * We redefine offsetof macro from stddef; make
+ * We redefine offsetof macro from stddef; make
* sure that it's already defined before we do that.
*/
#include <windows.h> // for Sleep() and LOWORD() etc.