Opened 12 years ago

Last modified 16 months ago

#1149 new defect

[PATCH] wcscasecmp does exist on OS X Lion

Reported by: historic_bruno Owned by:
Priority: Nice to Have Milestone: Backlog
Component: Core engine Keywords: osx patch mac
Cc: historic_bruno Patch:

Description

Contrary to #414, wcscasecmp is now available on OS X Lion, causing many redundant redeclaration warnings during the build process. I haven't tried Apple's wcscasecmp to know if it will work for us, but at least we can get rid of these warnings. The same goes for strnlen, wcsnlen, and wcsdup.

Attachments (1)

fix-macos-wcs.patch (388 bytes ) - added by Markus 11 years ago.
patch from #2005 / RedFox

Download all attachments as: .zip

Change History (18)

comment:1 by historic_bruno, 12 years ago

Keywords: simple added

comment:2 by Markus, 11 years ago

Keywords: lion removed

by Markus, 11 years ago

Attachment: fix-macos-wcs.patch added

patch from #2005 / RedFox

comment:3 by Markus, 11 years ago

Keywords: patch review added; simple removed
Milestone: BacklogAlpha 15
Summary: wcscasecmp does exist on OS X Lion[PATCH] wcscasecmp does exist on OS X Lion

comment:4 by historic_bruno, 11 years ago

I think it's not the correct solution even if it solves the build warning on 10.7+. The problem is the game can be built on 10.7 but run on earlier versions, which could result in a crash when it tries to call those functions, if they're not implemented. So the proper fix involves two things:

  • Compile time fix: if we build against 10.6 SDK or earlier, it should use our implementation or the build would fail, the patch solves that in a hacky way, it should use OS X version macros. This way it also runs on 10.7+ with no problem.
  • Run-time fix: if we build against 10.7+ SDK, it should detect if the functions are valid before calling them, if not, fall back to our own implementation. This would be the ugly part.

Honestly it seems easier to always use our own implementation on OS X and just fix the build warnings for 10.7+.

Last edited 11 years ago by historic_bruno (previous) (diff)

comment:5 by historic_bruno, 11 years ago

Keywords: review removed

comment:6 by Markus, 11 years ago

If we want the build to run with 10.6 we should set the deployment target accordingly. Linking to 10.7 and then check at runtime if the function exists looks like the wrong way.

(I think we should always build with the newest version, the packaged downloads can still be linked to 10.6.)

#if OS_MACOSX && !defined(AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER) ?

in reply to:  6 comment:7 by historic_bruno, 11 years ago

Replying to Markus:

If we want the build to run with 10.6 we should set the deployment target accordingly.

In fact, that's exactly what we do with the OS X bundle build script :)

Linking to 10.7 and then check at runtime if the function exists looks like the wrong way.

According to Apple, it's one aspect of OS X SDK-based development. But as I said it's probably overkill in this case, we could squash the build warning on 10.7+ and use our own implementation. I actually don't know what the compiler's doing now, is it undefined behavior?

Last edited 11 years ago by historic_bruno (previous) (diff)

comment:8 by wraitii, 10 years ago

Milestone: Alpha 15Alpha 16

comment:9 by leper, 10 years ago

Milestone: Alpha 16Backlog

comment:10 by wraitii, 9 years ago

Milestone: BacklogAlpha 20

OS 10.7 is now super old, might be time to reconsider.

comment:11 by elexis, 8 years ago

Milestone: Alpha 20Backlog

Backlogging due to lack of progress.

comment:12 by Krinkle, 5 years ago

Keywords: mac added

comment:13 by historic_bruno, 5 years ago

Cc: historic_bruno added

We no longer support 10.7 (SM38 requires 10.9), so older builds aren't relevant. Will revisit this as such.

comment:14 by wraitii, 3 years ago

Milestone: BacklogAlpha 25

I fixed strnlen in Phab:rP24227, not the others though, gonna push this to A25.

comment:15 by wraitii, 3 years ago

Milestone: Alpha 25Alpha 26

comment:16 by Stan, 2 years ago

Milestone: Alpha 26Alpha 27

Unlikely to get done for A26

comment:17 by Stan, 16 months ago

Milestone: Alpha 27Backlog
Note: See TracTickets for help on using tickets.