mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-30 10:40:01 +00:00
moved function to namespace (#8068)
This commit is contained in:
@@ -289,10 +289,12 @@ namespace flatbuffers {
|
|||||||
#define FLATBUFFERS_SUPPRESS_UBSAN(type)
|
#define FLATBUFFERS_SUPPRESS_UBSAN(type)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This is constexpr function used for checking compile-time constants.
|
namespace flatbuffers {
|
||||||
// Avoid `#pragma warning(disable: 4127) // C4127: expression is constant`.
|
// This is constexpr function used for checking compile-time constants.
|
||||||
template<typename T> FLATBUFFERS_CONSTEXPR inline bool IsConstTrue(T t) {
|
// Avoid `#pragma warning(disable: 4127) // C4127: expression is constant`.
|
||||||
return !!t;
|
template<typename T> FLATBUFFERS_CONSTEXPR inline bool IsConstTrue(T t) {
|
||||||
|
return !!t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable C++ attribute [[]] if std:c++17 or higher.
|
// Enable C++ attribute [[]] if std:c++17 or higher.
|
||||||
|
|||||||
@@ -2118,7 +2118,7 @@ CheckedError Parser::ParseSingleValue(const std::string *name, Value &e,
|
|||||||
auto match = false;
|
auto match = false;
|
||||||
|
|
||||||
#define IF_ECHECK_(force, dtoken, check, req) \
|
#define IF_ECHECK_(force, dtoken, check, req) \
|
||||||
if (!match && ((dtoken) == token_) && ((check) || IsConstTrue(force))) \
|
if (!match && ((dtoken) == token_) && ((check) || flatbuffers::IsConstTrue(force))) \
|
||||||
ECHECK(TryTypedValue(name, dtoken, check, e, req, &match))
|
ECHECK(TryTypedValue(name, dtoken, check, e, req, &match))
|
||||||
#define TRY_ECHECK(dtoken, check, req) IF_ECHECK_(false, dtoken, check, req)
|
#define TRY_ECHECK(dtoken, check, req) IF_ECHECK_(false, dtoken, check, req)
|
||||||
#define FORCE_ECHECK(dtoken, check, req) IF_ECHECK_(true, dtoken, check, req)
|
#define FORCE_ECHECK(dtoken, check, req) IF_ECHECK_(true, dtoken, check, req)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
#define FLATBUFFERS_NO_FILE_TESTS
|
#define FLATBUFFERS_NO_FILE_TESTS
|
||||||
#else
|
#else
|
||||||
#define TEST_OUTPUT_LINE(...) \
|
#define TEST_OUTPUT_LINE(...) \
|
||||||
do { printf(__VA_ARGS__); printf("\n"); } while(!IsConstTrue(true))
|
do { printf(__VA_ARGS__); printf("\n"); } while(!flatbuffers::IsConstTrue(true))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TEST_EQ(exp, val) TestEq(exp, val, "'" #exp "' != '" #val "'", __FILE__, __LINE__, "")
|
#define TEST_EQ(exp, val) TestEq(exp, val, "'" #exp "' != '" #val "'", __FILE__, __LINE__, "")
|
||||||
|
|||||||
Reference in New Issue
Block a user