more preprocessor cleanup

- fixing 'unknown pragma' warnings in GCC
- cleaning up test structure
This commit is contained in:
Mark Gillard 2020-06-24 21:05:23 +03:00
parent 464d3d13cc
commit a122b3b9b4
30 changed files with 334 additions and 180 deletions

View File

@ -193,7 +193,7 @@ though you're welcome to reach out via other means. In order of likely response
[API documentation]: https://marzer.github.io/tomlplusplus/
[homepage]: https://marzer.github.io/tomlplusplus/
[unreleased TOML language features]: #unreleased-toml-features
[unreleased TOML language features]: #-unreleased-language-features
[most recently-released version]: https://github.com/toml-lang/toml/releases
[numbered version]: https://github.com/toml-lang/toml/releases
[char8_t]: https://en.cppreference.com/w/cpp/keyword/char8_t

View File

@ -41,9 +41,11 @@
#if TOML_PARSER
#include "toml_parser.hpp"
#endif // TOML_PARSER
#if !TOML_ALL_INLINE
#include "toml_instantiations.hpp"
#endif // !TOML_ALL_INLINE
#endif // TOML_IMPLEMENTATION
// macro hygiene

View File

@ -75,6 +75,7 @@
#define TOML_DISABLE_SHADOW_WARNINGS _Pragma("clang diagnostic ignored \"-Wshadow\"")
#define TOML_DISABLE_ALL_WARNINGS _Pragma("clang diagnostic ignored \"-Weverything\"")
#define TOML_POP_WARNINGS _Pragma("clang diagnostic pop")
#define TOML_ASSUME(cond) __builtin_assume(cond)
#define TOML_UNREACHABLE __builtin_unreachable()
#define TOML_GNU_ATTR(...) __attribute__((__VA_ARGS__))
@ -112,12 +113,13 @@
#elif defined(_MSC_VER) || (defined(__INTEL_COMPILER) && defined(__ICL))
#define TOML_CPP_VERSION _MSVC_LANG
#define TOML_PUSH_WARNINGS __pragma(warning(push))
#define TOML_DISABLE_SWITCH_WARNINGS __pragma(warning(disable: 4063))
#define TOML_DISABLE_ALL_WARNINGS __pragma(warning(pop)) \
__pragma(warning(push, 0))
#define TOML_POP_WARNINGS __pragma(warning(pop))
#define TOML_CPP_VERSION _MSVC_LANG
#define TOML_ALWAYS_INLINE __forceinline
#define TOML_ASSUME(cond) __assume(cond)
#define TOML_UNREACHABLE __assume(0)
@ -153,8 +155,8 @@
TOML_DISABLE_PADDING_WARNINGS \
TOML_DISABLE_FLOAT_WARNINGS \
TOML_DISABLE_SHADOW_WARNINGS
#define TOML_POP_WARNINGS _Pragma("GCC diagnostic pop")
#define TOML_GNU_ATTR(...) __attribute__((__VA_ARGS__))
#define TOML_ALWAYS_INLINE __attribute__((__always_inline__)) inline
#define TOML_UNREACHABLE __builtin_unreachable()

View File

