[C++] Updates real_path to be truly portable (#5787)

* Removes posix definition

stat and fseeko are not used. Tested on QNX (GCC 5.4.0) and MinGw

* Updates realpath to more modern (2008) version

* Removes unix specific headers

* Adds detection of strtoll_l as android API < 21 does not provide it

* Includes cstdlib and formatting

Removes cmakelist alterations as not necessary. Formatting not complete.

* Stdlib outside if

Stdlib is available on all platforms

* Fixes indentation

* Adds locale check to android build

* Adds missing brace

* full names

* Removes again, no clue

* Updates base to check for locale independent android

Cmake already checks for others, also MSC?

* Changes to test on available and not requested

* Fixes android bad xopen_version define

* Removes warning
This commit is contained in:
mjvankampen
2020-06-25 23:40:10 +02:00
committed by GitHub
parent e5a8f76a4b
commit 7571b2ac56
2 changed files with 22 additions and 9 deletions

View File

@@ -46,6 +46,10 @@
#include <iterator>
#include <memory>
#if defined(__unix__) && !defined(FLATBUFFERS_LOCALE_INDEPENDENT)
#include <unistd.h>
#endif
#ifdef _STLPORT_VERSION
#define FLATBUFFERS_CPP98_STL
#endif
@@ -53,6 +57,10 @@
#include <functional>
#endif
#ifdef __ANDROID__
#include <android/api-level.h>
#endif
#include "flatbuffers/stl_emulation.h"
#if defined(__ICCARM__)
@@ -236,10 +244,8 @@ namespace flatbuffers {
#ifndef FLATBUFFERS_LOCALE_INDEPENDENT
// Enable locale independent functions {strtof_l, strtod_l,strtoll_l, strtoull_l}.
// They are part of the POSIX-2008 but not part of the C/C++ standard.
// GCC/Clang have definition (_XOPEN_SOURCE>=700) if POSIX-2008.
#if ((defined(_MSC_VER) && _MSC_VER >= 1800) || \
(defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE>=700)))
(defined(_XOPEN_VERSION) && (_XOPEN_VERSION>=700)) && (!defined(__ANDROID_API__) || (defined(__ANDROID_API__) && (__ANDROID_API__>=21))))
#define FLATBUFFERS_LOCALE_INDEPENDENT 1
#else
#define FLATBUFFERS_LOCALE_INDEPENDENT 0