Bug 2510 - Wrong endianness is defined for Mac OS X on i386
Status: RESOLVED FIXED
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Platform
Version: 1.33 SVN
Hardware: Macintosh MacOS X
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: ioquake3 bugzilla mailing list
URL:
Depends on:
Blocks:
 
Reported: 2005-11-27 01:49 EST by Joshua Root
Modified: 2007-05-21 11:22:50 EDT
0 users

See Also:



Description Joshua Root 2005-11-27 01:49:13 EST
q_platform.h is checking for Mac OS X by checking if MACOS_X is defined. On my system (10.4.3), neither gcc 3.3 or 4.0 actually defines this. Apple seems to recommend checking for __APPLE_CC__. The following patch makes it do that. I also noticed that the wrong endianness is set when compiling on OS X on i386; so the patch fixes that too.

Index: code/qcommon/q_platform.h
===================================================================
--- code/qcommon/q_platform.h   (revision 376)
+++ code/qcommon/q_platform.h   (working copy)
@@ -93,7 +93,7 @@
 
 //============================================================== MAC OS X ===
 
-#if defined(MACOS_X)
+#if defined(MACOS_X) || defined(__APPLE_CC__)
 
 #define OS_STRING "macosx"
 #define ID_INLINE inline
@@ -101,12 +101,12 @@
 
 #ifdef __ppc__
 #define ARCH_STRING "ppc"
+#define Q3_BIG_ENDIAN
 #elif defined __i386__
 #define ARCH_STRING "i386"
+#define Q3_LITTLE_ENDIAN
 #endif
 
-#define Q3_BIG_ENDIAN
-
 #endif
 
 //=================================================================== MAC ===
Comment 1 Joshua Root 2005-11-28 07:03:56 EST
Icculus fixed the build by defining MACOS_X in the Makefile. But the endianness is still being set wrong -- here's a patch which only fixes that.

Index: code/qcommon/q_platform.h
===================================================================
--- code/qcommon/q_platform.h   (revision 386)
+++ code/qcommon/q_platform.h   (working copy)
@@ -101,12 +101,12 @@
 
 #ifdef __ppc__
 #define ARCH_STRING "ppc"
+#define Q3_BIG_ENDIAN
 #elif defined __i386__
 #define ARCH_STRING "i386"
+#define Q3_LITTLE_ENDIAN
 #endif
 
-#define Q3_BIG_ENDIAN
-
 #endif
 
 //=================================================================== MAC ===
Comment 2 Ryan C. Gordon 2005-11-28 22:31:56 EST
Fixed in svn revision #388. Thanks!

--ryan.

Comment 3 Ryan C. Gordon 2007-05-21 11:22:50 EDT
Setting a QA contact on all ioquake3 bugs, even resolved ones. Sorry if you get a flood of email from this, it should only happen once. Apologies for the incovenience.

--ryan.