diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-11-22 07:22:26 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-11-22 07:22:26 +0000 |
commit | 16b5c5e928b85c387a79f5ce846f68b6db98bd9d (patch) | |
tree | 724ba966419443de8044b5feaaca3257e5ddce01 /ext | |
parent | 2a9739f1a444ca3fdcc90d21a1504a0203d39d73 (diff) |
Mon, 22 Nov 2010 05:15:39 +0000 shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
merge revision(s) 29849:
merge revision(s) 28835,28894:
* 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.
* ext/win32ole/win32ole.c: fix checking version of GCC.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@29849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Signed-off-by: URABE, Shyouhei <shyouhei@ruby-lang.org>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@29867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/win32ole/extconf.rb | 2 | ||||
-rw-r--r-- | ext/win32ole/win32ole.c | 18 |
2 files changed, 16 insertions, 4 deletions
diff --git a/ext/win32ole/extconf.rb b/ext/win32ole/extconf.rb index cee922554a..565964cb81 100644 --- a/ext/win32ole/extconf.rb +++ b/ext/win32ole/extconf.rb @@ -35,7 +35,5 @@ end case RUBY_PLATFORM when /mswin32/ $CFLAGS += ' /W3' -when /cygwin/, /mingw/ - $defs << '-DNONAMELESSUNION' end create_win32ole_makefile diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c index bc268375f5..f5d75fedb9 100644 --- a/ext/win32ole/win32ole.c +++ b/ext/win32ole/win32ole.c @@ -17,6 +17,20 @@ #include "ruby.h" #include "st.h" + +#define GNUC_OLDER_3_4_4 \ + ((__GNUC__ < 3) || \ + ((__GNUC__ <= 3) && (__GNUC_MINOR__ < 4)) || \ + ((__GNUC__ <= 3) && (__GNUC_MINOR__ <= 4) && (__GNUC_PATCHLEVEL__ <= 4))) + +#if (defined(__GNUC__)) && (GNUC_OLDER_3_4_4) +#ifndef NONAMELESSUNION +#define NONAMELESSUNION 1 +#endif +#endif + +#include <ctype.h> + #include <windows.h> #include <ocidl.h> #include <olectl.h> @@ -36,13 +50,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_OLDER_3_4_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_OLDER_3_4_4) #undef V_UNION #define V_UNION(X,Y) ((X)->n1.n2.n3.Y) |