]> The Tcpdump Group git mirrors - tcpdump/commitdiff
UNALIGNED is used in structures and must *always* be defined.
authorGuy Harris <[email protected]>
Sun, 4 May 2014 16:29:25 +0000 (09:29 -0700)
committerGuy Harris <[email protected]>
Sun, 4 May 2014 16:29:25 +0000 (09:29 -0700)
"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

tcpdump-stdinc.h

index afcf803e8e0bee5e12b0639eae5a7827ecb5866c..5e5773b7286752a1c1d610d74f6d745bb91ed1bb 100644 (file)
@@ -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)