From 13b59e6bef4bddddd80548b6ea146c1750b35e6a Mon Sep 17 00:00:00 2001 From: realaltffour <56314286+realaltffour@users.noreply.github.com> Date: Sat, 11 Apr 2020 14:13:24 +0300 Subject: [PATCH] Update .clang-format style. - Add IndentWidth to 4 - Apply new .clang-format style --- .clang-format | 1 + build.sh | 2 +- buildRelease.sh | 2 +- src/data.cpp | 96 +- src/data.h | 44 +- src/main.cpp | 99 +- src/module.h | 6 +- src/modules/init.cpp | 44 +- vendor/json.hpp | 33964 +++++++++++++++++++++-------------------- 9 files changed, 17320 insertions(+), 16938 deletions(-) diff --git a/.clang-format b/.clang-format index af51c56..b5d9155 100644 --- a/.clang-format +++ b/.clang-format @@ -33,6 +33,7 @@ SpacesInParentheses: 'false' SpacesInSquareBrackets: 'false' Standard: Auto TabWidth: '4' +IndentWidth: '4' UseTab: Always ... diff --git a/build.sh b/build.sh index 8fd7aa8..02c6c1f 100755 --- a/build.sh +++ b/build.sh @@ -3,6 +3,6 @@ mkdir build cd build conan install .. --build missing -cmake -DCMAKE_BUILD_TYPE=Debug .. +cmake -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCMAKE_BUILD_TYPE=Debug .. make -j9 cd .. diff --git a/buildRelease.sh b/buildRelease.sh index b4946ba..9f899de 100755 --- a/buildRelease.sh +++ b/buildRelease.sh @@ -3,6 +3,6 @@ mkdir build cd build conan install .. --build missing -cmake -DCMAKE_BUILD_TYPE=Release .. +cmake -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCMAKE_BUILD_TYPE=Release .. make -j9 cd .. diff --git a/src/data.cpp b/src/data.cpp index b23a21f..a5fe747 100644 --- a/src/data.cpp +++ b/src/data.cpp @@ -1,72 +1,72 @@ #include "data.h" void to_json(json& j, const Date& date) { - j = json{{"day", date.day}, {"month", date.day}, {"year", date.year}}; + j = json{{"day", date.day}, {"month", date.day}, {"year", date.year}}; } void from_json(const json& j, Date& date) { - j.at("day").get_to(date.day); - j.at("month").get_to(date.month); - j.at("year").get_to(date.year); + j.at("day").get_to(date.day); + j.at("month").get_to(date.month); + j.at("year").get_to(date.year); } void to_json(json& j, const Project& proj) { - j = json{{"name", proj.name}, - {"desc", proj.desc}, - {"uuid", proj.uuid}, - {"pri", proj.pri}, - {"creationDate", proj.creationDate}, - {"doneDate", proj.doneDate}, - {"isDone", proj.isDone}}; + j = json{{"name", proj.name}, + {"desc", proj.desc}, + {"uuid", proj.uuid}, + {"pri", proj.pri}, + {"creationDate", proj.creationDate}, + {"doneDate", proj.doneDate}, + {"isDone", proj.isDone}}; } void from_json(const json& j, Project& proj) { - j.at("name").get_to(proj.name); - j.at("desc").get_to(proj.desc); - j.at("uuid").get_to(proj.uuid); - j.at("pri").get_to(proj.pri); - j.at("creationDate").get_to(proj.creationDate); - j.at("doneDate").get_to(proj.doneDate); - j.at("isDone").get_to(proj.isDone); + j.at("name").get_to(proj.name); + j.at("desc").get_to(proj.desc); + j.at("uuid").get_to(proj.uuid); + j.at("pri").get_to(proj.pri); + j.at("creationDate").get_to(proj.creationDate); + j.at("doneDate").get_to(proj.doneDate); + j.at("isDone").get_to(proj.isDone); } void to_json(json& j, const Skid& skid) { - j = json{ - {"projects", *skid.projects}, - {"creationDate", skid.creationDate}, - }; + j = json{ + {"projects", *skid.projects}, + {"creationDate", skid.creationDate}, + }; } void from_json(const json& j, Skid& skid) { - j.at("projects").get_to(*skid.projects); - j.at("creationDate").get_to(skid.creationDate); + j.at("projects").get_to(*skid.projects); + j.at("creationDate").get_to(skid.creationDate); } void to_json(json& j, const DB& db) { - j = json{{"projects", *db.projects}, - {"creationDate", db.creationDate}, - {"lastAccessTime", db.lastAccessTime}}; + j = json{{"projects", *db.projects}, + {"creationDate", db.creationDate}, + {"lastAccessTime", db.lastAccessTime}}; } void from_json(const json& j, DB& db) { - j.at("projects").get_to(*db.projects); - j.at("creationDate").get_to(db.creationDate); - j.at("lastAccessTime").get_to(db.lastAccessTime); + j.at("projects").get_to(*db.projects); + j.at("creationDate").get_to(db.creationDate); + j.at("lastAccessTime").get_to(db.lastAccessTime); } void writeDB(DB db, const std::string& dest) { - try { - std::ofstream f(dest); - json j = db; - std::cout << "hello" << std::endl; - f << j; - } catch(std::exception& ex) { - std::cout << "Failed writing database to: " << dest << std::endl; - std::cout << "Error: " << ex.what() << std::endl; - } + try { + std::ofstream f(dest); + json j = db; + std::cout << "hello" << std::endl; + f << j; + } catch(std::exception& ex) { + std::cout << "Failed writing database to: " << dest << std::endl; + std::cout << "Error: " << ex.what() << std::endl; + } } void loadDB(DB& db, const std::string& src) { - try { - std::ifstream f(src); - json j; - f >> j; - db = j; - } catch(const std::exception& ex) { - std::cout << "Failed loading database from: " << src << std::endl; - std::cout << "Error: " << ex.what() << std::endl; - } + try { + std::ifstream f(src); + json j; + f >> j; + db = j; + } catch(const std::exception& ex) { + std::cout << "Failed loading database from: " << src << std::endl; + std::cout << "Error: " << ex.what() << std::endl; + } } diff --git a/src/data.h b/src/data.h index 7e7d711..774a0d0 100644 --- a/src/data.h +++ b/src/data.h @@ -17,24 +17,24 @@ using nlohmann::json; /////////////// DATA CONTAINING STRUCTURES /////////////////// struct Date { - int day = 0; - int month = 0; // 0-11 - int year = 0; // + 1900 for currentyear + int day = 0; + int month = 0; // 0-11 + int year = 0; // + 1900 for currentyear }; struct Project { - std::string name = ""; - std::string desc = ""; - std::string uuid; - int pri = 0; - Date creationDate; - Date doneDate; - bool isDone = false; + std::string name = ""; + std::string desc = ""; + std::string uuid; + int pri = 0; + Date creationDate; + Date doneDate; + bool isDone = false; }; struct Skid { - std::vector* projects = {}; - Date creationDate; + std::vector* projects = {}; + Date creationDate; }; /////////////// END OF DATA CONTAINING STRUCTURES //////////// @@ -44,26 +44,26 @@ struct Skid { enum EventType { Access = 0, Creation = 1, Modification = 2, None = -1 }; struct Event { - int id = -1; - EventType type = EventType::None; - std::string mesg = ""; + int id = -1; + EventType type = EventType::None; + std::string mesg = ""; }; struct EventLog { - std::vector* events; - std::string sha512 = ""; + std::vector* events; + std::string sha512 = ""; }; /////////////// EVENT END OF HISTORY SYSTEM STRUCTURES ///////////// // Main Database that represents the skidjular directory. struct DB { - std::map* projects; - std::vector skids; - EventLog log; + std::map* projects; + std::vector skids; + EventLog log; - Date creationDate; - Date lastAccessTime; + Date creationDate; + Date lastAccessTime; }; ////////////// Utilities for the Database structure //////////////// diff --git a/src/main.cpp b/src/main.cpp index 28993ab..251b5e2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,62 +8,63 @@ #include "modules/init.h" Module* get_Mod(std::string name) { - return nullptr; + if(true) {} + return nullptr; }; void dispatch_Mod(Module* mod, std::string args){}; int main(int argc, const char* argv[]) { - using namespace boost::program_options; - using namespace std; + using namespace boost::program_options; + using namespace std; - try { - options_description general("General Options"); - general.add_options()("help", "Help Message")( - "help-module", value(), "Module for help message")( - "module", value(), "Module to execute")( - "module-args", value(), "Arguments to use"); - positional_options_description general_positional; - general_positional.add("module", 1); - general_positional.add("module-args", 10); + try { + options_description general("General Options"); + general.add_options()("help", "Help Message")( + "help-module", value(), "Module for help message")( + "module", value(), "Module to execute")( + "module-args", value(), "Arguments to use"); + positional_options_description general_positional; + general_positional.add("module", 1); + general_positional.add("module-args", 10); - variables_map vm; - store(command_line_parser(argc, argv) - .options(general) - .allow_unregistered() - .positional(general_positional) - .run(), - vm); - notify(vm); + variables_map vm; + store(command_line_parser(argc, argv) + .options(general) + .allow_unregistered() + .positional(general_positional) + .run(), + vm); + notify(vm); - if(vm.count("help")) { - std::cout << general << "\n"; - exit(0); - } else if(vm.count("help-module")) { - auto name = vm["help-module"].as(); - auto module = get_Mod(name); - if(!module) { - std::cout << "Module not found.\n"; - exit(1); - } - std::cout << module->desc << "\n"; - } else if(vm.count("module")) { - auto name = vm["module"].as(); - auto module = get_Mod(name); - if(!module) { - std::cout << "Module not found.\n"; - exit(1); - } - if(vm.count("module-args")) { - auto args = vm["module-args"].as(); - dispatch_Mod(module, args); - } else - dispatch_Mod(module, ""); - } else { - std::cout << general << "\n"; - exit(0); - } + if(vm.count("help")) { + std::cout << general << "\n"; + exit(0); + } else if(vm.count("help-module")) { + auto name = vm["help-module"].as(); + auto module = get_Mod(name); + if(!module) { + std::cout << "Module not found.\n"; + exit(1); + } + std::cout << module->desc << "\n"; + } else if(vm.count("module")) { + auto name = vm["module"].as(); + auto module = get_Mod(name); + if(!module) { + std::cout << "Module not found.\n"; + exit(1); + } + if(vm.count("module-args")) { + auto args = vm["module-args"].as(); + dispatch_Mod(module, args); + } else + dispatch_Mod(module, ""); + } else { + std::cout << general << "\n"; + exit(0); + } - } catch(const error& ex) { cerr << ex.what() << '\n'; } + } catch(const error& ex) { cerr << ex.what() << '\n'; } - return 0; + return 0; } diff --git a/src/module.h b/src/module.h index ef9fa7f..be20879 100644 --- a/src/module.h +++ b/src/module.h @@ -9,9 +9,9 @@ using ModuleFn = std::function; using ModuleFnDispatcher = std::function; struct Module { - std::string name; - std::string desc; - std::map funcs; + std::string name; + std::string desc; + std::map funcs; }; #endif diff --git a/src/modules/init.cpp b/src/modules/init.cpp index a25e7d4..2eb0c2a 100644 --- a/src/modules/init.cpp +++ b/src/modules/init.cpp @@ -3,35 +3,35 @@ #include "../data.h" void init_create(init_args arg) { - std::cout << "Creating database in current directory." << std::endl; - DB db; - time_t t = time(0); - struct tm* currentTime = localtime(&t); + std::cout << "Creating database in current directory." << std::endl; + DB db; + time_t t = time(0); + struct tm* currentTime = localtime(&t); - db.creationDate.day = currentTime->tm_mday; - db.creationDate.month = currentTime->tm_mon; - db.creationDate.year = currentTime->tm_year; - db.lastAccessTime.day = currentTime->tm_mday; - db.lastAccessTime.month = currentTime->tm_mon; - db.lastAccessTime.year = currentTime->tm_year; + db.creationDate.day = currentTime->tm_mday; + db.creationDate.month = currentTime->tm_mon; + db.creationDate.year = currentTime->tm_year; + db.lastAccessTime.day = currentTime->tm_mday; + db.lastAccessTime.month = currentTime->tm_mon; + db.lastAccessTime.year = currentTime->tm_year; - // Mandatory stuff to stop segmantion fault due to - // pointers unintialized. - db.projects = new std::map(); - db.log.events = new std::vector(); + // Mandatory stuff to stop segmantion fault due to + // pointers unintialized. + db.projects = new std::map(); + db.log.events = new std::vector(); - // TODO: Add event logging - writeDB(db, ".db"); + // TODO: Add event logging + writeDB(db, ".db"); } void init_dispatch() { - init_args arg; - init_create(arg); + init_args arg; + init_create(arg); } init_mod init_new() { - init_mod mod; - mod.name = "Init"; - mod.desc = "Creates skidjular directory in $(pwd)"; - return mod; + init_mod mod; + mod.name = "Init"; + mod.desc = "Creates skidjular directory in $(pwd)"; + return mod; } diff --git a/vendor/json.hpp b/vendor/json.hpp index 54d0ce5..63f791a 100644 --- a/vendor/json.hpp +++ b/vendor/json.hpp @@ -80,17 +80,17 @@ SOFTWARE. namespace nlohmann { namespace detail { /// struct to capture the start position of the current token struct position_t { - /// the total number of characters read - std::size_t chars_read_total = 0; - /// the number of characters read in the current line - std::size_t chars_read_current_line = 0; - /// the number of lines read - std::size_t lines_read = 0; + /// the total number of characters read + std::size_t chars_read_total = 0; + /// the number of characters read in the current line + std::size_t chars_read_current_line = 0; + /// the number of lines read + std::size_t lines_read = 0; - /// conversion to size_t to preserve SAX interface - constexpr operator size_t() const { - return chars_read_total; - } + /// conversion to size_t to preserve SAX interface + constexpr operator size_t() const { + return chars_read_total; + } }; }} // namespace nlohmann::detail @@ -141,7 +141,7 @@ struct position_t { #undef JSON_HEDLEY_VERSION_ENCODE #endif #define JSON_HEDLEY_VERSION_ENCODE(major, minor, revision) \ - (((major)*1000000) + ((minor)*1000) + (revision)) + (((major)*1000000) + ((minor)*1000) + (revision)) #if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR) #undef JSON_HEDLEY_VERSION_DECODE_MAJOR @@ -163,10 +163,10 @@ struct position_t { #endif #if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__) #define JSON_HEDLEY_GNUC_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) + JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) #elif defined(__GNUC__) #define JSON_HEDLEY_GNUC_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0) + JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0) #endif #if defined(JSON_HEDLEY_GNUC_VERSION_CHECK) @@ -174,7 +174,8 @@ struct position_t { #endif #if defined(JSON_HEDLEY_GNUC_VERSION) #define JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) \ - (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + (JSON_HEDLEY_GNUC_VERSION >= \ + JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) (0) #endif @@ -183,18 +184,18 @@ struct position_t { #undef JSON_HEDLEY_MSVC_VERSION #endif #if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) -#define JSON_HEDLEY_MSVC_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, \ - (_MSC_FULL_VER % 10000000) / 100000, \ - (_MSC_FULL_VER % 100000) / 100) +#define JSON_HEDLEY_MSVC_VERSION \ + JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, \ + (_MSC_FULL_VER % 10000000) / 100000, \ + (_MSC_FULL_VER % 100000) / 100) #elif defined(_MSC_FULL_VER) -#define JSON_HEDLEY_MSVC_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, \ - (_MSC_FULL_VER % 1000000) / 10000, \ - (_MSC_FULL_VER % 10000) / 10) +#define JSON_HEDLEY_MSVC_VERSION \ + JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, \ + (_MSC_FULL_VER % 1000000) / 10000, \ + (_MSC_FULL_VER % 10000) / 10) #elif defined(_MSC_VER) #define JSON_HEDLEY_MSVC_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0) + JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0) #endif #if defined(JSON_HEDLEY_MSVC_VERSION_CHECK) @@ -204,25 +205,26 @@ struct position_t { #define JSON_HEDLEY_MSVC_VERSION_CHECK(major, minor, patch) (0) #elif defined(_MSC_VER) && (_MSC_VER >= 1400) #define JSON_HEDLEY_MSVC_VERSION_CHECK(major, minor, patch) \ - (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch))) + (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch))) #elif defined(_MSC_VER) && (_MSC_VER >= 1200) #define JSON_HEDLEY_MSVC_VERSION_CHECK(major, minor, patch) \ - (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch))) + (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch))) #else #define JSON_HEDLEY_MSVC_VERSION_CHECK(major, minor, patch) \ - (_MSC_VER >= ((major * 100) + (minor))) + (_MSC_VER >= ((major * 100) + (minor))) #endif #if defined(JSON_HEDLEY_INTEL_VERSION) #undef JSON_HEDLEY_INTEL_VERSION #endif #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) -#define JSON_HEDLEY_INTEL_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, \ - __INTEL_COMPILER_UPDATE) +#define JSON_HEDLEY_INTEL_VERSION \ + JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, \ + __INTEL_COMPILER_UPDATE) #elif defined(__INTEL_COMPILER) -#define JSON_HEDLEY_INTEL_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0) +#define JSON_HEDLEY_INTEL_VERSION \ + JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, \ + 0) #endif #if defined(JSON_HEDLEY_INTEL_VERSION_CHECK) @@ -230,7 +232,8 @@ struct position_t { #endif #if defined(JSON_HEDLEY_INTEL_VERSION) #define JSON_HEDLEY_INTEL_VERSION_CHECK(major, minor, patch) \ - (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + (JSON_HEDLEY_INTEL_VERSION >= \ + JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_INTEL_VERSION_CHECK(major, minor, patch) (0) #endif @@ -241,7 +244,7 @@ struct position_t { #if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && \ defined(__PGIC_PATCHLEVEL__) #define JSON_HEDLEY_PGI_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__) + JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__) #endif #if defined(JSON_HEDLEY_PGI_VERSION_CHECK) @@ -249,7 +252,7 @@ struct position_t { #endif #if defined(JSON_HEDLEY_PGI_VERSION) #define JSON_HEDLEY_PGI_VERSION_CHECK(major, minor, patch) \ - (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_PGI_VERSION_CHECK(major, minor, patch) (0) #endif @@ -258,25 +261,25 @@ struct position_t { #undef JSON_HEDLEY_SUNPRO_VERSION #endif #if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000) -#define JSON_HEDLEY_SUNPRO_VERSION \ - JSON_HEDLEY_VERSION_ENCODE( \ - (((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), \ - (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), \ - (__SUNPRO_C & 0xf) * 10) -#elif defined(__SUNPRO_C) -#define JSON_HEDLEY_SUNPRO_VERSION \ - JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, \ - (__SUNPRO_C)&0xf) -#elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000) #define JSON_HEDLEY_SUNPRO_VERSION \ - JSON_HEDLEY_VERSION_ENCODE( \ - (((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), \ - (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), \ - (__SUNPRO_CC & 0xf) * 10) + JSON_HEDLEY_VERSION_ENCODE( \ + (((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), \ + (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), \ + (__SUNPRO_C & 0xf) * 10) +#elif defined(__SUNPRO_C) +#define JSON_HEDLEY_SUNPRO_VERSION \ + JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, \ + (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C)&0xf) +#elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000) +#define JSON_HEDLEY_SUNPRO_VERSION \ + JSON_HEDLEY_VERSION_ENCODE( \ + (((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), \ + (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), \ + (__SUNPRO_CC & 0xf) * 10) #elif defined(__SUNPRO_CC) -#define JSON_HEDLEY_SUNPRO_VERSION \ - JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, \ - (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC)&0xf) +#define JSON_HEDLEY_SUNPRO_VERSION \ + JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, \ + (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC)&0xf) #endif #if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK) @@ -284,8 +287,8 @@ struct position_t { #endif #if defined(JSON_HEDLEY_SUNPRO_VERSION) #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major, minor, patch) \ - (JSON_HEDLEY_SUNPRO_VERSION >= \ - JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + (JSON_HEDLEY_SUNPRO_VERSION >= \ + JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major, minor, patch) (0) #endif @@ -294,9 +297,9 @@ struct position_t { #undef JSON_HEDLEY_EMSCRIPTEN_VERSION #endif #if defined(__EMSCRIPTEN__) -#define JSON_HEDLEY_EMSCRIPTEN_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, \ - __EMSCRIPTEN_tiny__) +#define JSON_HEDLEY_EMSCRIPTEN_VERSION \ + JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, \ + __EMSCRIPTEN_tiny__) #endif #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK) @@ -304,8 +307,8 @@ struct position_t { #endif #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major, minor, patch) \ - (JSON_HEDLEY_EMSCRIPTEN_VERSION >= \ - JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + (JSON_HEDLEY_EMSCRIPTEN_VERSION >= \ + JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major, minor, patch) (0) #endif @@ -314,15 +317,15 @@ struct position_t { #undef JSON_HEDLEY_ARM_VERSION #endif #if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION) -#define JSON_HEDLEY_ARM_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, \ - (__ARMCOMPILER_VERSION % 1000000) / 10000, \ - (__ARMCOMPILER_VERSION % 10000) / 100) +#define JSON_HEDLEY_ARM_VERSION \ + JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, \ + (__ARMCOMPILER_VERSION % 1000000) / 10000, \ + (__ARMCOMPILER_VERSION % 10000) / 100) #elif defined(__CC_ARM) && defined(__ARMCC_VERSION) -#define JSON_HEDLEY_ARM_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, \ - (__ARMCC_VERSION % 1000000) / 10000, \ - (__ARMCC_VERSION % 10000) / 100) +#define JSON_HEDLEY_ARM_VERSION \ + JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, \ + (__ARMCC_VERSION % 1000000) / 10000, \ + (__ARMCC_VERSION % 10000) / 100) #endif #if defined(JSON_HEDLEY_ARM_VERSION_CHECK) @@ -330,7 +333,7 @@ struct position_t { #endif #if defined(JSON_HEDLEY_ARM_VERSION) #define JSON_HEDLEY_ARM_VERSION_CHECK(major, minor, patch) \ - (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_ARM_VERSION_CHECK(major, minor, patch) (0) #endif @@ -339,16 +342,16 @@ struct position_t { #undef JSON_HEDLEY_IBM_VERSION #endif #if defined(__ibmxl__) -#define JSON_HEDLEY_IBM_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, \ - __ibmxl_modification__) +#define JSON_HEDLEY_IBM_VERSION \ + JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, \ + __ibmxl_modification__) #elif defined(__xlC__) && defined(__xlC_ver__) -#define JSON_HEDLEY_IBM_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, \ - (__xlC_ver__ >> 8) & 0xff) +#define JSON_HEDLEY_IBM_VERSION \ + JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, \ + (__xlC_ver__ >> 8) & 0xff) #elif defined(__xlC__) #define JSON_HEDLEY_IBM_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0) + JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0) #endif #if defined(JSON_HEDLEY_IBM_VERSION_CHECK) @@ -356,7 +359,7 @@ struct position_t { #endif #if defined(JSON_HEDLEY_IBM_VERSION) #define JSON_HEDLEY_IBM_VERSION_CHECK(major, minor, patch) \ - (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_IBM_VERSION_CHECK(major, minor, patch) (0) #endif @@ -365,10 +368,10 @@ struct position_t { #undef JSON_HEDLEY_TI_VERSION #endif #if defined(__TI_COMPILER_VERSION__) -#define JSON_HEDLEY_TI_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, \ - (__TI_COMPILER_VERSION__ % 1000000) / 1000, \ - (__TI_COMPILER_VERSION__ % 1000)) +#define JSON_HEDLEY_TI_VERSION \ + JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, \ + (__TI_COMPILER_VERSION__ % 1000000) / 1000, \ + (__TI_COMPILER_VERSION__ % 1000)) #endif #if defined(JSON_HEDLEY_TI_VERSION_CHECK) @@ -376,7 +379,7 @@ struct position_t { #endif #if defined(JSON_HEDLEY_TI_VERSION) #define JSON_HEDLEY_TI_VERSION_CHECK(major, minor, patch) \ - (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_TI_VERSION_CHECK(major, minor, patch) (0) #endif @@ -386,12 +389,12 @@ struct position_t { #endif #if defined(_CRAYC) #if defined(_RELEASE_PATCHLEVEL) -#define JSON_HEDLEY_CRAY_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, \ - _RELEASE_PATCHLEVEL) +#define JSON_HEDLEY_CRAY_VERSION \ + JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, \ + _RELEASE_PATCHLEVEL) #else #define JSON_HEDLEY_CRAY_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0) + JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0) #endif #endif @@ -400,7 +403,8 @@ struct position_t { #endif #if defined(JSON_HEDLEY_CRAY_VERSION) #define JSON_HEDLEY_CRAY_VERSION_CHECK(major, minor, patch) \ - (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + (JSON_HEDLEY_CRAY_VERSION >= \ + JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_CRAY_VERSION_CHECK(major, minor, patch) (0) #endif @@ -410,12 +414,12 @@ struct position_t { #endif #if defined(__IAR_SYSTEMS_ICC__) #if __VER__ > 1000 -#define JSON_HEDLEY_IAR_VERSION \ - JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), \ - (__VER__ % 1000)) +#define JSON_HEDLEY_IAR_VERSION \ + JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), \ + (__VER__ % 1000)) #else #define JSON_HEDLEY_IAR_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(VER / 100, __VER__ % 100, 0) + JSON_HEDLEY_VERSION_ENCODE(VER / 100, __VER__ % 100, 0) #endif #endif @@ -424,7 +428,7 @@ struct position_t { #endif #if defined(JSON_HEDLEY_IAR_VERSION) #define JSON_HEDLEY_IAR_VERSION_CHECK(major, minor, patch) \ - (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_IAR_VERSION_CHECK(major, minor, patch) (0) #endif @@ -433,9 +437,9 @@ struct position_t { #undef JSON_HEDLEY_TINYC_VERSION #endif #if defined(__TINYC__) -#define JSON_HEDLEY_TINYC_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, \ - __TINYC__ % 100) +#define JSON_HEDLEY_TINYC_VERSION \ + JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, \ + __TINYC__ % 100) #endif #if defined(JSON_HEDLEY_TINYC_VERSION_CHECK) @@ -443,7 +447,8 @@ struct position_t { #endif #if defined(JSON_HEDLEY_TINYC_VERSION) #define JSON_HEDLEY_TINYC_VERSION_CHECK(major, minor, patch) \ - (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + (JSON_HEDLEY_TINYC_VERSION >= \ + JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_TINYC_VERSION_CHECK(major, minor, patch) (0) #endif @@ -452,8 +457,9 @@ struct position_t { #undef JSON_HEDLEY_DMC_VERSION #endif #if defined(__DMC__) -#define JSON_HEDLEY_DMC_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf) +#define JSON_HEDLEY_DMC_VERSION \ + JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, \ + __DMC__ & 0xf) #endif #if defined(JSON_HEDLEY_DMC_VERSION_CHECK) @@ -461,7 +467,7 @@ struct position_t { #endif #if defined(JSON_HEDLEY_DMC_VERSION) #define JSON_HEDLEY_DMC_VERSION_CHECK(major, minor, patch) \ - (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_DMC_VERSION_CHECK(major, minor, patch) (0) #endif @@ -470,10 +476,10 @@ struct position_t { #undef JSON_HEDLEY_COMPCERT_VERSION #endif #if defined(__COMPCERT_VERSION__) -#define JSON_HEDLEY_COMPCERT_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, \ - (__COMPCERT_VERSION__ / 100) % 100, \ - __COMPCERT_VERSION__ % 100) +#define JSON_HEDLEY_COMPCERT_VERSION \ + JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, \ + (__COMPCERT_VERSION__ / 100) % 100, \ + __COMPCERT_VERSION__ % 100) #endif #if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK) @@ -481,8 +487,8 @@ struct position_t { #endif #if defined(JSON_HEDLEY_COMPCERT_VERSION) #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major, minor, patch) \ - (JSON_HEDLEY_COMPCERT_VERSION >= \ - JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + (JSON_HEDLEY_COMPCERT_VERSION >= \ + JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major, minor, patch) (0) #endif @@ -492,7 +498,7 @@ struct position_t { #endif #if defined(__POCC__) #define JSON_HEDLEY_PELLES_VERSION \ - JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0) + JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0) #endif #if defined(JSON_HEDLEY_PELLES_VERSION_CHECK) @@ -500,8 +506,8 @@ struct position_t { #endif #if defined(JSON_HEDLEY_PELLES_VERSION) #define JSON_HEDLEY_PELLES_VERSION_CHECK(major, minor, patch) \ - (JSON_HEDLEY_PELLES_VERSION >= \ - JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + (JSON_HEDLEY_PELLES_VERSION >= \ + JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_PELLES_VERSION_CHECK(major, minor, patch) (0) #endif @@ -521,7 +527,7 @@ struct position_t { #endif #if defined(JSON_HEDLEY_GCC_VERSION) #define JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) \ - (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else #define JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) (0) #endif @@ -540,10 +546,10 @@ struct position_t { #endif #if defined(__has_attribute) #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute, major, minor, patch) \ - __has_attribute(attribute) + __has_attribute(attribute) #else #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute, major, minor, patch) \ - JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) + JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE) @@ -551,10 +557,10 @@ struct position_t { #endif #if defined(__has_attribute) #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute, major, minor, patch) \ - __has_attribute(attribute) + __has_attribute(attribute) #else #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute, major, minor, patch) \ - JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) + JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) #endif #if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE) @@ -579,7 +585,7 @@ struct position_t { (!defined(JSON_HEDLEY_MSVC_VERSION) || \ JSON_HEDLEY_MSVC_VERSION_CHECK(19, 20, 0)) #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns, attribute) \ - JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute) + JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute) #else #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns, attribute) (0) #endif @@ -589,10 +595,10 @@ struct position_t { #endif #if defined(__has_cpp_attribute) && defined(__cplusplus) #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute, major, minor, patch) \ - __has_cpp_attribute(attribute) + __has_cpp_attribute(attribute) #else #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute, major, minor, patch) \ - JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) + JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE) @@ -600,10 +606,10 @@ struct position_t { #endif #if defined(__has_cpp_attribute) && defined(__cplusplus) #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute, major, minor, patch) \ - __has_cpp_attribute(attribute) + __has_cpp_attribute(attribute) #else #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute, major, minor, patch) \ - JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) + JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) #endif #if defined(JSON_HEDLEY_HAS_BUILTIN) @@ -620,10 +626,10 @@ struct position_t { #endif #if defined(__has_builtin) #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin, major, minor, patch) \ - __has_builtin(builtin) + __has_builtin(builtin) #else #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin, major, minor, patch) \ - JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) + JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_BUILTIN) @@ -631,10 +637,10 @@ struct position_t { #endif #if defined(__has_builtin) #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin, major, minor, patch) \ - __has_builtin(builtin) + __has_builtin(builtin) #else #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin, major, minor, patch) \ - JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) + JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) #endif #if defined(JSON_HEDLEY_HAS_FEATURE) @@ -651,10 +657,10 @@ struct position_t { #endif #if defined(__has_feature) #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature, major, minor, patch) \ - __has_feature(feature) + __has_feature(feature) #else #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature, major, minor, patch) \ - JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) + JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_FEATURE) @@ -662,10 +668,10 @@ struct position_t { #endif #if defined(__has_feature) #define JSON_HEDLEY_GCC_HAS_FEATURE(feature, major, minor, patch) \ - __has_feature(feature) + __has_feature(feature) #else #define JSON_HEDLEY_GCC_HAS_FEATURE(feature, major, minor, patch) \ - JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) + JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) #endif #if defined(JSON_HEDLEY_HAS_EXTENSION) @@ -682,10 +688,10 @@ struct position_t { #endif #if defined(__has_extension) #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension, major, minor, patch) \ - __has_extension(extension) + __has_extension(extension) #else #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension, major, minor, patch) \ - JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) + JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_EXTENSION) @@ -693,10 +699,10 @@ struct position_t { #endif #if defined(__has_extension) #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension, major, minor, patch) \ - __has_extension(extension) + __has_extension(extension) #else #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension, major, minor, patch) \ - JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) + JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) #endif #if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE) @@ -704,7 +710,7 @@ struct position_t { #endif #if defined(__has_declspec_attribute) #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) \ - __has_declspec_attribute(attribute) + __has_declspec_attribute(attribute) #else #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0) #endif @@ -715,11 +721,11 @@ struct position_t { #if defined(__has_declspec_attribute) #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute, major, minor, \ patch) \ - __has_declspec_attribute(attribute) + __has_declspec_attribute(attribute) #else #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute, major, minor, \ patch) \ - JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) + JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE) @@ -727,10 +733,10 @@ struct position_t { #endif #if defined(__has_declspec_attribute) #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute, major, minor, patch) \ - __has_declspec_attribute(attribute) + __has_declspec_attribute(attribute) #else #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute, major, minor, patch) \ - JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) + JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) #endif #if defined(JSON_HEDLEY_HAS_WARNING) @@ -747,10 +753,10 @@ struct position_t { #endif #if defined(__has_warning) #define JSON_HEDLEY_GNUC_HAS_WARNING(warning, major, minor, patch) \ - __has_warning(warning) + __has_warning(warning) #else #define JSON_HEDLEY_GNUC_HAS_WARNING(warning, major, minor, patch) \ - JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) + JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) #endif #if defined(JSON_HEDLEY_GCC_HAS_WARNING) @@ -758,10 +764,10 @@ struct position_t { #endif #if defined(__has_warning) #define JSON_HEDLEY_GCC_HAS_WARNING(warning, major, minor, patch) \ - __has_warning(warning) + __has_warning(warning) #else #define JSON_HEDLEY_GCC_HAS_WARNING(warning, major, minor, patch) \ - JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) + JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) #endif /* JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ is for @@ -771,9 +777,9 @@ struct position_t { #endif #if defined(__cplusplus) && JSON_HEDLEY_HAS_WARNING("-Wc++98-compat") #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ - xpr JSON_HEDLEY_DIAGNOSTIC_POP + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + xpr JSON_HEDLEY_DIAGNOSTIC_POP #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x #endif @@ -834,31 +840,31 @@ struct position_t { #endif #if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations") #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \ - _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") + _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \ - _Pragma("warning(disable:1478 1786)") + _Pragma("warning(disable:1478 1786)") #elif JSON_HEDLEY_PGI_VERSION_CHECK(17, 10, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \ - _Pragma("diag_suppress 1215,1444") + _Pragma("diag_suppress 1215,1444") #elif JSON_HEDLEY_GCC_VERSION_CHECK(4, 3, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \ - _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \ - __pragma(warning(disable : 4996)) + __pragma(warning(disable : 4996)) #elif JSON_HEDLEY_TI_VERSION_CHECK(8, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \ - _Pragma("diag_suppress 1291,1718") + _Pragma("diag_suppress 1291,1718") #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 13, 0) && !defined(__cplusplus) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \ - _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") + _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 13, 0) && defined(__cplusplus) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \ - _Pragma("error_messages(off,symdeprecated,symdeprecated2)") + _Pragma("error_messages(off,symdeprecated,symdeprecated2)") #elif JSON_HEDLEY_IAR_VERSION_CHECK(8, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED \ - _Pragma("diag_suppress=Pe1444,Pe1215") + _Pragma("diag_suppress=Pe1444,Pe1215") #elif JSON_HEDLEY_PELLES_VERSION_CHECK(2, 90, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)") #else @@ -870,25 +876,25 @@ struct position_t { #endif #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ - _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") + _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ - _Pragma("warning(disable:161)") + _Pragma("warning(disable:161)") #elif JSON_HEDLEY_PGI_VERSION_CHECK(17, 10, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ - _Pragma("diag_suppress 1675") + _Pragma("diag_suppress 1675") #elif JSON_HEDLEY_GCC_VERSION_CHECK(4, 3, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ - _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"") + _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"") #elif JSON_HEDLEY_MSVC_VERSION_CHECK(15, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ - __pragma(warning(disable : 4068)) + __pragma(warning(disable : 4068)) #elif JSON_HEDLEY_TI_VERSION_CHECK(8, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ - _Pragma("diag_suppress 163") + _Pragma("diag_suppress 163") #elif JSON_HEDLEY_IAR_VERSION_CHECK(8, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ - _Pragma("diag_suppress=Pe161") + _Pragma("diag_suppress=Pe161") #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS #endif @@ -898,25 +904,25 @@ struct position_t { #endif #if JSON_HEDLEY_HAS_WARNING("-Wunknown-attributes") #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES \ - _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"") + _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"") #elif JSON_HEDLEY_GCC_VERSION_CHECK(4, 6, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES \ - _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") #elif JSON_HEDLEY_INTEL_VERSION_CHECK(17, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES \ - _Pragma("warning(disable:1292)") + _Pragma("warning(disable:1292)") #elif JSON_HEDLEY_MSVC_VERSION_CHECK(19, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES \ - __pragma(warning(disable : 5030)) + __pragma(warning(disable : 5030)) #elif JSON_HEDLEY_PGI_VERSION_CHECK(17, 10, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES \ - _Pragma("diag_suppress 1097") + _Pragma("diag_suppress 1097") #elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 14, 0) && defined(__cplusplus) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES \ - _Pragma("error_messages(off,attrskipunsup)") + _Pragma("error_messages(off,attrskipunsup)") #elif JSON_HEDLEY_TI_VERSION_CHECK(8, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES \ - _Pragma("diag_suppress 1173") + _Pragma("diag_suppress 1173") #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES #endif @@ -926,13 +932,13 @@ struct position_t { #endif #if JSON_HEDLEY_HAS_WARNING("-Wcast-qual") #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ - _Pragma("clang diagnostic ignored \"-Wcast-qual\"") + _Pragma("clang diagnostic ignored \"-Wcast-qual\"") #elif JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ - _Pragma("warning(disable:2203 2331)") + _Pragma("warning(disable:2203 2331)") #elif JSON_HEDLEY_GCC_VERSION_CHECK(3, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ - _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") + _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL #endif @@ -944,12 +950,12 @@ struct position_t { #undef JSON_HEDLEY_DEPRECATED_FOR #endif #if defined(__cplusplus) && (__cplusplus >= 201402L) -#define JSON_HEDLEY_DEPRECATED(since) \ - JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_( \ - [[deprecated("Since " #since)]]) +#define JSON_HEDLEY_DEPRECATED(since) \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_( \ + [[deprecated("Since " #since)]]) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) \ - JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_( \ - [[deprecated("Since " #since "; use " #replacement)]]) + JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_( \ + [[deprecated("Since " #since "; use " #replacement)]]) #elif JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) || \ JSON_HEDLEY_GCC_VERSION_CHECK(4, 5, 0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ @@ -958,9 +964,9 @@ struct position_t { JSON_HEDLEY_PGI_VERSION_CHECK(17, 10, 0) || \ JSON_HEDLEY_TI_VERSION_CHECK(8, 3, 0) #define JSON_HEDLEY_DEPRECATED(since) \ - __attribute__((__deprecated__("Since " #since))) + __attribute__((__deprecated__("Since " #since))) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) \ - __attribute__((__deprecated__("Since " #since "; use " #replacement))) + __attribute__((__deprecated__("Since " #since "; use " #replacement))) #elif JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3, 1, 0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \ @@ -969,11 +975,11 @@ struct position_t { defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__)) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) \ - __attribute__((__deprecated__)) + __attribute__((__deprecated__)) #elif JSON_HEDLEY_MSVC_VERSION_CHECK(14, 0, 0) #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " #since)) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) \ - __declspec(deprecated("Since " #since "; use " #replacement)) + __declspec(deprecated("Since " #since "; use " #replacement)) #elif JSON_HEDLEY_MSVC_VERSION_CHECK(13, 10, 0) || \ JSON_HEDLEY_PELLES_VERSION_CHECK(6, 50, 0) #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated) @@ -993,7 +999,7 @@ struct position_t { JSON_HEDLEY_GCC_VERSION_CHECK(4, 3, 0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) #define JSON_HEDLEY_UNAVAILABLE(available_since) \ - __attribute__((__warning__("Not available until " #available_since))) + __attribute__((__warning__("Not available until " #available_since))) #else #define JSON_HEDLEY_UNAVAILABLE(available_since) #endif @@ -1003,7 +1009,7 @@ struct position_t { #endif #if defined(__cplusplus) && (__cplusplus >= 201703L) #define JSON_HEDLEY_WARN_UNUSED_RESULT \ - JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) + JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) #elif JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3, 4, 0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ @@ -1042,7 +1048,7 @@ struct position_t { #define JSON_HEDLEY_NO_RETURN _Noreturn #elif defined(__cplusplus) && (__cplusplus >= 201103L) #define JSON_HEDLEY_NO_RETURN \ - JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]]) + JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]]) #elif JSON_HEDLEY_HAS_ATTRIBUTE(noreturn) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3, 2, 0) || \ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \ @@ -1126,7 +1132,7 @@ struct position_t { JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ JSON_HEDLEY_IBM_VERSION_CHECK(13, 1, 5) #define JSON_HEDLEY_ASSUME(expr) \ - ((void)((expr) ? 1 : (__builtin_unreachable(), 1))) + ((void)((expr) ? 1 : (__builtin_unreachable(), 1))) #else #define JSON_HEDLEY_ASSUME(expr) ((void)(expr)) #endif @@ -1164,12 +1170,12 @@ JSON_HEDLEY_DIAGNOSTIC_POP #if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format, 4, 4, 0) && \ !defined(__USE_MINGW_ANSI_STDIO) #define JSON_HEDLEY_PRINTF_FORMAT(string_idx, first_to_check) \ - __attribute__((__format__(ms_printf, string_idx, first_to_check))) + __attribute__((__format__(ms_printf, string_idx, first_to_check))) #elif defined(__MINGW32__) && \ JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format, 4, 4, 0) && \ defined(__USE_MINGW_ANSI_STDIO) #define JSON_HEDLEY_PRINTF_FORMAT(string_idx, first_to_check) \ - __attribute__((__format__(gnu_printf, string_idx, first_to_check))) + __attribute__((__format__(gnu_printf, string_idx, first_to_check))) #elif JSON_HEDLEY_HAS_ATTRIBUTE(format) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3, 1, 0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ @@ -1179,10 +1185,10 @@ JSON_HEDLEY_DIAGNOSTIC_POP (JSON_HEDLEY_TI_VERSION_CHECK(7, 3, 0) && \ defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) #define JSON_HEDLEY_PRINTF_FORMAT(string_idx, first_to_check) \ - __attribute__((__format__(__printf__, string_idx, first_to_check))) + __attribute__((__format__(__printf__, string_idx, first_to_check))) #elif JSON_HEDLEY_PELLES_VERSION_CHECK(6, 0, 0) #define JSON_HEDLEY_PRINTF_FORMAT(string_idx, first_to_check) \ - __declspec(vaformat(printf, string_idx, first_to_check)) + __declspec(vaformat(printf, string_idx, first_to_check)) #else #define JSON_HEDLEY_PRINTF_FORMAT(string_idx, first_to_check) #endif @@ -1193,7 +1199,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP #if defined(__cplusplus) #if __cplusplus >= 201103L #define JSON_HEDLEY_CONSTEXPR \ - JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr) + JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr) #endif #endif #if !defined(JSON_HEDLEY_CONSTEXPR) @@ -1218,16 +1224,16 @@ JSON_HEDLEY_DIAGNOSTIC_POP #if JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) || \ JSON_HEDLEY_GCC_VERSION_CHECK(9, 0, 0) #define JSON_HEDLEY_PREDICT(expr, value, probability) \ - __builtin_expect_with_probability(expr, value, probability) + __builtin_expect_with_probability(expr, value, probability) #define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \ - __builtin_expect_with_probability(!!(expr), 1, probability) + __builtin_expect_with_probability(!!(expr), 1, probability) #define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \ - __builtin_expect_with_probability(!!(expr), 0, probability) + __builtin_expect_with_probability(!!(expr), 0, probability) #define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) #define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) #if !defined(JSON_HEDLEY_BUILTIN_UNPREDICTABLE) #define JSON_HEDLEY_BUILTIN_UNPREDICTABLE(expr) \ - __builtin_expect_with_probability(!!(expr), 1, 0.5) + __builtin_expect_with_probability(!!(expr), 1, 0.5) #endif #elif JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) || \ JSON_HEDLEY_GCC_VERSION_CHECK(3, 0, 0) || \ @@ -1237,30 +1243,30 @@ JSON_HEDLEY_DIAGNOSTIC_POP JSON_HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \ JSON_HEDLEY_TI_VERSION_CHECK(6, 1, 0) || \ JSON_HEDLEY_TINYC_VERSION_CHECK(0, 9, 27) -#define JSON_HEDLEY_PREDICT(expr, expected, probability) \ - (((probability) >= 0.9) ? __builtin_expect(!!(expr), (expected)) \ - : (((void)(expected)), !!(expr))) -#define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \ - (__extension__({ \ - JSON_HEDLEY_CONSTEXPR double hedley_probability_ = (probability); \ - ((hedley_probability_ >= 0.9) \ - ? __builtin_expect(!!(expr), 1) \ - : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) \ - : !!(expr))); \ - })) -#define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \ - (__extension__({ \ - JSON_HEDLEY_CONSTEXPR double hedley_probability_ = (probability); \ - ((hedley_probability_ >= 0.9) \ - ? __builtin_expect(!!(expr), 0) \ - : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) \ - : !!(expr))); \ - })) +#define JSON_HEDLEY_PREDICT(expr, expected, probability) \ + (((probability) >= 0.9) ? __builtin_expect(!!(expr), (expected)) \ + : (((void)(expected)), !!(expr))) +#define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \ + (__extension__({ \ + JSON_HEDLEY_CONSTEXPR double hedley_probability_ = (probability); \ + ((hedley_probability_ >= 0.9) \ + ? __builtin_expect(!!(expr), 1) \ + : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) \ + : !!(expr))); \ + })) +#define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \ + (__extension__({ \ + JSON_HEDLEY_CONSTEXPR double hedley_probability_ = (probability); \ + ((hedley_probability_ >= 0.9) \ + ? __builtin_expect(!!(expr), 0) \ + : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) \ + : !!(expr))); \ + })) #define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) #define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) #else #define JSON_HEDLEY_PREDICT(expr, expected, probability) \ - (((void)(expected)), !!(expr)) + (((void)(expected)), !!(expr)) #define JSON_HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr)) #define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr)) #define JSON_HEDLEY_LIKELY(expr) (!!(expr)) @@ -1384,7 +1390,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP (JSON_HEDLEY_TI_VERSION_CHECK(7, 3, 0) && \ defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) #define JSON_HEDLEY_ALWAYS_INLINE \ - __attribute__((__always_inline__)) JSON_HEDLEY_INLINE + __attribute__((__always_inline__)) JSON_HEDLEY_INLINE #elif JSON_HEDLEY_MSVC_VERSION_CHECK(12, 0, 0) #define JSON_HEDLEY_ALWAYS_INLINE __forceinline #elif JSON_HEDLEY_TI_VERSION_CHECK(7, 0, 0) && defined(__cplusplus) @@ -1478,10 +1484,10 @@ JSON_HEDLEY_DIAGNOSTIC_POP #define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__)) #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang, fallthrough) #define JSON_HEDLEY_FALL_THROUGH \ - JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]]) + JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]]) #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough) #define JSON_HEDLEY_FALL_THROUGH \ - JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]]) + JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]]) #elif defined(__fallthrough) /* SAL */ #define JSON_HEDLEY_FALL_THROUGH __fallthrough #else @@ -1542,14 +1548,15 @@ JSON_HEDLEY_DIAGNOSTIC_POP JSON_HEDLEY_ARM_VERSION_CHECK(5, 4, 0) || \ JSON_HEDLEY_TINYC_VERSION_CHECK(0, 9, 24) #if defined(__INTPTR_TYPE__) -#define JSON_HEDLEY_IS_CONSTEXPR_(expr) \ - __builtin_types_compatible_p( \ - __typeof__((1 ? (void*)((__INTPTR_TYPE__)((expr)*0)) : (int*)0)), int*) +#define JSON_HEDLEY_IS_CONSTEXPR_(expr) \ + __builtin_types_compatible_p( \ + __typeof__((1 ? (void*)((__INTPTR_TYPE__)((expr)*0)) : (int*)0)), \ + int*) #else #include #define JSON_HEDLEY_IS_CONSTEXPR_(expr) \ - __builtin_types_compatible_p( \ - __typeof__((1 ? (void*)((intptr_t)((expr)*0)) : (int*)0)), int*) + __builtin_types_compatible_p( \ + __typeof__((1 ? (void*)((intptr_t)((expr)*0)) : (int*)0)), int*) #endif #elif(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ !defined(JSON_HEDLEY_SUNPRO_VERSION) && \ @@ -1560,21 +1567,22 @@ JSON_HEDLEY_DIAGNOSTIC_POP JSON_HEDLEY_IBM_VERSION_CHECK(12, 1, 0) || \ JSON_HEDLEY_ARM_VERSION_CHECK(5, 3, 0) #if defined(__INTPTR_TYPE__) -#define JSON_HEDLEY_IS_CONSTEXPR_(expr) \ - _Generic((1 ? (void*)((__INTPTR_TYPE__)((expr)*0)) : (int*)0), int* : 1, \ - void* : 0) +#define JSON_HEDLEY_IS_CONSTEXPR_(expr) \ + _Generic((1 ? (void*)((__INTPTR_TYPE__)((expr)*0)) : (int*)0), int* : 1, \ + void* : 0) #else #include #define JSON_HEDLEY_IS_CONSTEXPR_(expr) \ - _Generic((1 ? (void*)((intptr_t)*0) : (int*)0), int* : 1, void* : 0) + _Generic((1 ? (void*)((intptr_t)*0) : (int*)0), int* : 1, void* : 0) #endif #elif defined(JSON_HEDLEY_GCC_VERSION) || \ defined(JSON_HEDLEY_INTEL_VERSION) || \ defined(JSON_HEDLEY_TINYC_VERSION) || defined(JSON_HEDLEY_TI_VERSION) || \ defined(__clang__) -#define JSON_HEDLEY_IS_CONSTEXPR_(expr) \ - (sizeof(void) != sizeof(*(1 ? ((void*)((expr)*0L)) \ - : ((struct { char v[sizeof(void) * 2]; }*)1)))) +#define JSON_HEDLEY_IS_CONSTEXPR_(expr) \ + (sizeof(void) != sizeof(*(1 ? ((void*)((expr)*0L)) : ((struct { \ + char v[sizeof(void) * 2]; \ + }*)1)))) #endif #endif #if defined(JSON_HEDLEY_IS_CONSTEXPR_) @@ -1582,7 +1590,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP #define JSON_HEDLEY_IS_CONSTANT(expr) JSON_HEDLEY_IS_CONSTEXPR_(expr) #endif #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) \ - (JSON_HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1)) + (JSON_HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1)) #else #if !defined(JSON_HEDLEY_IS_CONSTANT) #define JSON_HEDLEY_IS_CONSTANT(expr) (0) @@ -1621,9 +1629,9 @@ JSON_HEDLEY_DIAGNOSTIC_POP #elif(defined(__cplusplus) && (__cplusplus >= 201103L)) || \ JSON_HEDLEY_MSVC_VERSION_CHECK(16, 0, 0) || \ (defined(__cplusplus) && JSON_HEDLEY_TI_VERSION_CHECK(8, 3, 0)) -#define JSON_HEDLEY_STATIC_ASSERT(expr, message) \ - JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_( \ - static_assert(expr, message)) +#define JSON_HEDLEY_STATIC_ASSERT(expr, message) \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_( \ + static_assert(expr, message)) #else #define JSON_HEDLEY_STATIC_ASSERT(expr, message) #endif @@ -1636,12 +1644,12 @@ JSON_HEDLEY_DIAGNOSTIC_POP #elif JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \ JSON_HEDLEY_GCC_VERSION_CHECK(4, 6, 0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) -#define JSON_HEDLEY_CONST_CAST(T, expr) \ - (__extension__({ \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL((T)(expr)); \ - JSON_HEDLEY_DIAGNOSTIC_POP \ - })) +#define JSON_HEDLEY_CONST_CAST(T, expr) \ + (__extension__({ \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL((T)(expr)); \ + JSON_HEDLEY_DIAGNOSTIC_POP \ + })) #else #define JSON_HEDLEY_CONST_CAST(T, expr) ((T)(expr)) #endif @@ -1679,7 +1687,7 @@ JSON_HEDLEY_DIAGNOSTIC_POP #if defined(__cplusplus) #if __cplusplus >= 201103L #define JSON_HEDLEY_NULL \ - JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr) + JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr) #elif defined(NULL) #define JSON_HEDLEY_NULL NULL #else @@ -1695,11 +1703,11 @@ JSON_HEDLEY_DIAGNOSTIC_POP #undef JSON_HEDLEY_MESSAGE #endif #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") -#define JSON_HEDLEY_MESSAGE(msg) \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ - JSON_HEDLEY_PRAGMA(message msg) \ - JSON_HEDLEY_DIAGNOSTIC_POP +#define JSON_HEDLEY_MESSAGE(msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ + JSON_HEDLEY_PRAGMA(message msg) \ + JSON_HEDLEY_DIAGNOSTIC_POP #elif JSON_HEDLEY_GCC_VERSION_CHECK(4, 4, 0) || \ JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) #define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message msg) @@ -1717,11 +1725,11 @@ JSON_HEDLEY_DIAGNOSTIC_POP #undef JSON_HEDLEY_WARNING #endif #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") -#define JSON_HEDLEY_WARNING(msg) \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ - JSON_HEDLEY_PRAGMA(clang warning msg) \ - JSON_HEDLEY_DIAGNOSTIC_POP +#define JSON_HEDLEY_WARNING(msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ + JSON_HEDLEY_PRAGMA(clang warning msg) \ + JSON_HEDLEY_DIAGNOSTIC_POP #elif JSON_HEDLEY_GCC_VERSION_CHECK(4, 8, 0) || \ JSON_HEDLEY_PGI_VERSION_CHECK(18, 4, 0) #define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg) @@ -1739,21 +1747,21 @@ JSON_HEDLEY_DIAGNOSTIC_POP #endif #if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if) #if JSON_HEDLEY_HAS_WARNING("-Wgcc-compat") -#define JSON_HEDLEY_REQUIRE(expr) \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ - __attribute__((diagnose_if(!(expr), #expr, "error"))) \ - JSON_HEDLEY_DIAGNOSTIC_POP -#define JSON_HEDLEY_REQUIRE_MSG(expr, msg) \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ - __attribute__((diagnose_if(!(expr), msg, "error"))) \ - JSON_HEDLEY_DIAGNOSTIC_POP +#define JSON_HEDLEY_REQUIRE(expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ + __attribute__((diagnose_if(!(expr), #expr, "error"))) \ + JSON_HEDLEY_DIAGNOSTIC_POP +#define JSON_HEDLEY_REQUIRE_MSG(expr, msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ + __attribute__((diagnose_if(!(expr), msg, "error"))) \ + JSON_HEDLEY_DIAGNOSTIC_POP #else #define JSON_HEDLEY_REQUIRE(expr) \ - __attribute__((diagnose_if(!(expr), #expr, "error"))) + __attribute__((diagnose_if(!(expr), #expr, "error"))) #define JSON_HEDLEY_REQUIRE_MSG(expr, msg) \ - __attribute__((diagnose_if(!(expr), msg, "error"))) + __attribute__((diagnose_if(!(expr), msg, "error"))) #endif #else #define JSON_HEDLEY_REQUIRE(expr) @@ -1771,12 +1779,12 @@ JSON_HEDLEY_DIAGNOSTIC_POP #undef JSON_HEDLEY_FLAGS_CAST #endif #if JSON_HEDLEY_INTEL_VERSION_CHECK(19, 0, 0) -#define JSON_HEDLEY_FLAGS_CAST(T, expr) \ - (__extension__({ \ - JSON_HEDLEY_DIAGNOSTIC_PUSH \ - _Pragma("warning(disable:188)")((T)(expr)); \ - JSON_HEDLEY_DIAGNOSTIC_POP \ - })) +#define JSON_HEDLEY_FLAGS_CAST(T, expr) \ + (__extension__({ \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("warning(disable:188)")((T)(expr)); \ + JSON_HEDLEY_DIAGNOSTIC_POP \ + })) #else #define JSON_HEDLEY_FLAGS_CAST(T, expr) JSON_HEDLEY_STATIC_CAST(T, expr) #endif @@ -1800,20 +1808,20 @@ JSON_HEDLEY_DIAGNOSTIC_POP #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major, minor, patch) (0) #else #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major, minor, patch) \ - JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) + JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) #endif #if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE) #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE #endif #define JSON_HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) \ - JSON_HEDLEY_HAS_ATTRIBUTE(attribute) + JSON_HEDLEY_HAS_ATTRIBUTE(attribute) #if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE) #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE #endif #define JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) \ - JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) + JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) #if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN) #undef JSON_HEDLEY_CLANG_HAS_BUILTIN @@ -1829,13 +1837,13 @@ JSON_HEDLEY_DIAGNOSTIC_POP #undef JSON_HEDLEY_CLANG_HAS_EXTENSION #endif #define JSON_HEDLEY_CLANG_HAS_EXTENSION(extension) \ - JSON_HEDLEY_HAS_EXTENSION(extension) + JSON_HEDLEY_HAS_EXTENSION(extension) #if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE) #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE #endif #define JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) \ - JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) + JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) #if defined(JSON_HEDLEY_CLANG_HAS_WARNING) #undef JSON_HEDLEY_CLANG_HAS_WARNING @@ -1927,47 +1935,47 @@ JSON_HEDLEY_DIAGNOSTIC_POP @def NLOHMANN_JSON_SERIALIZE_ENUM @since version 3.4.0 */ -#define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \ - template \ - inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) { \ - static_assert(std::is_enum::value, \ - #ENUM_TYPE " must be an enum!"); \ - static const std::pair m[] = __VA_ARGS__; \ - auto it = std::find_if( \ - std::begin(m), std::end(m), \ - [e](const std::pair& ej_pair) -> bool { \ - return ej_pair.first == e; \ - }); \ - j = ((it != std::end(m)) ? it : std::begin(m))->second; \ - } \ - template \ - inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) { \ - static_assert(std::is_enum::value, \ - #ENUM_TYPE " must be an enum!"); \ - static const std::pair m[] = __VA_ARGS__; \ - auto it = std::find_if( \ - std::begin(m), std::end(m), \ - [&j](const std::pair& ej_pair) -> bool { \ - return ej_pair.second == j; \ - }); \ - e = ((it != std::end(m)) ? it : std::begin(m))->first; \ - } +#define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \ + template \ + inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) { \ + static_assert(std::is_enum::value, \ + #ENUM_TYPE " must be an enum!"); \ + static const std::pair m[] = __VA_ARGS__; \ + auto it = std::find_if( \ + std::begin(m), std::end(m), \ + [e](const std::pair& ej_pair) -> bool { \ + return ej_pair.first == e; \ + }); \ + j = ((it != std::end(m)) ? it : std::begin(m))->second; \ + } \ + template \ + inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) { \ + static_assert(std::is_enum::value, \ + #ENUM_TYPE " must be an enum!"); \ + static const std::pair m[] = __VA_ARGS__; \ + auto it = std::find_if( \ + std::begin(m), std::end(m), \ + [&j](const std::pair& ej_pair) -> bool { \ + return ej_pair.second == j; \ + }); \ + e = ((it != std::end(m)) ? it : std::begin(m))->first; \ + } // Ugly macros to avoid uglier copy-paste when specializing basic_json. They // may be removed in the future once the class is split. -#define NLOHMANN_BASIC_JSON_TPL_DECLARATION \ - template