@ -26,13 +26,24 @@ def read_all_text_from_file(path):
def make_divider(text = None, text_col = 40):
def repeat_pattern(pattern, count):
if len(pattern) == 1:
return pattern * count
text = ''
for i in range(0, count):
text = text + pattern[i % len(pattern)]
return text
def make_divider(text = None, text_col = 40, pattern = '-'):
if (text is None):
return "//" + ('-' * 118)
return "//" + repeat_pattern(pattern, 118)
else:
text = "//{} {} ".format('-' * (text_col - 2),text);
text = "//{} {} ".format(repeat_pattern(pattern, text_col - 2), text);
if (len(text) < 120):
return text + ('-' * (120 - len(text)))
return text + repeat_pattern(pattern, 120 - len(text))
else:
return text
@ -51,8 +62,9 @@ class Preprocessor:
return ''
self.processed_includes.append(incl)
text = read_all_text_from_file(path.join(get_script_folder(), '..', 'include', 'toml++', incl))
text = re.sub(r'//[#!]\s*[{][{].*?//[#!]\s*[}][}]', '', text, 0, re.I | re.S)
text = read_all_text_from_file(path.join(get_script_folder(), '..', 'include', 'toml++', incl)).strip() + '\n'
text = re.sub('\r\n', '\n', text, 0, re.I | re.M) # convert windows newlines
text = re.sub(r'//[#!]\s*[{][{].*?//[#!]\s*[}][}]*?\n', '', text, 0, re.I | re.S) # strip {{ }} blocks
self.current_level += 1
text = re.sub(r'^\s*#\s*include\s+"(.+?)"', lambda m : self.preprocess(m), text, 0, re.I | re.M)
self.current_level -= 1
@ -61,8 +73,8 @@ class Preprocessor:
header_text = '' + raw_incl
lpad = 28 + ((25 * (self.header_indent % 4)) - int((len(header_text) + 4) / 2))
self.header_indent += 1
text = '{}\n#pragma region {}\n\n{}\n\n#pragma endregion {}\n{}'.format(
make_divider(header_text, lpad), '', text, '', make_divider('' + raw_incl, lpad)
text = '{}\n#if 1\n\n{}\n\n#endif\n{}\n'.format(
make_divider(header_text, lpad), text, make_divider('' + raw_incl, lpad)
)
return '\n\n' + text + '\n\n' # will get merged later
@ -79,7 +91,6 @@ def main():
# preprocess header(s)
source_text = Preprocessor()('toml.h')
source_text = re.sub('\r\n', '\n', source_text, 0, re.I | re.M) # convert windows newlines
source_text = re.sub(r'^\s*#\s*pragma\s+once\s*$', '', source_text, 0, re.I | re.M) # 'pragma once'
source_text = re.sub(r'^\s*//\s*clang-format\s+.+?$', '', source_text, 0, re.I | re.M) # clang-format directives
source_text = re.sub(r'^\s*//\s*SPDX-License-Identifier:.+?$', '', source_text, 0, re.I | re.M) # spdx
@ -87,11 +98,11 @@ def main():
source_text = re.sub('(?://[/#!<].*?)\n', '\n', source_text, 0, re.I | re.M) # remove 'magic' comments
source_text = re.sub('([^ \t])[ \t]+\n', '\\1\n', source_text, 0, re.I | re.M) # remove trailing whitespace
source_text = re.sub('\n(?:[ \t]*\n[ \t]*)+\n', '\n\n', source_text, 0, re.I | re.M) # remove double newlines
source_text = re.sub( # blank lines between various preprocessor directives
'[#](endif(?:\s*//[^\n]*)?)\n{2,}[#]((?:end)?ifn?(?:def)?|define)',
'#\\1\n#\\2',
source_text, 0, re.I | re.M
)
# source_text = re.sub( # blank lines between various preprocessor directives
# '[#](endif(?:\s*//[^\n]*)?)\n{2,}[#](ifn?(?:def)?|define)',
# '#\\1\n#\\2',
# source_text, 0, re.I | re.M
# )
return_type_pattern \
= r'(?:' \
+ r'(?:\[\[nodiscard\]\]\s*)?' \
@ -113,7 +124,7 @@ def main():
+ '\n\n([ \t]*[a-zA-Z_][a-zA-Z0-9_]*[ \t]+[a-zA-Z_][a-zA-Z0-9_]*[ \t]*;)', '\\1\n\\2',
source_text, 0, re.I | re.M)
source_text = re.sub(blank_lines_between_returns_pattern, '\\1\n\\2', source_text, 0, re.I | re.M)
source_text = source_text.strip()
source_text = source_text.strip() + '\n'
# extract library version
library_version = {
@ -171,17 +182,11 @@ v0.5.0: https://toml.io/en/v0.5.0''')
print('''// clang-format off
#ifndef INCLUDE_TOMLPLUSPLUS_H
#define INCLUDE_TOMLPLUSPLUS_H
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#endif
#define TOML_LIB_SINGLE_HEADER 1
''', file=output_file)
print(source_text, file=output_file)
print('''
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#endif // INCLUDE_TOMLPLUSPLUS_H
// clang-format on''', file=output_file)

View File

@ -1,58 +1,5 @@
#pragma once
//catch config
#define CATCH_CONFIG_CPP11_TO_STRING
#define CATCH_CONFIG_CPP17_OPTIONAL
#define CATCH_CONFIG_CPP17_STRING_VIEW
#define CATCH_CONFIG_FAST_COMPILE
#define CATCH_CONFIG_CONSOLE_WIDTH 120
#define CATCH_CONFIG_CPP11_TO_STRING
#define CATCH_CONFIG_DISABLE_MATCHERS
//windows.h config
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#define VC_EXTRALEAN
#define NOATOM // - Atom Manager routines
#define NOBITMAP
#define NOCLIPBOARD // - Clipboard routines
#define NOCOLOR // - Screen colors
#define NOCOMM // - COMM driver routines
#define NOCTLMGR // - Control and Dialog routines
#define NODEFERWINDOWPOS // - DeferWindowPos routines
#define NODRAWTEXT // - DrawText() and DT_*
#define NOGDI // - All GDI defines and routines
#define NOGDICAPMASKS // - CC_*, LC_*, PC_*, CP_*, TC_*, RC_
#define NOHELP // - Help engine interface.
#define NOICONS // - IDI_*
#define NOKANJI // - Kanji support stuff.
#define NOKEYSTATES // - MK_*
#define NOKERNEL // - All KERNEL defines and routines
#define NOMB // - MB_* and MessageBox()
#define NOMCX // - Modem Configuration Extensions
#define NOMENUS // - MF_*
#define NOMEMMGR // - GMEM_*, LMEM_*, GHND, LHND, associated routines
#define NOMETAFILE // - typedef METAFILEPICT
#define NOMINMAX // - Macros min(a,b) and max(a,b)
#define NOMSG // - typedef MSG and associated routines
#define NONLS // - All NLS defines and routines
#define NOOPENFILE // - OpenFile(), OemToAnsi, AnsiToOem, and OF_*
#define NOPROFILER // - Profiler interface.
#define NORASTEROPS // - Binary and Tertiary raster ops
#define NOSCROLL // - SB_* and scrolling routines
#define NOSERVICE // - All Service Controller routines, SERVICE_ equates, etc.
#define NOSHOWWINDOW // - SW_*
#define NOSOUND // - Sound driver routines
#define NOSYSCOMMANDS // - SC_*
#define NOSYSMETRICS // - SM_*
#define NOTEXTMETRIC // - typedef TEXTMETRIC and associated routines
#define NOUSER // - All USER defines and routines
#define NOVIRTUALKEYCODES // - VK_*
#define NOWH // - SetWindowsHook and WH_*
#define NOWINOFFSETS // - GWL_*, GCL_*, associated routines
#define NOWINMESSAGES // - WM_*, EM_*, LB_*, CB_*
#define NOWINSTYLES // - WS_*, CS_*, ES_*, LBS_*, SBS_*, CBS_*
#endif
#include "settings.h"
#if __has_include(<Catch2/single_include/catch2/catch.hpp>)
#include <Catch2/single_include/catch2/catch.hpp>

View File

@ -1,11 +1,6 @@
#include "../include/toml++/toml_preprocessor.h"
TOML_PUSH_WARNINGS
TOML_DISABLE_ALL_WARNINGS
#define CATCH_CONFIG_RUNNER
#include "catch2.h"
#include <clocale>
TOML_POP_WARNINGS
int main(int argc, char* argv[])
{

View File

@ -1,24 +1,31 @@
#if !defined(_MSC_VER) || !defined(_M_IX86)
#define TOML_ALL_INLINE 0
#include "settings.h"
#if !TOML_ALL_INLINE
#define TOML_IMPLEMENTATION
#endif
#include "../include/toml++/toml_preprocessor.h"
TOML_PUSH_WARNINGS
TOML_DISABLE_ALL_WARNINGS
#ifdef TARTANLLAMA_OPTIONAL
#if USE_TARTANLLAMA_OPTIONAL
#if __has_include(<tloptional/include/tl/optional.hpp>)
#include <tloptional/include/tl/optional.hpp>
#else
#error TartanLlama/optional is missing! You probably need to fetch submodules ("git submodule update --init extern/tloptional")
#endif
#define TOML_OPTIONAL_TYPE tl::optional
#endif
#if USE_SINGLE_HEADER
#include "../toml.hpp"
#else
#include "../include/toml++/toml.h"
#endif
#if TOML_COMPILER_EXCEPTIONS != TOML_EXCEPTIONS
#error TOML_EXCEPTIONS does not match TOML_COMPILER_EXCEPTIONS (default behaviour should be to match)
#endif
TOML_PUSH_WARNINGS
TOML_DISABLE_ALL_WARNINGS
#include <ostream>
TOML_POP_WARNINGS
#include "../include/toml++/toml.h"
namespace toml
{
using std::declval;

View File

@ -37,6 +37,7 @@ exception_modes = [ true, false ]
unreleased_feature_modes = [ true, false ]
tloptional_modes = [ true, false ]
executables = []
counter = 0
foreach character_type : character_types
if character_type == 'char8' and not compiler_supports_char8_strings
continue
@ -73,7 +74,20 @@ foreach character_type : character_types
if tloptional
name = name + '_tlopt'
args += '-DTARTANLLAMA_OPTIONAL'
args += '-DUSE_TARTANLLAMA_OPTIONAL=1'
endif
args += '-DTEST_BUILD_ID=@0@'.format(counter)
if compiler.get_id() == 'gcc'
args += '-Wno-padded'
args += '-Wno-float-equal'
endif
if compiler.get_id() == 'clang'
args += '-Wno-padded'
args += '-Wno-float-equal'
args += '-Wno-double-promotion'
endif
executables += [[
@ -87,6 +101,8 @@ foreach character_type : character_types
)
]]
counter = counter + 1
endforeach # tloptional_modes
endforeach # unreleased_feature_modes
endforeach # exception_modes

80
tests/settings.h Normal file
View File

@ -0,0 +1,80 @@
#pragma once
// toml++ config
#define TOML_UNDEF_MACROS 0
#ifdef TEST_BUILD_ID
#if (TEST_BUILD_ID % 3 == 0) && !defined(TOML_ALL_INLINE)
#define TOML_ALL_INLINE 1
#endif
#if (TEST_BUILD_ID % 2 == 0) && !defined(USE_SINGLE_HEADER)
#define USE_SINGLE_HEADER 1
#endif
#endif
#ifndef TOML_ALL_INLINE
#define TOML_ALL_INLINE 0
#endif
#ifndef USE_SINGLE_HEADER
#define USE_SINGLE_HEADER 0
#endif
// use tl::optional?
#if defined(USE_TARTANLLAMA_OPTIONAL) && USE_TARTANLLAMA_OPTIONAL
#define TOML_OPTIONAL_TYPE tl::optional
#else
#undef USE_TARTANLLAMA_OPTIONAL
#define USE_TARTANLLAMA_OPTIONAL 0
#endif
//catch2 config
#define CATCH_CONFIG_CPP11_TO_STRING
#define CATCH_CONFIG_CPP17_OPTIONAL
#define CATCH_CONFIG_CPP17_STRING_VIEW
#define CATCH_CONFIG_FAST_COMPILE
#define CATCH_CONFIG_CONSOLE_WIDTH 120
#define CATCH_CONFIG_CPP11_TO_STRING
#define CATCH_CONFIG_DISABLE_MATCHERS
//windows.h config (included transitively by catch2 on windows)
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#define VC_EXTRALEAN
#define NOATOM // - Atom Manager routines
#define NOBITMAP
#define NOCLIPBOARD // - Clipboard routines
#define NOCOLOR // - Screen colors
#define NOCOMM // - COMM driver routines
#define NOCTLMGR // - Control and Dialog routines
#define NODEFERWINDOWPOS // - DeferWindowPos routines
#define NODRAWTEXT // - DrawText() and DT_*
#define NOGDI // - All GDI defines and routines
#define NOGDICAPMASKS // - CC_*, LC_*, PC_*, CP_*, TC_*, RC_
#define NOHELP // - Help engine interface.
#define NOICONS // - IDI_*
#define NOKANJI // - Kanji support stuff.
#define NOKEYSTATES // - MK_*
#define NOKERNEL // - All KERNEL defines and routines
#define NOMB // - MB_* and MessageBox()
#define NOMCX // - Modem Configuration Extensions
#define NOMENUS // - MF_*
#define NOMEMMGR // - GMEM_*, LMEM_*, GHND, LHND, associated routines
#define NOMETAFILE // - typedef METAFILEPICT
#define NOMINMAX // - Macros min(a,b) and max(a,b)
#define NOMSG // - typedef MSG and associated routines
#define NONLS // - All NLS defines and routines
#define NOOPENFILE // - OpenFile(), OemToAnsi, AnsiToOem, and OF_*
#define NOPROFILER // - Profiler interface.
#define NORASTEROPS // - Binary and Tertiary raster ops
#define NOSCROLL // - SB_* and scrolling routines
#define NOSERVICE // - All Service Controller routines, SERVICE_ equates, etc.
#define NOSHOWWINDOW // - SW_*
#define NOSOUND // - Sound driver routines
#define NOSYSCOMMANDS // - SC_*
#define NOSYSMETRICS // - SM_*
#define NOTEXTMETRIC // - typedef TEXTMETRIC and associated routines
#define NOUSER // - All USER defines and routines
#define NOVIRTUALKEYCODES // - VK_*
#define NOWH // - SetWindowsHook and WH_*
#define NOWINOFFSETS // - GWL_*, GCL_*, associated routines
#define NOWINMESSAGES // - WM_*, EM_*, LB_*, CB_*
#define NOWINSTYLES // - WS_*, CS_*, ES_*, LBS_*, SBS_*, CBS_*
#endif

View File

@ -23,5 +23,3 @@ namespace Catch
template std::string stringify(const node_view<const node>&);
}
}

