summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/win32ole/extconf.rb2
-rw-r--r--ext/win32ole/win32ole.c12
2 files changed, 10 insertions, 4 deletions
diff --git a/ext/win32ole/extconf.rb b/ext/win32ole/extconf.rb
index b4f09fc..8937933 100644
--- a/ext/win32ole/extconf.rb
+++ b/ext/win32ole/extconf.rb
@@ -38,7 +38,5 @@ end
case RUBY_PLATFORM
when /mswin/
$CFLAGS += ' /W3'
-when /cygwin/, /mingw/
- $defs << '-DNONAMELESSUNION'
end
create_win32ole_makefile
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c
index 50743e7..a6db6a0 100644
--- a/ext/win32ole/win32ole.c
+++ b/ext/win32ole/win32ole.c
@@ -18,7 +18,15 @@
#include "ruby/ruby.h"
#include "ruby/st.h"
#include "ruby/encoding.h"
+
+#if (defined(__GNUC__)) && (__GNUC__ <= 3) && (__GNUC_MINOR__ <= 4) && (__GNUC_PATCHLEVEL__ <= 4)
+#ifndef NONAMELESSUNION
+#define NONAMELESSUNION 1
+#endif
+#endif
+
#include <ctype.h>
+
#include <windows.h>
#include <ocidl.h>
#include <olectl.h>
@@ -43,13 +51,13 @@
#define DOUTI(x) fprintf(stderr, "[%ld]:" #x "=%d\n",__LINE__,x)
#define DOUTD(x) fprintf(stderr, "[%d]:" #x "=%f\n",__LINE__,x)
-#if defined NONAMELESSUNION && __GNUC__
+#if (defined(__GNUC__)) && (__GNUC__ <= 3) && (__GNUC_MINOR__ <= 4) && (__GNUC_PATCHLEVEL__ <= 4)
#define V_UNION1(X, Y) ((X)->u.Y)
#else
#define V_UNION1(X, Y) ((X)->Y)
#endif
-#if defined NONAMELESSUNION && __GNUC__
+#if (defined(__GNUC__)) && (__GNUC__ <= 3) && (__GNUC_MINOR__ <= 4) && (__GNUC_PATCHLEVEL__ <= 4)
#undef V_UNION
#define V_UNION(X,Y) ((X)->n1.n2.n3.Y)