- Use a more conformant C++ preprocessor macro identifier for Unix systems.

The 'unix' identifier isn't defined when '-std' is passed to the compiler (tested with gcc and clang), so use '__unix__' which is well enough documented.
This commit is contained in:
Edoardo Prezioso 2013-07-30 11:45:42 +02:00
parent 81334809c4
commit 4ce0574b3f
14 changed files with 23 additions and 23 deletions

View file

@ -505,7 +505,7 @@ bool FCajunMaster::LoadBots ()
bool gotteam = false; bool gotteam = false;
bglobal.ForgetBots (); bglobal.ForgetBots ();
#ifndef unix #ifndef __unix__
tmp = progdir; tmp = progdir;
tmp += "zcajun/" BOTFILENAME; tmp += "zcajun/" BOTFILENAME;
if (!FileExists (tmp)) if (!FileExists (tmp))

View file

@ -1742,7 +1742,7 @@ static bool C_HandleKey (event_t *ev, BYTE *buffer, int len)
} }
break; break;
#ifdef unix #ifdef __unix__
case EV_GUI_MButtonDown: case EV_GUI_MButtonDown:
C_PasteText(I_GetFromClipboard(true), buffer, len); C_PasteText(I_GetFromClipboard(true), buffer, len);
break; break;

View file

@ -1506,7 +1506,7 @@ CCMD (pullin)
{ {
const char *lastSlash; const char *lastSlash;
#ifdef unix #ifdef __unix__
lastSlash = strrchr (PullinFile, '/'); lastSlash = strrchr (PullinFile, '/');
#else #else
const char *lastSlash1, *lastSlash2; const char *lastSlash1, *lastSlash2;

View file

@ -169,7 +169,7 @@ bool CT_Responder (event_t *ev)
} }
return true; return true;
} }
#ifdef unix #ifdef __unix__
else if (ev->subtype == EV_GUI_MButtonDown) else if (ev->subtype == EV_GUI_MButtonDown)
{ {
CT_PasteChat(I_GetFromClipboard(true)); CT_PasteChat(I_GetFromClipboard(true));

View file

@ -38,7 +38,7 @@
#endif #endif
#include <float.h> #include <float.h>
#if defined(unix) || defined(__APPLE__) #if defined(__unix__) || defined(__APPLE__)
#include <unistd.h> #include <unistd.h>
#endif #endif
@ -2009,7 +2009,7 @@ static void AddAutoloadFiles(const char *gamesection)
D_AddFile (allwads, wad); D_AddFile (allwads, wad);
// [RH] Add any .wad files in the skins directory // [RH] Add any .wad files in the skins directory
#ifdef unix #ifdef __unix__
file = SHARE_DIR; file = SHARE_DIR;
#else #else
file = progdir; file = progdir;
@ -2017,7 +2017,7 @@ static void AddAutoloadFiles(const char *gamesection)
file += "skins"; file += "skins";
D_AddDirectory (allwads, file); D_AddDirectory (allwads, file);
#ifdef unix #ifdef __unix__
file = NicePath("~/" GAME_DIR "/skins"); file = NicePath("~/" GAME_DIR "/skins");
D_AddDirectory (allwads, file); D_AddDirectory (allwads, file);
#endif #endif
@ -2137,7 +2137,7 @@ static void CheckCmdLine()
Printf ("%s", GStrings("D_DEVSTR")); Printf ("%s", GStrings("D_DEVSTR"));
} }
#if !defined(unix) && !defined(__APPLE__) #if !defined(__unix__) && !defined(__APPLE__)
// We do not need to support -cdrom under Unix, because all the files // We do not need to support -cdrom under Unix, because all the files
// that would go to c:\\zdoomdat are already stored in .zdoom inside // that would go to c:\\zdoomdat are already stored in .zdoom inside
// the user's home directory. // the user's home directory.

View file

