mirror of
https://github.com/nlohmann/json.git
synced 2026-05-16 03:05:23 +00:00
* Fix: Add GCC diagnostic pragmas for C++ modules support (issue #5103) Signed-off-by: hariomphulre <hariiomphullre@gmail.com> * Fix: GCC C++20 modules with __cplusplus >= 202002L check (#5103) Signed-off-by: hariomphulre <hariiomphullre@gmail.com> Signed-off-by: hariomphulre <hariiomphullre@gmail.com> * Fix: Remove indentation from nested preprocessor directives and disable astyle preprocessor indentation Signed-off-by: hariomphulre <hariiomphullre@gmail.com> * Update amalgamated files with correct preprocessor directive indentation Signed-off-by: hariomphulre <hariiomphullre@gmail.com> * Fix GCC build for issue #5103; refresh amalgamated header Signed-off-by: hariomphulre <hariiomphullre@gmail.com> --------- Signed-off-by: hariomphulre <hariiomphullre@gmail.com>
This commit is contained in:
@@ -18,6 +18,16 @@
|
||||
#ifndef INCLUDE_NLOHMANN_JSON_HPP_
|
||||
#define INCLUDE_NLOHMANN_JSON_HPP_
|
||||
|
||||
// Workaround for GCC template redefinition errors in C++ modules
|
||||
// When nlohmann/json.hpp is included in a C++20 module preamble after
|
||||
// other module imports, GCC may report spurious redefinition errors for
|
||||
// STL templates. These pragmas suppress those false positives.
|
||||
// See: https://github.com/nlohmann/json/issues/5103
|
||||
#if defined(__GNUC__) && !defined(__clang__) && __cplusplus >= 202002L
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wignored-attributes"
|
||||
#endif
|
||||
|
||||
#include <algorithm> // all_of, find, for_each
|
||||
#include <cstddef> // nullptr_t, ptrdiff_t, size_t
|
||||
#include <functional> // hash, less
|
||||
@@ -5344,4 +5354,9 @@ inline void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL& j1, nlohmann::NLOHMANN_BASIC
|
||||
|
||||
#include <nlohmann/detail/macro_unscope.hpp>
|
||||
|
||||
// End of GCC diagnostic pragmas for C++ modules support
|
||||
#if defined(__GNUC__) && !defined(__clang__) && __cplusplus >= 202002L
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // INCLUDE_NLOHMANN_JSON_HPP_
|
||||
|
||||
Reference in New Issue
Block a user