summaryrefslogtreecommitdiff
path: root/src/porting.h
diff options
context:
space:
mode:
authorRogier-5 <Rogier-5@users.noreply.github.com>2016-07-04 21:00:57 +0200
committerest31 <est31@users.noreply.github.com>2016-07-04 21:00:57 +0200
commit1dfd977ec43370da6931b11a8d0469792c8ebc36 (patch)
tree81d3747e51737a4b4abf6ff243797bf9679765ea /src/porting.h
parentf64914708092958f735337b3a14a33ca402b7893 (diff)
downloadminetest-1dfd977ec43370da6931b11a8d0469792c8ebc36.tar.gz
minetest-1dfd977ec43370da6931b11a8d0469792c8ebc36.tar.bz2
minetest-1dfd977ec43370da6931b11a8d0469792c8ebc36.zip
Fix & make linux conditionals uniform (#4278)
The source used a hodge-podge of different combinations of different macros to check for linux: 'linux', '__linux', '__linux__'. As '__linux__' is standard (Posix), and the others are not, the source now uniformly uses __linux__. If either linux or __linux are defined, it is made sure that __linux__ is defined as well.
Diffstat (limited to 'src/porting.h')
-rw-r--r--src/porting.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/porting.h b/src/porting.h
index 4d51c5058..d101a7324 100644
--- a/src/porting.h
+++ b/src/porting.h
@@ -60,7 +60,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <unistd.h>
#include <stdint.h> //for uintptr_t
- #if (defined(linux) || defined(__linux) || defined(__GNU__)) && !defined(_GNU_SOURCE)
+ // Use standard Posix macro for Linux
+ #if (defined(linux) || defined(__linux)) && !defined(__linux__)
+ #define __linux__
+ #endif
+ #if (defined(__linux__) || defined(__GNU__)) && !defined(_GNU_SOURCE)
#define _GNU_SOURCE
#endif
@@ -321,7 +325,7 @@ inline const char *getPlatformName()
return
#if defined(ANDROID)
"Android"
-#elif defined(linux) || defined(__linux) || defined(__linux__)
+#elif defined(__linux__)
"Linux"
#elif defined(_WIN32) || defined(_WIN64)
"Windows"