View File

@ -1,24 +1,22 @@
#pragma once
#define TOML_UNDEF_MACROS 0
#if !defined(_MSC_VER) || !defined(_M_IX86)
#define TOML_ALL_INLINE 0
#endif
#include "../include/toml++/toml_preprocessor.h"
#include "settings.h"
#if TOML_COMPILER_EXCEPTIONS != TOML_EXCEPTIONS
#error TOML_EXCEPTIONS does not match TOML_COMPILER_EXCEPTIONS (default behaviour should be to match)
#endif
TOML_PUSH_WARNINGS
TOML_DISABLE_ALL_WARNINGS
#ifdef TARTANLLAMA_OPTIONAL
#if USE_TARTANLLAMA_OPTIONAL
#if __has_include(<tloptional/include/tl/optional.hpp>)
#include <tloptional/include/tl/optional.hpp>
#else
#error TartanLlama/optional is missing! You probably need to fetch submodules ("git submodule update --init extern/tloptional")
#endif
#define TOML_OPTIONAL_TYPE tl::optional
#endif
#if USE_SINGLE_HEADER
#include "../toml.hpp"
#else
#include "../include/toml++/toml.h"
#endif
TOML_PUSH_WARNINGS
TOML_DISABLE_ALL_WARNINGS
#include "catch2.h"
#include <sstream>
namespace toml {}
@ -26,8 +24,6 @@ using namespace Catch::literals;
using namespace toml;
TOML_POP_WARNINGS
#include "../include/toml++/toml.h"
#define FILE_LINE_ARGS std::string_view{ __FILE__ }, __LINE__
#define S(str) TOML_STRING_PREFIX(str)
#define BOM_PREFIX "\xEF\xBB\xBF"
@ -48,7 +44,6 @@ TOML_POP_WARNINGS
TOML_PUSH_WARNINGS
TOML_DISABLE_FLOAT_WARNINGS
template <typename Char, typename Func = std::false_type>
inline bool parsing_should_succeed(
std::string_view test_file,

146
toml.hpp
View File

@ -44,53 +44,61 @@
// clang-format off
#ifndef INCLUDE_TOMLPLUSPLUS_H
#define INCLUDE_TOMLPLUSPLUS_H
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#endif
#define TOML_LIB_SINGLE_HEADER 1
//-------------- ↓ toml_preprocessor.h -------------------------------------------------------------------------------
#pragma region
#if 1
#ifndef TOML_DOXYGEN
#define TOML_DOXYGEN 0
#endif
#ifdef TOML_CONFIG_HEADER
#include TOML_CONFIG_HEADER
#endif
#if !defined(TOML_ALL_INLINE) || (defined(TOML_ALL_INLINE) && TOML_ALL_INLINE) || defined(__INTELLISENSE__)
#undef TOML_ALL_INLINE
#define TOML_ALL_INLINE 1
#endif
#if TOML_DOXYGEN
#undef TOML_ALL_INLINE
#define TOML_ALL_INLINE 0
#endif
#if defined(TOML_IMPLEMENTATION) || TOML_ALL_INLINE
#undef TOML_IMPLEMENTATION
#define TOML_IMPLEMENTATION 1
#else
#define TOML_IMPLEMENTATION 0
#endif
#ifndef TOML_API
#define TOML_API
#endif
#ifndef TOML_CHAR_8_STRINGS
#define TOML_CHAR_8_STRINGS 0
#endif
#ifndef TOML_UNRELEASED_FEATURES
#define TOML_UNRELEASED_FEATURES 0
#endif
#ifndef TOML_LARGE_FILES
#define TOML_LARGE_FILES 0
#endif
#ifndef TOML_UNDEF_MACROS
#define TOML_UNDEF_MACROS 1
#endif
#ifndef TOML_PARSER
#define TOML_PARSER 1
#endif
#ifndef __cplusplus
#error toml++ is a C++ library.
#endif
@ -107,6 +115,7 @@
#define TOML_DISABLE_SHADOW_WARNINGS _Pragma("clang diagnostic ignored \"-Wshadow\"")
#define TOML_DISABLE_ALL_WARNINGS _Pragma("clang diagnostic ignored \"-Weverything\"")
#define TOML_POP_WARNINGS _Pragma("clang diagnostic pop")
#define TOML_ASSUME(cond) __builtin_assume(cond)
#define TOML_UNREACHABLE __builtin_unreachable()
#define TOML_GNU_ATTR(...) __attribute__((__VA_ARGS__))
@ -144,12 +153,13 @@
#elif defined(_MSC_VER) || (defined(__INTEL_COMPILER) && defined(__ICL))
#define TOML_CPP_VERSION _MSVC_LANG
#define TOML_PUSH_WARNINGS __pragma(warning(push))
#define TOML_DISABLE_SWITCH_WARNINGS __pragma(warning(disable: 4063))
#define TOML_DISABLE_ALL_WARNINGS __pragma(warning(pop)) \
__pragma(warning(push, 0))
#define TOML_POP_WARNINGS __pragma(warning(pop))
#define TOML_CPP_VERSION _MSVC_LANG
#define TOML_ALWAYS_INLINE __forceinline
#define TOML_ASSUME(cond) __assume(cond)
#define TOML_UNREACHABLE __assume(0)
@ -185,8 +195,8 @@
TOML_DISABLE_PADDING_WARNINGS \
TOML_DISABLE_FLOAT_WARNINGS \
TOML_DISABLE_SHADOW_WARNINGS
#define TOML_POP_WARNINGS _Pragma("GCC diagnostic pop")
#define TOML_GNU_ATTR(...) __attribute__((__VA_ARGS__))
#define TOML_ALWAYS_INLINE __attribute__((__always_inline__)) inline
#define TOML_UNREACHABLE __builtin_unreachable()
@ -205,11 +215,13 @@
#ifndef TOML_FLOAT_CHARCONV
#define TOML_FLOAT_CHARCONV 0
#endif
#endif
#ifndef TOML_CPP_VERSION
#define TOML_CPP_VERSION __cplusplus
#endif
#if TOML_CPP_VERSION < 201103L
#error toml++ requires C++17 or higher. For a TOML library supporting pre-C++11 see https://github.com/ToruNiina/Boost.toml
#elif TOML_CPP_VERSION < 201703L
@ -223,6 +235,7 @@
#elif TOML_CPP_VERSION >= 201703L
#define TOML_CPP 17
#endif
#ifndef TOML_COMPILER_EXCEPTIONS
#define TOML_COMPILER_EXCEPTIONS 1
#endif
@ -237,11 +250,13 @@
#undef TOML_EXCEPTIONS
#define TOML_EXCEPTIONS 0
#endif
#if TOML_EXCEPTIONS
#define TOML_MAY_THROW
#else
#define TOML_MAY_THROW noexcept
#endif
#ifndef TOML_INT_CHARCONV
#define TOML_INT_CHARCONV 1
#endif
@ -254,6 +269,7 @@
#define TOML_INT_CHARCONV 0
#define TOML_FLOAT_CHARCONV 0
#endif
#ifndef TOML_PUSH_WARNINGS
#define TOML_PUSH_WARNINGS
#endif
@ -281,24 +297,31 @@
#ifndef TOML_POP_WARNINGS
#define TOML_POP_WARNINGS
#endif
#ifndef TOML_GNU_ATTR
#define TOML_GNU_ATTR(...)
#endif
#ifndef TOML_INTERFACE
#define TOML_INTERFACE
#endif
#ifndef TOML_EMPTY_BASES
#define TOML_EMPTY_BASES
#endif
#ifndef TOML_ALWAYS_INLINE
#define TOML_ALWAYS_INLINE inline
#endif
#ifndef TOML_ASSUME
#define TOML_ASSUME(cond) (void)0
#endif
#ifndef TOML_UNREACHABLE
#define TOML_UNREACHABLE TOML_ASSERT(false)
#endif
#define TOML_NO_DEFAULT_CASE default: TOML_UNREACHABLE
#ifdef __cpp_consteval
@ -306,6 +329,7 @@
#else
#define TOML_CONSTEVAL constexpr
#endif
#if !TOML_DOXYGEN && !defined(__INTELLISENSE__)
#if !defined(TOML_LIKELY) && __has_cpp_attribute(likely)
#define TOML_LIKELY(...) (__VA_ARGS__) [[likely]]
@ -317,6 +341,7 @@
#define TOML_NODISCARD_CTOR [[nodiscard]]
#endif
#endif
#ifndef TOML_LIKELY
#define TOML_LIKELY(...) (__VA_ARGS__)
#endif
@ -326,9 +351,11 @@
#ifndef TOML_NODISCARD_CTOR
#define TOML_NODISCARD_CTOR
#endif
#ifndef TOML_TRIVIAL_ABI
#define TOML_TRIVIAL_ABI
#endif
#ifndef TOML_RELOPS_REORDERING
#define TOML_RELOPS_REORDERING 0
#endif
@ -340,6 +367,7 @@
__VA_ARGS__ [[nodiscard]] friend bool operator != (LHS lhs, RHS rhs) noexcept { return !(lhs == rhs); } \
__VA_ARGS__ [[nodiscard]] friend bool operator != (RHS rhs, LHS lhs) noexcept { return !(lhs == rhs); }
#endif
#if TOML_ALL_INLINE
#define TOML_EXTERNAL_LINKAGE inline
#define TOML_INTERNAL_LINKAGE inline
@ -349,6 +377,7 @@
#define TOML_INTERNAL_LINKAGE static
#define TOML_INTERNAL_NAMESPACE
#endif
#define TOML_LIB_MAJOR 1
#define TOML_LIB_MINOR 3
#define TOML_LIB_PATCH 2
@ -367,6 +396,7 @@
#define TOML_LANG_EFFECTIVE_VERSION \
TOML_MAKE_VERSION(TOML_LANG_MAJOR, TOML_LANG_MINOR, TOML_LANG_PATCH)
#endif
#define TOML_LANG_HIGHER_THAN(maj, min, rev) \
(TOML_LANG_EFFECTIVE_VERSION > TOML_MAKE_VERSION(maj, min, rev))
@ -405,11 +435,11 @@ TOML_POP_WARNINGS
#define TOML_STRING_PREFIX(S) S
#endif
#pragma endregion
#endif
//-------------- ↑ toml_preprocessor.h -------------------------------------------------------------------------------
//------------------------------------------ ↓ toml_common.h ---------------------------------------------------------
#pragma region
#if 1
TOML_PUSH_WARNINGS
TOML_DISABLE_ALL_WARNINGS
@ -434,6 +464,7 @@ TOML_POP_WARNINGS
#if TOML_CHAR_8_STRINGS && !defined(__cpp_lib_char8_t)
#error toml++ requires implementation support to use char8_t strings, but yours does not provide it.
#endif
#ifdef __cpp_lib_launder
#define TOML_LAUNDER(x) std::launder(x)
#else
@ -860,11 +891,11 @@ namespace toml
#endif
}
#pragma endregion
#endif
//------------------------------------------ ↑ toml_common.h ---------------------------------------------------------
//----------------------------------------------------------------- ↓ toml_date_time.h -------------------------------
#pragma region
#if 1
TOML_PUSH_WARNINGS
TOML_DISABLE_PADDING_WARNINGS
@ -1178,11 +1209,11 @@ namespace toml
TOML_POP_WARNINGS // TOML_DISABLE_PADDING_WARNINGS
#pragma endregion
#endif
//----------------------------------------------------------------- ↑ toml_date_time.h -------------------------------
//--------------------------------------------------------------------------------------- ↓ toml_print_to_stream.h ---
#pragma region
#if 1
TOML_PUSH_WARNINGS
TOML_DISABLE_ALL_WARNINGS
@ -1579,11 +1610,11 @@ namespace toml
#endif
}
#pragma endregion
#endif
//--------------------------------------------------------------------------------------- ↑ toml_print_to_stream.h ---
//------------------ ↓ toml_node.h -----------------------------------------------------------------------------------
#pragma region
#if 1
TOML_PUSH_WARNINGS
TOML_DISABLE_VTABLE_WARNINGS
@ -1944,11 +1975,11 @@ namespace toml
TOML_POP_WARNINGS //TOML_DISABLE_VTABLE_WARNINGS
#pragma endregion
#endif
//------------------ ↑ toml_node.h -----------------------------------------------------------------------------------
//------------------------------------------ ↓ toml_value.h ----------------------------------------------------------
#pragma region
#if 1
TOML_PUSH_WARNINGS
TOML_DISABLE_FLOAT_WARNINGS
@ -2309,11 +2340,11 @@ namespace toml
TOML_POP_WARNINGS // TOML_DISABLE_FLOAT_WARNINGS, TOML_DISABLE_PADDING_WARNINGS
#pragma endregion
#endif
//------------------------------------------ ↑ toml_value.h ----------------------------------------------------------
//------------------------------------------------------------------- ↓ toml_array.h ---------------------------------
#pragma region
#if 1
TOML_PUSH_WARNINGS
TOML_DISABLE_VTABLE_WARNINGS
@ -2806,11 +2837,11 @@ namespace toml
TOML_POP_WARNINGS //TOML_DISABLE_VTABLE_WARNINGS
#pragma endregion
#endif
//------------------------------------------------------------------- ↑ toml_array.h ---------------------------------
//-------------------------------------------------------------------------------------------- ↓ toml_table.h --------
#pragma region
#if 1
TOML_PUSH_WARNINGS
TOML_DISABLE_VTABLE_WARNINGS
@ -3170,11 +3201,11 @@ namespace toml
TOML_POP_WARNINGS // TOML_DISABLE_VTABLE_WARNINGS, TOML_DISABLE_PADDING_WARNINGS
#pragma endregion
#endif
//-------------------------------------------------------------------------------------------- ↑ toml_table.h --------
//--------------- ↓ toml_node_view.h ---------------------------------------------------------------------------------
#pragma region
#if 1
namespace toml
{
@ -3400,11 +3431,11 @@ namespace toml
TOML_POP_WARNINGS // TOML_DISABLE_FLOAT_WARNINGS
}
#pragma endregion
#endif
//--------------- ↑ toml_node_view.h ---------------------------------------------------------------------------------
//-------------------------------------- ↓ toml_utf8_generated.h -----------------------------------------------------
#pragma region
#if 1
namespace toml::impl
{
@ -4114,11 +4145,11 @@ namespace toml::impl
#endif // TOML_LANG_UNRELEASED
} // toml::impl
#pragma endregion
#endif
//-------------------------------------- ↑ toml_utf8_generated.h -----------------------------------------------------
//-------------------------------------------------------------------- ↓ toml_utf8.h ---------------------------------
#pragma region
#if 1
namespace toml::impl
{
@ -4365,11 +4396,11 @@ namespace toml::impl
};
}
#pragma endregion
#endif
//-------------------------------------------------------------------- ↑ toml_utf8.h ---------------------------------
//------------------------------------------------------------------------------------------ ↓ toml_formatter.h ------
#pragma region
#if 1
TOML_PUSH_WARNINGS
TOML_DISABLE_SWITCH_WARNINGS
@ -4531,11 +4562,11 @@ namespace toml::impl
TOML_POP_WARNINGS // TOML_DISABLE_SWITCH_WARNINGS, TOML_DISABLE_PADDING_WARNINGS
#pragma endregion
#endif
//------------------------------------------------------------------------------------------ ↑ toml_formatter.h ------
//----------- ↓ toml_default_formatter.h -----------------------------------------------------------------------------
#pragma region
#if 1
TOML_PUSH_WARNINGS
TOML_DISABLE_SWITCH_WARNINGS
@ -4879,11 +4910,11 @@ namespace toml
TOML_POP_WARNINGS // TOML_DISABLE_SWITCH_WARNINGS, TOML_DISABLE_PADDING_WARNINGS
#pragma endregion
#endif
//----------- ↑ toml_default_formatter.h -----------------------------------------------------------------------------
//-------------------------------------- ↓ toml_json_formatter.h -----------------------------------------------------
#pragma region
#if 1
TOML_PUSH_WARNINGS
TOML_DISABLE_SWITCH_WARNINGS
@ -4994,13 +5025,13 @@ namespace toml
TOML_POP_WARNINGS // TOML_DISABLE_SWITCH_WARNINGS, TOML_DISABLE_PADDING_WARNINGS
#pragma endregion
#endif
//-------------------------------------- ↑ toml_json_formatter.h -----------------------------------------------------
#if TOML_PARSER
//---------------------------------------------------------------- ↓ toml_parse_error.h ------------------------------
#pragma region
#if 1
TOML_PUSH_WARNINGS
TOML_DISABLE_ALL_WARNINGS
@ -5129,11 +5160,11 @@ namespace toml
TOML_POP_WARNINGS
#pragma endregion
#endif
//---------------------------------------------------------------- ↑ toml_parse_error.h ------------------------------
//----------------------------------------------------------------------------------------- ↓ toml_utf8_streams.h ----
#pragma region
#if 1
TOML_PUSH_WARNINGS
TOML_DISABLE_PADDING_WARNINGS
@ -5618,11 +5649,11 @@ namespace toml::impl
TOML_POP_WARNINGS // TOML_DISABLE_PADDING_WARNINGS
#pragma endregion
#endif
//----------------------------------------------------------------------------------------- ↑ toml_utf8_streams.h ----
//----------------- ↓ toml_parser.h ----------------------------------------------------------------------------------
#pragma region
#if 1
TOML_PUSH_WARNINGS
TOML_DISABLE_PADDING_WARNINGS
@ -5979,14 +6010,15 @@ namespace toml
TOML_POP_WARNINGS // TOML_DISABLE_PADDING_WARNINGS
#pragma endregion
#endif
//----------------- ↑ toml_parser.h ----------------------------------------------------------------------------------
#endif // TOML_PARSER
#if TOML_IMPLEMENTATION
//------------------------------------------ ↓ toml_node.hpp ---------------------------------------------------------
#pragma region
#if 1
namespace toml
{
@ -6040,11 +6072,11 @@ namespace toml
TOML_EXTERNAL_LINKAGE const source_region& node::source() const noexcept { return source_; }
}
#pragma endregion
#endif
//------------------------------------------ ↑ toml_node.hpp ---------------------------------------------------------
//------------------------------------------------------------------ ↓ toml_array.hpp --------------------------------
#pragma region
#if 1
namespace toml
{
@ -6257,11 +6289,11 @@ namespace toml
}
}
#pragma endregion
#endif
//------------------------------------------------------------------ ↑ toml_array.hpp --------------------------------
//------------------------------------------------------------------------------------------- ↓ toml_table.hpp -------
#pragma region
#if 1
namespace toml
{
@ -6425,11 +6457,11 @@ namespace toml
}
}
#pragma endregion
#endif
//------------------------------------------------------------------------------------------- ↑ toml_table.hpp -------
//---------- ↓ toml_default_formatter.hpp ----------------------------------------------------------------------------
#pragma region
#if 1
TOML_PUSH_WARNINGS
TOML_DISABLE_SWITCH_WARNINGS
@ -6622,11 +6654,11 @@ namespace toml
TOML_POP_WARNINGS // TOML_DISABLE_SWITCH_WARNINGS, TOML_DISABLE_FLOAT_WARNINGS
#pragma endregion
#endif
//---------- ↑ toml_default_formatter.hpp ----------------------------------------------------------------------------
//------------------------------------- ↓ toml_json_formatter.hpp ----------------------------------------------------
#pragma region
#if 1
TOML_PUSH_WARNINGS
TOML_DISABLE_SWITCH_WARNINGS
@ -6677,13 +6709,13 @@ namespace toml
TOML_POP_WARNINGS // TOML_DISABLE_SWITCH_WARNINGS
#pragma endregion
#endif
//------------------------------------- ↑ toml_json_formatter.hpp ----------------------------------------------------
#if TOML_PARSER
//------------------------------------------------------------------ ↓ toml_parser.hpp -------------------------------
#pragma region
#if 1
TOML_PUSH_WARNINGS
TOML_DISABLE_ALL_WARNINGS
@ -9551,14 +9583,15 @@ namespace toml
TOML_POP_WARNINGS // TOML_DISABLE_SWITCH_WARNINGS, TOML_DISABLE_PADDING_WARNINGS
#pragma endregion
#endif
//------------------------------------------------------------------ ↑ toml_parser.hpp -------------------------------
#endif // TOML_PARSER
#if !TOML_ALL_INLINE
//--------------------------------------------------------------------------------------- ↓ toml_instantiations.hpp --
#pragma region
#if 1
TOML_PUSH_WARNINGS
TOML_DISABLE_ALL_WARNINGS
@ -9644,10 +9677,11 @@ namespace toml
#endif // TOML_PARSER
}
#pragma endregion
#endif
//--------------------------------------------------------------------------------------- ↑ toml_instantiations.hpp --
#endif // !TOML_ALL_INLINE
#endif // TOML_IMPLEMENTATION
// macro hygiene
@ -9700,8 +9734,6 @@ namespace toml
#undef TOML_LAUNDER
#endif
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#endif // INCLUDE_TOMLPLUSPLUS_H
// clang-format on

