| Summary: | SDL_rwops tries Mac paths, even on Mac OS X | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Anders F Bj <afb> |
| Component: | file | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 1.2 | ||
| Hardware: | PowerPC | ||
| OS: | Mac OS X (All) | ||
| Bug Depends on: | |||
| Bug Blocks: | 53 | ||
| Attachments: | SDL12-rwops-macosx.patch | ||
|
Description
Anders F Bj
2006-05-09 17:52:45 UTC
Created attachment 120 [details]
SDL12-rwops-macosx.patch
Under what conditions are both __MACOS__ and __MACOSX__ defined? Should we create a new identifier, e.g. __CARBON__? CodeWarrior projects, on Mac OS X. (Carbon Mach-O target) It defines "macintosh", which in turn triggers __MACOS__ I think this was the only location where it mattered, so I'm not sure if whether it should be revised or not ? (In reply to comment #3) I believe that __MACOS__ is meant to refer to MacOS Classic, and __MACOSX__ is meant to refer to Mac OS X. Places in the SDL code which need to be different based on the target API should use the TARGET_API_MAC_* defines. I've checked in a change that should make sure __MACOS__ is only defined on MacOS Classic. Okay, once all the changes are in the Subversion I will try to start out fresh and import (from XML) and build the CodeWarrior projects with the new code, see if I got all of those little local code changes migrated from my old CVS sandbox... I'm fine with using __MACOS__ for Mac OS 9, and __MACOSX__ for Mac OS X builds. (even if the Mac OS 9/CFM builds work on Mac OS X too, that's beside the point) And you are right that TARGET_API_MAC_OS8 and TARGET_API_MAC_CARBON are better. So for the CW Carbon targets: CFM => __MACOS__, Mach-O ==> __MACOSX__. (OK.) Everything should be set up in subversion. I've updated the snapshots, as well. The macro rearrangement in SVN didn't work for me (Comment #4) It is now including SDL_config_macos.h in the Mach-O Carbon targets, which makes them fail to compile as it is redeclaring int32_t, etc... Tried adding "#undef macintosh" to the prefix, but it didn't help. (In reply to comment #7) > The macro rearrangement in SVN didn't work for me (Comment #4) > > It is now including SDL_config_macos.h in the Mach-O Carbon targets, > which makes them fail to compile as it is redeclaring int32_t, etc... > > Tried adding "#undef macintosh" to the prefix, but it didn't help. Patch suggestions welcome... As a workaround, you could switch back to the previous "platform" header I think these two lines in rwops were the only ones that failed anyway ? (In reply to comment #9) > As a workaround, you could switch back to the previous "platform" header I'd rather not, it seems very wrong to me to have both __MACOS__ and __MACOSX__ defined. Ideally, we'd be able to distinguish whether or not we're building on MacOS Classic or Mac OS X, and set the correct define, and then use TARGET_API_MAC* to distinguish between the target ABI. Anyway, please open this issue as a new bug, with the description of what needs to be done to fix it. Thanks! I agree that it is wrong to have both defined, but that's how it ends up. Actually I thought that "def macintosh" was a pretty good tell-tale for Mac OS 9, and "defined(__APPLE__) && defined(__MACH__)" for Mac OS X ? But it seems that things aren't so simple. CodeWarrior seems to define "macintosh" even when compiling Mach-O (while GCC or Xcode does *not*) And the other two basically just specify Apple OS with Mach-O binaries, which could just as well be OpenDarwin or something (i.e. not Mac OS X) The easy and lazy way out is to require the user to define the platform, but I think we can still use some heuristic like the current to "guess" ? (somewhat similar to SDL_config.h, as it has to come from *somewhere* whether it is the user modifying a default file, or autotools guessing) Strange, now when I double-checked with two new "blank" CW projects: CFM does define "macintosh" (like it should) but Mach-O does not define "macintosh" (also correct) So I wonder what could possibly have gone wrong in SDL_platform.h ?!? Will do some experiments with this later, and open as a new "bug". (the main idea is still: CFM ==> __MACOS__, Mach-O ==> __MACOSX__ and preferrably only one of these defines should ever be defined) |