You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(pkgs): nlohmann.json + compat.eigen generated_files -> Lua long brackets (P3)
Mechanical migration of the escaped single-line generated_files strings to
[==[ ... ]==] long-bracket form (mcpp >= 0.0.85; the P1 floor gates this).
Reviewability is the point: module wrapper sources become readable
multi-line code instead of multi-KB one-liners.
Verified: parity oracle — `mcpp xpkg parse --json` generated_contents
byte-identical before/after for both; lua5.4 loadfile green (xim side
still executes these); nlohmann.json and eigen member tests pass.
Copy file name to clipboardExpand all lines: pkgs/n/nlohmann.json.lua
+46-1Lines changed: 46 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -66,7 +66,52 @@ package = {
66
66
-- Upstream's official module unit (develop @ src/modules/json.cppm),
67
67
-- reproduced verbatim. Verdir-relative path, no glob.
68
68
generated_files= {
69
-
["mcpp_generated/nlohmann.json.cppm"] = "module;\n\n// GCC workaround for C++ modules support.\n// When using C++20 modules, some compilers (particularly GCC) may have issues\n// with template instantiations in the module preamble. If you encounter\n// \"redefinition\" errors when including nlohmann/json.hpp, try one of:\n// 1. Include nlohmann/json.hpp in your module preamble BEFORE other #includes\n// 2. Or use: import nlohmann.json; instead of #include <nlohmann/json.hpp>\n// 3. Or upgrade to a newer GCC version with better modules support.\n// See: https://github.com/nlohmann/json/issues/5103\n\n#include <nlohmann/json.hpp>\n\nexport module nlohmann.json;\n\nexport\nNLOHMANN_JSON_NAMESPACE_BEGIN\n\nusing NLOHMANN_JSON_NAMESPACE::adl_serializer;\nusing NLOHMANN_JSON_NAMESPACE::basic_json;\nusing NLOHMANN_JSON_NAMESPACE::json;\nusing NLOHMANN_JSON_NAMESPACE::json_pointer;\nusing NLOHMANN_JSON_NAMESPACE::ordered_json;\nusing NLOHMANN_JSON_NAMESPACE::ordered_map;\nusing NLOHMANN_JSON_NAMESPACE::to_string;\n\ninline namespace literals\n{\ninline namespace json_literals\n{\n using NLOHMANN_JSON_NAMESPACE::literals::json_literals::operator\"\"_json;\n using NLOHMANN_JSON_NAMESPACE::literals::json_literals::operator\"\"_json_pointer;\n} // namespace json_literals\n} // namespace literals\n\n// Note: the following nlohmann::detail symbols must be exported due to\n// an MSVC bug failing to compile without these symbols visible (ticket #3970)\nnamespace detail\n{\n using NLOHMANN_JSON_NAMESPACE::detail::json_sax_dom_callback_parser;\n using NLOHMANN_JSON_NAMESPACE::detail::unknown_size;\n} // namespace detail\n\nNLOHMANN_JSON_NAMESPACE_END\n",
69
+
["mcpp_generated/nlohmann.json.cppm"] =[==[
70
+
module;
71
+
72
+
// GCC workaround for C++ modules support.
73
+
// When using C++20 modules, some compilers (particularly GCC) may have issues
74
+
// with template instantiations in the module preamble. If you encounter
75
+
// "redefinition" errors when including nlohmann/json.hpp, try one of:
76
+
// 1. Include nlohmann/json.hpp in your module preamble BEFORE other #includes
77
+
// 2. Or use: import nlohmann.json; instead of #include <nlohmann/json.hpp>
78
+
// 3. Or upgrade to a newer GCC version with better modules support.
0 commit comments