ruby-changes:16840
From: suke <ko1@a...>
Date: Mon, 2 Aug 2010 21:35:38 +0900 (JST)
Subject: [ruby-changes:16840] Ruby:r28835 (trunk): * ext/win32ole/win32ole.c: NONAMELESSUNION defined only if gcc
suke 2010-08-02 21:21:00 +0900 (Mon, 02 Aug 2010) New Revision: 28835 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28835 Log: * 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. Modified files: trunk/ChangeLog trunk/ext/win32ole/extconf.rb trunk/ext/win32ole/win32ole.c Index: ChangeLog =================================================================== --- ChangeLog (revision 28834) +++ ChangeLog (revision 28835) @@ -1,3 +1,9 @@ +Mon Aug 2 21:16:03 2010 Masaki Suketa <masaki.suketa@n...> + + * 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. + Mon Aug 2 16:34:32 2010 NAKAMURA Usaku <usa@r...> * thread_win32.c (native_thread_join): need to wait thread, of course. Index: ext/win32ole/win32ole.c =================================================================== --- ext/win32ole/win32ole.c (revision 28834) +++ ext/win32ole/win32ole.c (revision 28835) @@ -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) Index: ext/win32ole/extconf.rb =================================================================== --- ext/win32ole/extconf.rb (revision 28834) +++ ext/win32ole/extconf.rb (revision 28835) @@ -38,7 +38,5 @@ case RUBY_PLATFORM when /mswin/ $CFLAGS += ' /W3' -when /cygwin/, /mingw/ - $defs << '-DNONAMELESSUNION' end create_win32ole_makefile -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/