View File

@ -91,8 +91,13 @@
<Natvis Include="toml++.natvis" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tests\catch2.h" />
<ClInclude Include="..\tests\settings.h" />
<ClInclude Include="..\tests\tests.h" />
<ClInclude Include="..\tests\unicode.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\tests\meson.build" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@ -91,7 +91,12 @@
<Natvis Include="toml++.natvis" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tests\settings.h" />
<ClInclude Include="..\tests\tests.h" />
<ClInclude Include="..\tests\unicode.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\tests\meson.build" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@ -93,7 +93,12 @@
<Natvis Include="toml++.natvis" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tests\settings.h" />
<ClInclude Include="..\tests\tests.h" />
<ClInclude Include="..\tests\unicode.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\tests\meson.build" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@ -91,7 +91,12 @@
<Natvis Include="toml++.natvis" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tests\settings.h" />
<ClInclude Include="..\tests\tests.h" />
<ClInclude Include="..\tests\unicode.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\tests\meson.build" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@ -93,7 +93,12 @@
<Natvis Include="toml++.natvis" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tests\settings.h" />
<ClInclude Include="..\tests\tests.h" />
<ClInclude Include="..\tests\unicode.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\tests\meson.build" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@ -93,7 +93,12 @@
<Natvis Include="toml++.natvis" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tests\settings.h" />
<ClInclude Include="..\tests\tests.h" />
<ClInclude Include="..\tests\unicode.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\tests\meson.build" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@ -91,7 +91,12 @@
<Natvis Include="toml++.natvis" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tests\settings.h" />
<ClInclude Include="..\tests\tests.h" />
<ClInclude Include="..\tests\unicode.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\tests\meson.build" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@ -93,7 +93,12 @@
<Natvis Include="toml++.natvis" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tests\settings.h" />
<ClInclude Include="..\tests\tests.h" />
<ClInclude Include="..\tests\unicode.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\tests\meson.build" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@ -91,7 +91,12 @@
<Natvis Include="toml++.natvis" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tests\settings.h" />
<ClInclude Include="..\tests\tests.h" />
<ClInclude Include="..\tests\unicode.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\tests\meson.build" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@ -91,7 +91,12 @@
<Natvis Include="toml++.natvis" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tests\settings.h" />
<ClInclude Include="..\tests\tests.h" />
<ClInclude Include="..\tests\unicode.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\tests\meson.build" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@ -93,7 +93,12 @@
<Natvis Include="toml++.natvis" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tests\settings.h" />
<ClInclude Include="..\tests\tests.h" />
<ClInclude Include="..\tests\unicode.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\tests\meson.build" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@ -91,7 +91,12 @@
<Natvis Include="toml++.natvis" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tests\settings.h" />
<ClInclude Include="..\tests\tests.h" />
<ClInclude Include="..\tests\unicode.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\tests\meson.build" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@ -93,7 +93,12 @@
<Natvis Include="toml++.natvis" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tests\settings.h" />
<ClInclude Include="..\tests\tests.h" />
<ClInclude Include="..\tests\unicode.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\tests\meson.build" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@ -93,7 +93,12 @@
<Natvis Include="toml++.natvis" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tests\settings.h" />
<ClInclude Include="..\tests\tests.h" />
<ClInclude Include="..\tests\unicode.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\tests\meson.build" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@ -91,7 +91,12 @@
<Natvis Include="toml++.natvis" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tests\settings.h" />
<ClInclude Include="..\tests\tests.h" />
<ClInclude Include="..\tests\unicode.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\tests\meson.build" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@ -93,7 +93,12 @@
<Natvis Include="toml++.natvis" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tests\settings.h" />
<ClInclude Include="..\tests\tests.h" />
<ClInclude Include="..\tests\unicode.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\tests\meson.build" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

