Opened 9 years ago

Closed 9 years ago

Last modified 4 years ago

#6354 closed defect (fixed)

#define FILE FAKE_FILE doesn't work on Solaris (w/ patch)

Reported by: SF/lblume Owned by: lordhoto
Priority: normal Component: Port: Solaris
Version: Keywords: build
Cc: Game:

Description

Applies to v1.6.0: On Solaris 10, FILE is typedef'd in a handful of different places. This conflicts with #define FILE FAKE_FILE.

The attached patch avoids it specifically for that platform.

Ticket imported from: #3614514. Ticket imported from: bugs/6354.

Attachments (1)

0003-not-redefining-FILE.patch (590 bytes ) - added by SF/lblume 9 years ago.
Patch to avoid redefining FILE on Solaris

Download all attachments as: .zip

Change History (7)

by SF/lblume, 9 years ago

Patch to avoid redefining FILE on Solaris

comment:1 by bluegr, 9 years ago

The reason why FILE is defined like this is to stop having it being use directly - we have our own file access API, which has platform-specific functionality (e.g. you can read from read-only media, such as CDs in Saturn, and write saved games to a memory card).

Thus, it's not wise to just ignore this in Solaris - there's a reason it has been placed there.

Another suggestion would be to find the Solaris header where FILE is defined, and undefine it right after the header has been added. We have a similar case with ARRAYSIZE in MSVC - Microsoft keeps defining its own ARRAYSIZE function, but we have our own, and we undefine the one from Microsoft right after the relevant MS system headers are included

comment:2 by wjp, 9 years ago

FILE isn't defined. It's a typedef on Solaris, so that approach won't work.

It's really not worth the trouble to make this forbidden symbol work on Solaris, as using it will still trigger errors on all other platforms. This patch is the right way to fix the compile problem from my point of view.

comment:3 by lordhoto, 9 years ago

Owner: set to lordhoto
Resolution: fixed
Status: newclosed

comment:4 by lordhoto, 9 years ago

The patch is perfectly fine. This is a simple exception only for being able to include the SDL headers.

Pushed this to master as commit 86c656a75ba7a6766d1886fb723f8727de4e68a7. Thanks for your patch!

comment:5 by digitall, 4 years ago

Component: Ports

comment:6 by digitall, 4 years ago

Component: PortsPort: Solaris
Note: See TracTickets for help on using tickets.