From 61db926ba5b5aeea2cafe4c5865b17f3fc82fab3 Mon Sep 17 00:00:00 2001 From: Kevin Wasserman Date: Tue, 21 Jun 2011 09:25:31 -0400 Subject: [PATCH] Define __attribute__ macro as nothing on Windows __attribute__((constructor)), __attribute__((destructor)) and __attribute__((unused)) are now expanded to nothing on Windows, so that the code can compile --- moonshot/mech_eap/eap_mech.c | 4 ++-- moonshot/mech_eap/util.h | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/moonshot/mech_eap/eap_mech.c b/moonshot/mech_eap/eap_mech.c index fb827dd..995a8ee 100644 --- a/moonshot/mech_eap/eap_mech.c +++ b/moonshot/mech_eap/eap_mech.c @@ -165,8 +165,8 @@ gssEapInitLibRadsec(OM_uint32 *minor) return GSS_S_COMPLETE; } -static void gssEapInitiatorInit(void) __attribute__((constructor)); -static void gssEapFinalize(void) __attribute__((destructor)); +static void gssEapInitiatorInit(void) GSSEAP_CONSTRUCTOR; +static void gssEapFinalize(void) GSSEAP_DESTRUCTOR; static void gssEapInitiatorInit(void) diff --git a/moonshot/mech_eap/util.h b/moonshot/mech_eap/util.h index 61635bf..89c9574 100644 --- a/moonshot/mech_eap/util.h +++ b/moonshot/mech_eap/util.h @@ -92,12 +92,20 @@ extern "C" { #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b)) #endif -#if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +#if !defined(WIN32) && !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) #define GSSEAP_UNUSED __attribute__ ((__unused__)) #else #define GSSEAP_UNUSED #endif +#if !defined(WIN32) +#define GSSEAP_CONSTRUCTOR __attribute__((constructor) +#define GSSEAP_DESTRUCTOR __attribute__((destructor)) +#else +#define GSSEAP_CONSTRUCTOR +#define GSSEAP_DESTRUCTOR +#endif + /* util_buffer.c */ OM_uint32 makeStringBuffer(OM_uint32 *minor, -- 2.1.4