mirror of
https://github.com/nlohmann/json.git
synced 2026-10-08 23:47:13 +00:00
GCC ignores the target attribute in modules, so the SSSE3 dispatch is disabled for the module interface (the check stays portable, SSE2 is kept). Make the 8-vs-16 byte unrolling condition in scan_string_run a preprocessor/template split to avoid a constant condition (C4127). Signed-off-by: Niels Lohmann <mail@nlohmann.me>
67 lines
2.4 KiB
C++
67 lines
2.4 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
|
|
|
|
// GCC ignores the target attribute in modules ("'target' attribute currently
|
|
// unsupported in modules") and then rejects the SSSE3 intrinsics of json_view.
|
|
#if defined(__GNUC__) && !defined(__clang__)
|
|
#define NLOHMANN_VIEW_NO_TARGET_ATTRIBUTE
|
|
#endif
|
|
|
|
#include <nlohmann/json.hpp>
|
|
#include <nlohmann/json_literals.hpp>
|
|
#include <nlohmann/json_view.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::basic_json_document;
|
|
using NLOHMANN_JSON_NAMESPACE::basic_json_view;
|
|
using NLOHMANN_JSON_NAMESPACE::json;
|
|
using NLOHMANN_JSON_NAMESPACE::json_document;
|
|
using NLOHMANN_JSON_NAMESPACE::json_pointer;
|
|
using NLOHMANN_JSON_NAMESPACE::json_view;
|
|
using NLOHMANN_JSON_NAMESPACE::ordered_json;
|
|
using NLOHMANN_JSON_NAMESPACE::ordered_json_document;
|
|
using NLOHMANN_JSON_NAMESPACE::ordered_json_view;
|
|
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
|