Adds XOPEN_SOURCE for PATH_MAX and POSIX 1993 for stat (#5529)
authormjvk <29380294+mjvk@users.noreply.github.com>
Thu, 26 Sep 2019 16:40:14 +0000 (18:40 +0200)
committerWouter van Oortmerssen <aardappel@gmail.com>
Thu, 26 Sep 2019 16:40:14 +0000 (09:40 -0700)
* Adds XOPEN_SOURCE for PATH_MAX and POSIX 1993 for stat

These are the only two required extension for compilation of
flatbuffers using -std=c++11 instead of gnu++11.

* Sets _XOPEN_SOURCE to 600 and enable POSIX2001 for fseeko

src/util.cpp

index 5483cee..b80bed2 100644 (file)
@@ -16,6 +16,7 @@
 
 // clang-format off
 // Dont't remove `format off`, it prevent reordering of win-includes.
+#define _POSIX_C_SOURCE 200112L // For stat from stat/stat.h and fseeko() (POSIX extensions).
 #ifdef _WIN32
 #  ifndef WIN32_LEAN_AND_MEAN
 #    define WIN32_LEAN_AND_MEAN
@@ -31,6 +32,7 @@
 #  include <winbase.h>
 #  undef interface  // This is also important because of reasons
 #else
+#  define _XOPEN_SOURCE 600 // For PATH_MAX from limits.h (SUSv2 extension) 
 #  include <limits.h>
 #endif
 // clang-format on