@ -1919,7 +1919,7 @@ FString G_BuildSaveName (const char *prefix, int slot)
leader = Args->CheckValue ("-savedir"); leader = Args->CheckValue ("-savedir");
if (leader.IsEmpty()) if (leader.IsEmpty())
{ {
#if !defined(unix) && !defined(__APPLE__) #if !defined(__unix__) && !defined(__APPLE__)
if (Args->CheckParm ("-cdrom")) if (Args->CheckParm ("-cdrom"))
{ {
leader = CDROM_DIR "/"; leader = CDROM_DIR "/";
@ -1931,7 +1931,7 @@ FString G_BuildSaveName (const char *prefix, int slot)
} }
if (leader.IsEmpty()) if (leader.IsEmpty())
{ {
#ifdef unix #ifdef __unix__
leader = "~/" GAME_DIR; leader = "~/" GAME_DIR;
#elif defined(__APPLE__) #elif defined(__APPLE__)
char cpath[PATH_MAX]; char cpath[PATH_MAX];

View file

@ -135,7 +135,7 @@ FGameConfigFile::FGameConfigFile ()
local_app_support << cpath << "/" GAME_DIR; local_app_support << cpath << "/" GAME_DIR;
SetValueForKey("Path", local_app_support, true); SetValueForKey("Path", local_app_support, true);
} }
#elif !defined(unix) #elif !defined(__unix__)
SetValueForKey ("Path", "$HOME", true); SetValueForKey ("Path", "$HOME", true);
SetValueForKey ("Path", "$PROGDIR", true); SetValueForKey ("Path", "$PROGDIR", true);
#else #else
@ -153,7 +153,7 @@ FGameConfigFile::FGameConfigFile ()
SetValueForKey ("Path", user_app_support, true); SetValueForKey ("Path", user_app_support, true);
SetValueForKey ("Path", "$PROGDIR", true); SetValueForKey ("Path", "$PROGDIR", true);
SetValueForKey ("Path", local_app_support, true); SetValueForKey ("Path", local_app_support, true);
#elif !defined(unix) #elif !defined(__unix__)
SetValueForKey ("Path", "$PROGDIR", true); SetValueForKey ("Path", "$PROGDIR", true);
#else #else
SetValueForKey ("Path", "~/" GAME_DIR, true); SetValueForKey ("Path", "~/" GAME_DIR, true);
@ -683,7 +683,7 @@ void FGameConfigFile::CreateStandardAutoExec(const char *section, bool start)
{ {
path << cpath << "/" GAME_DIR "/autoexec.cfg"; path << cpath << "/" GAME_DIR "/autoexec.cfg";
} }
#elif !defined(unix) #elif !defined(__unix__)
path = "$PROGDIR/autoexec.cfg"; path = "$PROGDIR/autoexec.cfg";
#else #else
path = GetUserFile ("autoexec.cfg"); path = GetUserFile ("autoexec.cfg");

View file

@ -333,7 +333,7 @@ static long ParseCommandLine (const char *args, int *argc, char **argv)
} }
#if defined(unix) #if defined(__unix__)
FString GetUserFile (const char *file) FString GetUserFile (const char *file)
{ {
FString path; FString path;
@ -698,7 +698,7 @@ void M_ScreenShot (const char *filename)
// find a file name to save it to // find a file name to save it to
if (filename == NULL || filename[0] == '\0') if (filename == NULL || filename[0] == '\0')
{ {
#if !defined(unix) && !defined(__APPLE__) #if !defined(__unix__) && !defined(__APPLE__)
if (Args->CheckParm ("-cdrom")) if (Args->CheckParm ("-cdrom"))
{ {
autoname = CDROM_DIR "\\"; autoname = CDROM_DIR "\\";
@ -715,7 +715,7 @@ void M_ScreenShot (const char *filename)
dirlen = autoname.Len(); dirlen = autoname.Len();
if (dirlen == 0) if (dirlen == 0)
{ {
#ifdef unix #ifdef __unix__
autoname = "~/" GAME_DIR "/screenshots/"; autoname = "~/" GAME_DIR "/screenshots/";
#elif defined(__APPLE__) #elif defined(__APPLE__)
char cpath[PATH_MAX]; char cpath[PATH_MAX];

View file

@ -345,7 +345,7 @@ void DLoadSaveMenu::NotifyNewSave (const char *file, const char *title, bool okF
for (unsigned i=0; i<SaveGames.Size(); i++) for (unsigned i=0; i<SaveGames.Size(); i++)
{ {
FSaveGameNode *node = SaveGames[i]; FSaveGameNode *node = SaveGames[i];
#ifdef unix #ifdef __unix__
if (node->Filename.Compare (file) == 0) if (node->Filename.Compare (file) == 0)
#else #else
if (node->Filename.CompareNoCase (file) == 0) if (node->Filename.CompareNoCase (file) == 0)

View file

@ -158,7 +158,7 @@ static bool CheckSkipOptionBlock(FScanner &sc)
} }
else if (sc.Compare("unix")) else if (sc.Compare("unix"))
{ {
#ifdef unix #ifdef __unix__
filter = true; filter = true;
#endif #endif
} }

View file

@ -816,7 +816,7 @@ bool FMODSoundRenderer::Init()
} }
result = Sys->getNumDrivers(&driver); result = Sys->getNumDrivers(&driver);
#ifdef unix #ifdef __unix__
if (result == FMOD_OK) if (result == FMOD_OK)
{ {
// On Linux, FMOD defaults to OSS. If OSS is not present, it doesn't // On Linux, FMOD defaults to OSS. If OSS is not present, it doesn't

View file

@ -295,7 +295,7 @@ FluidSynthMIDIDevice::FluidSynthMIDIDevice()
fluid_chorus_speed, fluid_chorus_depth, fluid_chorus_type); fluid_chorus_speed, fluid_chorus_depth, fluid_chorus_type);
if (0 == LoadPatchSets(fluid_patchset)) if (0 == LoadPatchSets(fluid_patchset))
{ {
#ifdef unix #ifdef __unix__
// This is the standard location on Ubuntu. // This is the standard location on Ubuntu.
if (0 == LoadPatchSets("/usr/share/sounds/sf2/FluidR3_GS.sf2:/usr/share/sounds/sf2/FluidR3_GM.sf2")) if (0 == LoadPatchSets("/usr/share/sounds/sf2/FluidR3_GS.sf2:/usr/share/sounds/sf2/FluidR3_GM.sf2"))
{ {
@ -322,7 +322,7 @@ FluidSynthMIDIDevice::FluidSynthMIDIDevice()
} }
} }
#endif #endif
#ifdef unix #ifdef __unix__
} }
#endif #endif
} }

View file

@ -166,7 +166,7 @@ static Instrument *load_instrument(Renderer *song, const char *name, int percuss
tmp += ".pat"; tmp += ".pat";
if ((fp = open_filereader(tmp, openmode, NULL)) == NULL) if ((fp = open_filereader(tmp, openmode, NULL)) == NULL)
{ {
#ifdef unix // Windows isn't case-sensitive. #ifdef __unix__ // Windows isn't case-sensitive.
tmp.ToUpper(); tmp.ToUpper();
if ((fp = open_filereader(tmp, openmode, NULL)) == NULL) if ((fp = open_filereader(tmp, openmode, NULL)) == NULL)
#endif #endif

View file

@ -91,7 +91,7 @@ const char *GetVersionString();
#define FORUM_URL "http://forum.zdoom.org" #define FORUM_URL "http://forum.zdoom.org"
#define BUGS_FORUM_URL "http://forum.zdoom.org/index.php?c=3" #define BUGS_FORUM_URL "http://forum.zdoom.org/index.php?c=3"
#ifdef unix #ifdef __unix__
#define GAME_DIR ".config/zdoom" #define GAME_DIR ".config/zdoom"
#elif defined(__APPLE__) #elif defined(__APPLE__)
#define GAME_DIR GAMENAME #define GAME_DIR GAMENAME