From: Guy Harris Date: Sun, 4 May 2014 16:29:25 +0000 (-0700) Subject: UNALIGNED is used in structures and must *always* be defined. X-Git-Tag: tcpdump-4.6.0~36 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/2eb4bc2d8107027e4530e41a827191fd5f9a272a UNALIGNED is used in structures and must *always* be defined. "Always" means "even on compilers that don't define __GNUC__". If we don't want #if X {nothing} #else #undef UNALIGNED #define UNALIGNED __attribute__((packed)) #endif because it's backwards, just do #if !(X) #undef UNALIGNED #define UNALIGNED __attribute__((packed)) #endif --- diff --git a/tcpdump-stdinc.h b/tcpdump-stdinc.h index afcf803e..5e5773b7 100644 --- a/tcpdump-stdinc.h +++ b/tcpdump-stdinc.h @@ -234,11 +234,10 @@ typedef char* caddr_t; * Note: this also requires that padding be put into the structure, * at least for compilers where it's implemented as __attribute__((packed)). */ -#if defined(__GNUC__) +#if !(defined(_MSC_VER) && defined(UNALIGNED)) +/* MSVC may have its own macro defined with the same name and purpose. */ #undef UNALIGNED #define UNALIGNED __attribute__((packed)) -#else - /* MSVC may have its own macro defined with the same name and purpose. */ #endif #if defined(WIN32) || defined(MSDOS)