From: Oliver Kurth Date: Fri, 15 Sep 2017 18:23:55 +0000 (-0700) Subject: Update __IS_FREE_BSD__ macro in vm_basic_defs.h X-Git-Tag: stable-10.2.0~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ad25b6bfe88e47dc9b2b995eba5af1a317aacd0;p=thirdparty%2Fopen-vm-tools.git Update __IS_FREE_BSD__ macro in vm_basic_defs.h 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 --- diff --git a/open-vm-tools/AUTHORS b/open-vm-tools/AUTHORS index 6409eb807..d830fe0e2 100644 --- a/open-vm-tools/AUTHORS +++ b/open-vm-tools/AUTHORS @@ -1 +1,6 @@ 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 diff --git a/open-vm-tools/lib/include/vm_basic_defs.h b/open-vm-tools/lib/include/vm_basic_defs.h index faca55747..3c321f423 100644 --- a/open-vm-tools/lib/include/vm_basic_defs.h +++ b/open-vm-tools/lib/include/vm_basic_defs.h @@ -76,12 +76,16 @@ #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 /* - * 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 // for Sleep() and LOWORD() etc.