View File

@ -82,7 +82,8 @@
<ClInclude Include="..\include\toml++\toml_value.h" />
<ClInclude Include="..\include\toml++\toml_instantiations.hpp" />
<ClInclude Include="..\include\toml++\toml_version.h" />
<ClInclude Include="..\tests\catch2.h" />
<ClInclude Include="..\tests\settings.h" />
<ClInclude Include="..\toml.hpp" />
</ItemGroup>
<ItemGroup>
<None Include="..\.editorconfig" />
@ -97,7 +98,6 @@
<None Include="..\python\generate_single_header.py" />
<None Include="..\python\generate_unicode_functions.py" />
<None Include="..\README.md" />
<None Include="..\tests\meson.build" />
<None Include="toml++.props" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -49,9 +49,6 @@
<ClInclude Include="..\include\toml++\toml_version.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\tests\catch2.h">
<Filter>tests</Filter>
</ClInclude>
<ClInclude Include="..\include\toml++\toml_array.hpp">
<Filter>include</Filter>
</ClInclude>
@ -82,6 +79,10 @@
<ClInclude Include="..\include\toml++\toml_json_formatter.hpp">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\toml.hpp" />
<ClInclude Include="..\tests\settings.h">
<Filter>include</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\.editorconfig" />
@ -112,9 +113,6 @@
</None>
<None Include="..\CONTRIBUTING.md" />
<None Include="..\meson.build" />
<None Include="..\tests\meson.build">
<Filter>tests</Filter>
</None>
<None Include="toml++.props" />
</ItemGroup>
<ItemGroup>
@ -127,8 +125,5 @@
<Filter Include="doc">
<UniqueIdentifier>{5ed0949f-6855-4664-ad86-2b38ceeb400b}</UniqueIdentifier>
</Filter>
<Filter Include="tests">
<UniqueIdentifier>{b838dba3-02f6-446f-840e-6b4c62d2fb0c}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>