From b0dc330cebb6d201e769c862aa30bc5280764354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rimas=20Misevi=C4=8Dius?= Date: Mon, 30 Mar 2026 22:09:31 +0300 Subject: [PATCH] Update source files to allow compiling as a C++ module --- include/upa/idna/bitmask_operators.hpp | 10 +++++++++- include/upa/idna/config.h | 8 ++++++++ include/upa/idna/idna.h | 12 ++++++++++-- include/upa/idna/nfc.h | 7 +++++-- include/upa/idna/punycode.h | 7 +++++-- src/idna.cpp | 20 +++++++++++--------- src/idna_table.h | 6 ++++-- src/iterate_utf.h | 4 +++- src/nfc.cpp | 12 +++++++----- src/nfc_table.h | 8 +++++--- src/punycode.cpp | 12 +++++++----- tools/amalgamate/config-cpp.prologue | 6 ++++-- 12 files changed, 78 insertions(+), 34 deletions(-) diff --git a/include/upa/idna/bitmask_operators.hpp b/include/upa/idna/bitmask_operators.hpp index 0151e23..17ed3e8 100644 --- a/include/upa/idna/bitmask_operators.hpp +++ b/include/upa/idna/bitmask_operators.hpp @@ -33,7 +33,13 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#include +#include "config.h" + +#ifndef UPA_MODULE +# include +#endif // UPA_MODULE + +UPA_EXPORT_BEGIN namespace upa::idna { @@ -104,4 +110,6 @@ operator^=(E& lhs, E rhs) noexcept { return lhs; } +UPA_EXPORT_END + #endif // UPA_IDNA_BITMASK_OPERATORS_HPP diff --git a/include/upa/idna/config.h b/include/upa/idna/config.h index eaf3106..bdf7b7c 100644 --- a/include/upa/idna/config.h +++ b/include/upa/idna/config.h @@ -31,4 +31,12 @@ # define UPA_IDNA_API #endif +// The following macros have values when the library is compiled as a module + +#ifndef UPA_EXPORT +# define UPA_EXPORT +# define UPA_EXPORT_BEGIN +# define UPA_EXPORT_END +#endif + #endif // UPA_IDNA_CONFIG_H diff --git a/include/upa/idna/idna.h b/include/upa/idna/idna.h index 9cb240c..89804f1 100644 --- a/include/upa/idna/idna.h +++ b/include/upa/idna/idna.h @@ -1,4 +1,4 @@ -// Copyright 2017-2025 Rimas Misevičius +// Copyright 2017-2026 Rimas Misevičius // Distributed under the BSD-style license that can be // found in the LICENSE file. // @@ -8,10 +8,15 @@ #include "bitmask_operators.hpp" #include "config.h" // IWYU pragma: export #include "idna_version.h" // IWYU pragma: export -#include + +#ifndef UPA_MODULE +# include +#endif // UPA_MODULE namespace upa::idna { +UPA_EXPORT_BEGIN + enum class Option { Default = 0, UseSTD3ASCIIRules = 0x0001, @@ -27,6 +32,7 @@ enum class Option { template<> struct enable_bitmask_operators