Skip to content

Commit 38678a4

Browse files
committed
disable warning 5244 for std module
1 parent 1f3647d commit 38678a4

File tree

3 files changed

+31
-37
lines changed

3 files changed

+31
-37
lines changed

src/pugixml.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
// For load_file
4343
# if defined(__linux__) || defined(__APPLE__)
44-
# include <sys/stat.h>
44+
# include <sys/stat.h>
4545
# endif
4646
#endif
4747

src/pugixml.cppm

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ module;
1616
#define PUGIXML_EXPORT_MODULE
1717

1818
#ifndef PUGIXML_USE_STD_MODULE
19-
# ifdef __cpp_lib_modules
20-
# define PUGIXML_USE_STD_MODULE
21-
# endif
19+
# ifdef __cpp_lib_modules
20+
# define PUGIXML_USE_STD_MODULE
21+
# endif
2222
#endif
2323

2424
#include <pugiconfig.hpp>
@@ -64,6 +64,9 @@ import std.compat;
6464
#if defined(__clang__)
6565
# pragma clang diagnostic push
6666
# pragma clang diagnostic ignored "-Winclude-angled-in-module-purview"
67+
#elif defined(_MSC_VER)
68+
# pragma warning(push)
69+
# pragma warning(disable:5244)
6770
#endif
6871
#if !defined(PUGIXML_HEADER_ONLY)
6972
extern "C++" {
@@ -74,9 +77,10 @@ extern "C++" {
7477
#endif
7578
#if defined(__clang__)
7679
# pragma clang diagnostic pop
80+
#elif defined(_MSC_VER)
81+
# pragma warning(pop)
7782
#endif
7883

79-
8084
module :private;
8185

8286
#if defined(PUGIXML_HEADER_ONLY) && !defined(PUGIXML_SOURCE)

src/pugixml.hpp

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,19 @@
2121
#ifndef HEADER_PUGIXML_HPP
2222
#define HEADER_PUGIXML_HPP
2323

24-
#ifndef PUGIXML_EXPORT_MODULE
2524
// Include stddef.h for size_t and ptrdiff_t
26-
# include <stddef.h>
25+
#include <stddef.h>
2726

2827
// Include exception header for XPath
29-
# if !defined(PUGIXML_NO_XPATH) && !defined(PUGIXML_NO_EXCEPTIONS)
30-
# include <exception>
31-
# endif
28+
#if !defined(PUGIXML_NO_XPATH) && !defined(PUGIXML_NO_EXCEPTIONS)
29+
# include <exception>
30+
#endif
3231

3332
// Include STL headers
34-
# ifndef PUGIXML_NO_STL
35-
# include <iterator>
36-
# include <iosfwd>
37-
# include <string>
38-
# endif
33+
#ifndef PUGIXML_NO_STL
34+
# include <iterator>
35+
# include <iosfwd>
36+
# include <string>
3937
#endif
4038

4139
// Check if std::string_view is available
@@ -48,10 +46,8 @@
4846
#endif
4947

5048
// Include string_view if appropriate
51-
#ifndef PUGIXML_EXPORT_MODULE
52-
# ifdef PUGIXML_HAS_STRING_VIEW
53-
# include <string_view>
54-
# endif
49+
#ifdef PUGIXML_HAS_STRING_VIEW
50+
# include <string_view>
5551
#endif
5652

5753
// Macro for deprecated features
@@ -138,27 +134,25 @@
138134
# endif
139135
#endif
140136

141-
#ifndef PUGIXML_CONSTEXPR11
137+
// If C++ is 2011 or higher, add 'constexpr' qualifiers
138+
#ifndef PUGIXML_CONSTEXPR
142139
# if __cplusplus >= 201103
143-
# define PUGIXML_CONSTEXPR11 constexpr
140+
# define PUGIXML_CONSTEXPR constexpr
144141
# elif defined(_MSC_VER) && _MSC_VER >= 1910
145-
# define PUGIXML_CONSTEXPR11 constexpr
142+
# define PUGIXML_CONSTEXPR constexpr
146143
# else
147-
# define PUGIXML_CONSTEXPR11
144+
# define PUGIXML_CONSTEXPR const
148145
# endif
149146
#endif
150147

151-
// If C++ is 2011 or higher, add 'constexpr' qualifiers to constants
152-
// If C++ is 2017 or higher, add 'inline' qualifiers to constants
153-
// inline constexpr is required for C++20 module
148+
// If C++ is 2017 or higher, add 'inline' qualifiers for constants
149+
// required for C++20 module
154150
#ifndef PUGIXML_CONSTANT
155151
# if __cplusplus >= 201703
156-
# define PUGIXML_CONSTANT inline PUGIXML_CONSTEXPR11
157-
# elif __cplusplus >= 201103
158-
# define PUGIXML_CONSTANT PUGIXML_CONSTEXPR11
152+
# define PUGIXML_CONSTANT inline PUGIXML_CONSTEXPR
159153
# else
160-
# define PUGIXML_CONSTANT const
161-
# endif
154+
# define PUGIXML_CONSTANT PUGIXML_CONSTEXPR
155+
# endif
162156
#endif
163157

164158
// Character interface macros
@@ -170,10 +164,6 @@
170164
# define PUGIXML_CHAR char
171165
#endif
172166

173-
#ifndef PUGIXML_MODULE_EXPORT
174-
# define PUGIXML_MODULE_EXPORT
175-
#endif
176-
177167
namespace pugi
178168
{
179169
// Character type used for all internal storage and operations; depends on PUGIXML_WCHAR_MODE
@@ -191,7 +181,7 @@ namespace pugi
191181
}
192182

193183
// The PugiXML namespace
194-
PUGIXML_MODULE_EXPORT namespace pugi
184+
namespace pugi
195185
{
196186
// Tree node types
197187
enum xml_node_type
@@ -260,7 +250,7 @@ PUGIXML_MODULE_EXPORT namespace pugi
260250
// the document; this flag is only recommended for parsing documents with many PCDATA nodes in memory-constrained environments.
261251
// This flag is off by default.
262252
PUGIXML_CONSTANT unsigned int parse_embed_pcdata = 0x2000;
263-
253+
264254
// This flag determines whether determines whether the the two pcdata should be merged or not, if no intermediatory data are parsed in the document.
265255
// This flag is off by default.
266256
PUGIXML_CONSTANT unsigned int parse_merge_pcdata = 0x4000;

0 commit comments

Comments
 (0)