Files
json/src/modules/json.cppm
T
Hariom Phulre bb5404bb86 Fix GCC C++20 modules compilation #5103 (#5164)
* 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>
2026-05-15 17:04:42 +02:00

53 lines
1.8 KiB
C++

// __ _____ _____ _____
// __| | __| | | | JSON for Modern C++
// | | |__ | | | | | | version 3.12.0
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2026 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
module;
// GCC workaround for C++ modules support.
// When using C++20 modules, some compilers (particularly GCC) may have issues
// with template instantiations in the module preamble. If you encounter
// "redefinition" errors when including nlohmann/json.hpp, try one of:
// 1. Include nlohmann/json.hpp in your module preamble BEFORE other #includes
// 2. Or use: import nlohmann.json; instead of #include <nlohmann/json.hpp>
// 3. Or upgrade to a newer GCC version with better modules support.
// See: https://github.com/nlohmann/json/issues/5103
#include <nlohmann/json.hpp>
export module nlohmann.json;
export
NLOHMANN_JSON_NAMESPACE_BEGIN
using NLOHMANN_JSON_NAMESPACE::adl_serializer;
using NLOHMANN_JSON_NAMESPACE::basic_json;
using NLOHMANN_JSON_NAMESPACE::json;
using NLOHMANN_JSON_NAMESPACE::json_pointer;
using NLOHMANN_JSON_NAMESPACE::ordered_json;
using NLOHMANN_JSON_NAMESPACE::ordered_map;
using NLOHMANN_JSON_NAMESPACE::to_string;
inline namespace literals
{
inline namespace json_literals
{
using NLOHMANN_JSON_NAMESPACE::literals::json_literals::operator""_json;
using NLOHMANN_JSON_NAMESPACE::literals::json_literals::operator""_json_pointer;
} // namespace json_literals
} // namespace literals
// Note: the following nlohmann::detail symbols must be exported due to
// an MSVC bug failing to compile without these symbols visible (ticket #3970)
namespace detail
{
using NLOHMANN_JSON_NAMESPACE::detail::json_sax_dom_callback_parser;
using NLOHMANN_JSON_NAMESPACE::detail::unknown_size;
} // namespace detail
NLOHMANN_JSON_NAMESPACE_END