From 28b376e76b39492e2cb6c74eddab8c53ec8bd89f Mon Sep 17 00:00:00 2001 From: yugui Date: Sun, 8 Aug 2010 15:01:21 +0000 Subject: [PATCH] merges r28835 from trunk into ruby_1_9_2. -- * ext/win32ole/win32ole.c: NONAMELESSUNION defined only if gcc version is older than 3.4.4. [ruby-core:31567] [Bug #3637] * ext/win32ole/extconf.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ ext/win32ole/extconf.rb | 2 -- ext/win32ole/win32ole.c | 12 ++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 99f5906f75..9c6a496c0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Mon Aug 2 21:16:03 2010 Masaki Suketa + + * ext/win32ole/win32ole.c: NONAMELESSUNION defined only if gcc + version is older than 3.4.4. [ruby-core:31567] [Bug #3637] + * ext/win32ole/extconf.rb: ditto. + Fri Jul 30 07:48:04 2010 Hidetoshi NAGAI * ext/tk/extconf.rb: use TK_XINCLUDES on tkConfig.sh when not empty, diff --git a/ext/win32ole/extconf.rb b/ext/win32ole/extconf.rb index b4f09fc7c0..893793382b 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 98a93802d1..f0d80624a7 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 + #include #include #include @@ -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)