added clang's enum annotation attributes to all enums

also:
- added `CHANGELOG.md`
This commit is contained in:
Mark Gillard 2021-11-07 16:35:31 +02:00
parent aa645dd88c
commit 5e2ddc16c8
13 changed files with 623 additions and 34 deletions

View File

@ -25,7 +25,12 @@ AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- TOML_ABSTRACT_BASE
- TOML_CLOSED_ENUM
- TOML_CLOSED_FLAGS_ENUM
- TOML_EMPTY_BASES
- TOML_FLAGS_ENUM
- TOML_OPEN_ENUM
- TOML_OPEN_FLAGS_ENUM
- TOML_TRIVIAL_ABI
BinPackArguments: false
BinPackParameters: false

1
.gitattributes vendored
View File

@ -1,5 +1,6 @@
* text=auto encoding=UTF-8
*.bat text eol=lf encoding=UTF-8
*.c text eol=lf encoding=UTF-8
*.cpp text eol=lf encoding=UTF-8
*.css text eol=lf encoding=UTF-8

485
CHANGELOG.md Normal file
View File

@ -0,0 +1,485 @@
# Changelog
<!--
template:
## [vX.X.X](https://github.com/osgenic/stim/releases/tag/vX.X.X) - YYYY-MM-DD
#### Fixes:
#### Additions:
#### Changes:
#### Removals and Deprecations:
-->
## Unreleased
This release will be a major version bump, so it's ABI breaks all around. Any API changes that might necessitate
code changes at callsites or in build systems are indicated with '⚠&#xFE0F;'.
#### Fixes:
- fixed an illegal table redefinition edge case (#112) (@python36)
- fixed incorrect source position in redefinition error messages
- fixed documentation issues
- fixed some interfaces missing `TOML_API`
- fixed `toml::table` init-list constructor requiring double-brackets
- fixed missing `#include <initializer_list>`
- fixed missing `#include <utility>`
- fixed incorrect `noexcept` specifications on many functions ⚠&#xFE0F;
- fixed `TOML_API` + extern templates causing linker errors in some circumstances
- fixed inf and nan being formatted incorrectly by the `json_formatter`
- fixed parser not correctly round-tripping the format of binary and octal integers in some cases
#### Additions:
- added support for Unicode 14.0
- added formatter indentation flags (#120) (@W4RH4WK)
- added value flags to array + table insert methods (#44) (@levicki)
- added magic `value_flags` constant `preserve_source_value_flags`
- added clang's enum annotation attributes to all enums
- added `formatter_flags::quote_infinities_and_nans`
- added `TOML_ENABLE_FORMATTERS` option
- added `default_init_flags` param to `array::resize()`
- added `toml::yaml_formatter`
- added `operator->` to `toml::value` for class types
- added `parse_benchmark` example
- added `array::replace()` (#109) (#LebJe)
#### Changes:
- moved all implementation headers to `/impl`
- improved performance of parser's internal UTF-8 stream decoder
- made date/time constructors accept any integral types
- made all overloaded operators 'hidden friends' where possible
- renamed all implementation headers to `.h` and 'source' headers to `.inl`
- renamed `default_formatter` to `toml_formatter` (`default_formatter` is now an alias)
- applied clang-format to all the things 🎉&#xFE0F;
- updated conformance tests
#### Removals and Deprecations:
- removed `TOML_LARGE_FILES` (it is now default - explicitly setting `TOML_PARSER` to `0` will invoke an `#error`) ⚠&#xFE0F;
- renamed `TOML_PARSER` option to `TOML_ENABLE_PARSER` (`TOML_PARSER` will continue to work but is deprecated) ⚠&#xFE0F;
- renamed `TOML_WINDOWS_COMPAT` to `TOML_ENABLE_WINDOWS_COMPAT` (`TOML_WINDOWS_COMPAT` will continue to work but is deprecated) ⚠&#xFE0F;
- renamed `TOML_UNRELEASED_FEATURES` to `TOML_ENABLE_UNRELEASED_FEATURES` (`TOML_UNRELEASED_FEATURES` will continue to work but is deprecated) ⚠&#xFE0F;
- removed unnecessary template machinery (esp. where ostreams were involved)
- removed unnecessary uses of `final`
#### Build system:
- disabled 'install' path when being used as a meson subproject (#114) (@Tachi107)
- general meson improvements and fixes (#115) (@Tachi107)
- used `override_dependency` where supported (#116) (@Tachi107)
- fixed builds failing with meson 0.6.0 (#117) (@Tachi107)
- increased minimum required meson version to `0.54.0`&#xFE0F;
## [v2.5.0](https://github.com/osgenic/stim/releases/tag/v2.5.0) - 2021-07-11
#### Fixes:
- fixed linkage error with windows compat mode
- fixed `TOML_CONSTEVAL` broken in MSVC (again)
- fixed minor documentation bugs
- fixed cmake project version being incorrect (#110) (@GiulioRomualdi)
#### Additions:
- added support for lowercase 't' and 'z' in datetimes (per spec)
- added natvis file to cmake install (#106) (@Ryan-rsm-McKenzie)
- added VS cpp.hint file to cmake install
- added metafunctions `is_container`, `is_chronological`, `is_value`, `is_node`, `inserted_type_of`
#### Changes:
- improved debug code size by removing unnecessary std::forwards and std::moves
- modernized the CMake build files (#102, #103, #105) (@friendlyanon)
- updated conformance tests
## [v2.4.0](https://github.com/osgenic/stim/releases/tag/v2.4.0) - 2021-05-19
#### Fixes:
- fixed `node::value()` not retrieving inf and nan correctly
- fixed dotted kvps being unable to add subtables (#61) (@Validark)
- fixed linker error on linux ICC (#83) (@blackwer)
- fixed segfault JSON-formatting a failed `parse_result` (#96) (@proydakov)
- fixed spurious newline after JSON formatting a table
- fixed VS intellisense not detecting `TOML_COMPILER_EXCEPTIONS` correctly
- fixed crash with pathologically-nested inputs (#100) (@geeknik)
- fixed `parse_result` natvis
- fixed false-positive `char8_t` support detection on older compilers
- fixed unnecessary `#include <Windows.h>` Windows builds (@BeastLe9enD)
- fixed `TOML_CONSTEVAL` breaking on VS 16.10.0pre2
- fixed spurious warnings with MSVC /Wall
- fixed missing blank lines between consecutive empty tables/A-o-T
- fixed unnecessary `TOML_API` declarations
- fixed many small documentation issues
#### Additions:
- added proper cmake support (#85) (@ClausKlein)
- added cmake FetchContent information to documentation (#101) (@proydakov)
#### Removals and Deprecations:
- removed explicit `#include <fstream>` requirement for `parse_file()`
## [v2.3.0](https://github.com/osgenic/stim/releases/tag/v2.3.0) - 2020-12-29
#### Fixes:
- fixed compiler errors caused by `<charconv>` with Apple-flavoured clang
- fixed array and table iterators missing `iterator_category` (#77) (@HazardyKnusperkeks)
- fixed `Wuseless-cast` warnings on GCC 10 (#75) (@HazardyKnusperkeks)
- fixed formatter not correctly line wrapping in some rare circumstances (#73) (@89z)
- fixed an unnecessary global compiler flag breaking builds when used as a meson subproject (#72) (@jamabr)
- fixed link error caused by `<charconv>` on emscripten (#71) (@suy)
- fixed ambiguity with the `toml::literals` inline namespace (#69) (@std-any-emplace)
- fixed formatter emitting superfluous newlines after printing tables (#68) (@std-any-emplace)
- fixed array and table iterators not converting between const and non-const versions of themselves (#67) (@std-any-emplace)
- fixed some parser crashes when given pathologically-malformed UTF-8 (#65) (@sneves)
## [v2.2.0](https://github.com/osgenic/stim/releases/tag/v2.2.0) - 2020-08-09
#### Fixes:
- fixed some issues building with VS2017 (#55) (@sobczyk)
- fixed `_Float16` erroneously detected as supported on g++ (#57) (@sobczyk)
- fixed `<Windows.h>` causing compilation failure on mingw (#63) (@rezahousseini)
- fixed CMake and pkg-config files not being installed into architecture-agnostic directories (#59) (@tambry)
- fixed memory leak during parsing (#64) (@sneves)
- fixed ambiguous `operator==` error on MSVC (#56) (@HellsingDarge)
#### Additions:
- added additional node_view constructors
- added ability to specify serialization format of integer values
- added integer value serialization format round trip (e.g. hex in, hex out)
#### Changes:
- updated conformance tests
- TOML version bump to v1.0.0-rc.3
- refactors and cleanups based on feedback given [here](https://medium.com/@julienjorge/code-review-of-toml-f816a6071120)
#### Build system:
- renamed build options to `snake_case`
- tests, examples and cmake config now explicitly disabled when used as a subproject
- removed small_binaries (it's now implicit when building as release)
- bumped minimum meson version to 0.53
## [v2.1.0](https://github.com/osgenic/stim/releases/tag/v2.1.0) - 2020-07-11
#### Fixes:
- fixed inconsistent emission of leading/trailing newlines when writing a table to an ostream (#48) (@levicki)
- fixed `Wcast-align` warning spam on ARM
- fixed `array::insert` not working correctly in some cases
- fixed `node::value_or()` not having the same semantics as `node::value()` (#50) (@whiterabbit963)
- fixed 'misleading assignment' of rvalue node_views (#52) (@Reedbeta)
- fixed some issues handling infinities and NaNs (#51) (@Reedbeta)
- fixed some minor documentation issues
#### Additions:
- added support for `__fp16`, `_Float16`, `__float128`, `__int128_t` and `__uint128_t`
- added copy construction/assignment for arrays, tables and values
- added insert, emplace, push_back etc. compatibility with node_views
- added `node::is_homogenous`
- added `table::is_homogenous`
- added `value::is_homogenous` (just for generic code's sake)
- added `is_homogenous` overload for identifying failure-causing element
- added implicit conversion operator from `node` to `node_view` (#52) (@Reedbeta)
#### Changes:
- renamed `TOML_ALL_INLINE` to `TOML_HEADER_ONLY` (the old name will still work, but is no longer documented)
- general cleanup
## [v2.0.0](https://github.com/osgenic/stim/releases/tag/v2.0.0) - 2020-07-20
This release contains a fairly significant number of 'quality of life' improvements, yay! But also necessitates an ABI
break (hence the version number bump). Changes that might block a migration are annotated with '⚠&#xFE0F;'.
#### Fixes:
- fixed infinity and NaN-related code breaking when using `-ffast-math` and friends
- fixed narrowing conversion warnings when constructing int values from unsigned
- fixed Visual Studio debugger native visualizations for `date`, `time`, `time_offset`, `date_time`
- fixed some static assert messages being badly formatted on clang
- fixed internal macro `assert_or_assume` leaking out of `toml_parser.hpp`
#### Additions:
- added additional types allowed in `node::value()` and `node::value_or()` ([see `value()` dox for examples](https://marzer.github.io/tomlplusplus/classtoml_1_1node.html#ab144c1ae90338b6b03f6af0574c87993))
- added additional types allowed in `node_view::value()` and `node_view::value_or()`
- added `node::value_exact()` and `node_view::value_exact()`
- added support for interop with wide strings on Windows:
- added wide-string path arg overloads of `parse()` and `parse_file()`
- added wide-string support to all relevant `table` and `array` ops
- added wide-string support to `node::value(), node::value_or()`
- added wide-string support to `node_view::value(), node_view::value_or()`
- added wide-string support to `value<string>` constructor
- added wide-string overloads of `node_view::operator[]`
- added `source_region::wide_path()`
- added `TOML_WINDOWS_COMPAT` switch for explicitly enabling/disabling this stuff
- added emission of 'literal' strings to the TOML serializer
- added lots of minor documentation fixes and improvements
- added Visual Studio debugger native visualizations for `table`, `array`, `parse_result`, and `parse_error` (#46) (@Reedbeta)
- added non-template version of `array::is_homogeneous()`
- added explicit instantiations of more template types when `!TOML_ALL_INLINE`
#### Changes:
- improved the quality of many static_assert error messages
- simplified internal ABI namespaces ⚠&#xFE0F;
#### Removals and Deprecations:
- deprecated `node_view::get()` in favour of `node_view::node()`&#xFE0F;
- deprecated `parse_result::get()` in favour of `parse_result::table()`&#xFE0F;
- removed `TOML_CHAR_8_STRINGS` since it no longer makes sense ⚠&#xFE0F;
- renamed `date_time::time_offset` to just 'offset' ⚠&#xFE0F;
## [v1.3.3](https://github.com/osgenic/stim/releases/tag/v1.3.3) - 2020-06-29
#### Fixes:
- fixed some minor TOML spec conformance bugs
- fixed BOM check causing EOF on very short iostream inputs
- fixed `std::numeric_limits::max()` getting broken by macros in some environments
- fixed 'unknown pragma' warning spam in older versions of GCC
- fixed a few minor documentation issues
#### Additions:
- added rvalue overload of `array::flatten`
- added conformance tests from `BurntSushi/toml-test` and `iarna/toml-spec-tests`
- added `toml::inserter` as a workaround for nested construction of single-element `toml::arrays` performing move-construction instead
- added license boilerplate to test files
#### Changes:
- refactored the parser to reduce binary size
## [v1.3.2](https://github.com/osgenic/stim/releases/tag/v1.3.2) - 2020-06-19
#### Fixes:
- fixed single-digit negative integers parsing as positive
- fixed parse failure when parsing an empty file
- fixed multi-line strings being allowed in keys
- fixed overflow for very long binary integer literals
#### Changes:
- improved the performance of toml::parse_file
- improved the performance of printing to streams for deepy-nested TOML data
## [v1.3.0](https://github.com/osgenic/stim/releases/tag/v1.3.0) - 2020-06-02
#### Fixes:
- fixed `formatter::print_inline()` causing compilation failures in DLL builds
- fixed BOMs occasionally causing overflow/crash in char8 mode
- fixed some spurious warnings in GCC 10
- fixed clang static analyzer warning in BOM handling code
#### Additions:
- added `table_iterator::operator ->`
- added `array::resize()` and `array::truncate()`
- added `array::capacity()`, `array::shrink_to_fit()`, `array::max_size()`
- added non-const -> const conversion for table and array iterators
#### Changes:
- renamed table iterator proxy pair members to `first` and `second` to match STL
## [v1.2.5](https://github.com/osgenic/stim/releases/tag/v1.2.5) - 2020-04-24
#### Fixes:
- fixed some multi-line string parsing issues
- fixed pedantic warnings on gcc 10 and clang 11
- fixed `is_unicode_XXXXXX` functions being wrong in some cases
- fixed `TOML_LIKELY` not being correct on older versions of gcc and clang
- fixed minor documentation issues (#26, #38) (@prince-chrismc)
#### Additions:
- added additional error message cases to the parser
- added `error_printer` example
- added `toml_generator` example
#### Changes:
- improved unicode-related codegen
## [v1.2.3](https://github.com/osgenic/stim/releases/tag/v1.2.3) - 2020-04-11
#### Fixes:
- fixed printing of inf and nan
- fixed parser not handling floats with leading '.' characters
- fixed pedantic vtable warnings on clang with -Weverything
- fixed a number of documentation bugs
- fixed `TOML_UNRELEASED_FEATURES` default being 1 (it should have been 0)
#### Additions:
- added `TOML_PARSER` configuration option
- added `TOML_LIB_SINGLE_HEADER` indicator
- added doxygen page for the configuration options
- added SPDX-License-Identifiers around the place
#### Changes:
- split some header files up to make future maintenance easier
- refactored and greatly simplified parser
## [v1.2.0](https://github.com/osgenic/stim/releases/tag/v1.2.0) - 2020-04-07
#### Fixes:
- fixed some parsing and printing ops being locale-dependent
- fixed some parsing errors at EOF when `TOML_EXCEPTIONS = 0`
- fixed some unreferenced variable warnings on older compilers
- fixed some 'maybe-uninitialized' false-positives on GCC9
- fixed pkgconfig subdir being wrong
#### Additions:
- added support for implementations without `<charconv>`
- added cmake package config generator (#22) (@GiulioRomualdi)
- added build config feature option `GENERATE_CMAKE_CONFIG`
- added many new tests
## [v1.1.0](https://github.com/osgenic/stim/releases/tag/v1.1.0) - 2020-04-03
#### Fixes:
- fixed some parser error paths not returning early enough `TOML_EXCEPTIONS=0`
- fixed a number of minor documentation issues
#### Additions:
- added support for [TOML 1.0.0-rc.1](https://github.com/toml-lang/toml/releases/tag/v1.0.0-rc.1) 🎉
- added `operator[]`, `begin()`, `end()` to `toml::parse_result` for `TOML_EXCEPTIONS=0`
- added additional compilation speed improvements for `TOML_ALL_INLINE=0`
- added more specific error messages for parsing errors relating to prohibited codepoints
- added a large number of additional tests
- added support for installation with meson (#16) (@ximion)
- added the array and table iterators to the `toml` namespace
## [v1.0.0](https://github.com/osgenic/stim/releases/tag/1.0.0) - 2020-03-28
#### Fixes:
- fixed minor documentation issues
#### Changes:
- refactoring of ABI-based inline namespaces
## [v0.6.0](https://github.com/osgenic/stim/releases/tag/v0.6.0) - 2020-03-24
#### Fixes:
- fixed minor preprocessor/macro issues
- fixed minor documentation issues
#### Additions:
- added `<cassert>` include directly in 'debug' builds when `TOML_ASSERT` isn't defined
- added Clang's `[[trivial_abi]]` attribute to `date`, `time`, `time_offset`
## [v0.5.0](https://github.com/osgenic/stim/releases/tag/v0.5.0) - 2020-03-18
#### Fixes:
- fixed crash when reaching EOF while parsing a string when exceptions are disabled
- fixed some attribute warnings in GCC
- fixed build with GCC 8.2.0 (#15) (@shdnx)
- fixed exception mode detection sometimes being incorrect on MSVC
- fixed compilation on older implementations without `std::launder`
- fixed `json_formatter` type deduction on older compilers
#### Additions:
- added support for Unicode 13.0
- added support for `\xHH` escape sequences ([toml/pull/796](https://github.com/toml-lang/toml/pull/796))
- added short-form license preamble to all source files
- added build configuration option for compiling examples
## [v0.4.3](https://github.com/osgenic/stim/releases/tag/v0.4.3) - 2020-03-10
#### Fixes:
- fixed ICE in VS2019 when using `/std:c++17` instead of `/std:c++latest
#### Additions:
- added `#error` when `TOML_EXCEPTIONS` is set to `1` but compiler exceptions were disabled
#### Changes:
- parsing performance improvements
## [v0.4.0](https://github.com/osgenic/stim/releases/tag/v0.4.0) - 2020-03-05
#### Fixes:
- fixed `parse_file()` failing to compile with plain string literals
- fixed tests being built when used as a meson subproject (#14) (@shdnx)
#### Additions:
- added support for compiling into DLLs on windows (`TOML_API`)
- added support for explicitly setting the `TOML_EXCEPTION` mode
- added `TOML_OPTIONAL_TYPE` customization point
- added `node::ref()` and `node_view::ref()`
## [v0.3.0](https://github.com/osgenic/stim/releases/tag/v0.3.0) - 2020-03-01
#### Fixes:
- fixed some pedantic clang warnings
- fixed some minor documentation errors
#### Additions:
- added `node::value()` and `node::value_or()`
- added `node_view::value()`
- added relops for the date/time classes
- added `TOML_ALL_INLINE` and `TOML_IMPLEMENTATION` options
- added preliminary support for ICC
#### Removals and Deprecations:
- removed `<cmath>` dependency
## [v0.2.1](https://github.com/osgenic/stim/releases/tag/v0.2.1) - 2020-02-26
#### Fixes:
- fixed minor printing bug in `operator<<(ostream, source_position)`
- fixed minor documentation issues
#### Additions:
- added `operator<<(ostream&, parse_error)`
#### Changes:
- improved quality of error messages for boolean and inf/nan parsing
## [v0.2.0](https://github.com/osgenic/stim/releases/tag/v0.2.0) - 2020-02-23
#### Fixes:
- fixed truncation of floating-point values when using ostreams
- fixed missing value deduction guides for dates and times
- fixed potential ODR issues relating to exception mode handling etc.
- fixed some documentation issues
#### Additions:
- added serialization round-trip tests
- added `node::is_number()`
- added `node_view::is_number()`
- added `node_view::value_or()`
- added hexfloat parsing support for all implementations (not just `<charconv>` ones)
## [v0.1.0](https://github.com/osgenic/stim/releases/tag/v0.1.0) - 2020-02-20
- First public release, yay! 🎉&#xFE0F;

View File

@ -29,7 +29,7 @@ git submodule update --init --depth 1 external/Catch2 external/tloptional
### Testing on Windows with Visual Studio
Install [Visual Studio 2019] and [Test Adapter for Catch2], then open `vs/toml++.sln` and build the
Install [Visual Studio] and [Test Adapter for Catch2], then open `vs/toml++.sln` and build the
projects in the `tests` solution folder. Visual Studio's Test Explorer should pick these up and
allow you to run the tests directly.
@ -65,7 +65,7 @@ cd build-gcc-debug && ninja && ninja test \
```
[Visual Studio 2019]: https://visualstudio.microsoft.com/vs/
[Visual Studio]: https://visualstudio.microsoft.com/vs/
[Test Adapter for Catch2]: https://marketplace.visualstudio.com/items?itemName=JohnnyHendriks.ext01
[reporting issues]: https://github.com/marzer/tomlplusplus/issues
[Catch2]: https://github.com/catchorg/Catch2

View File

@ -6,14 +6,17 @@
#define TOML_ANON_NAMESPACE_START namespace
#define TOML_API
#define TOML_ATTR(...)
#define TOML_CLOSED_ENUM
#define TOML_CLOSED_FLAGS_ENUM
#define TOML_CONST_GETTER
#define TOML_CONST_INLINE_GETTER inline
#define TOML_CONSTRAINED_TEMPLATE(cond, ...) template <__VA_ARGS__>
#define TOML_HIDDEN_CONSTRAINT(cond, ...) template <__VA_ARGS__>
#define TOML_EMPTY_BASES
#define TOML_EXTERN
#define TOML_EXTERN_NOEXCEPT(...)
#define TOML_EXTERNAL_LINKAGE
#define TOML_FLAGS_ENUM
#define TOML_HIDDEN_CONSTRAINT(cond, ...) template <__VA_ARGS__>
#define TOML_IMPL_NAMESPACE_END static_assert(true)
#define TOML_IMPL_NAMESPACE_START namespace toml::impl
#define TOML_INTERNAL_LINKAGE static
@ -23,6 +26,8 @@
#define TOML_NEVER_INLINE
#define TOML_NODISCARD
#define TOML_NODISCARD_CTOR
#define TOML_OPEN_ENUM
#define TOML_OPEN_FLAGS_ENUM
#define TOML_PURE_GETTER
#define TOML_PURE_INLINE_GETTER inline
#define TOML_RETURNS_BY_THROWING

View File

@ -217,7 +217,7 @@ TOML_NAMESPACE_START // abi namespace
}
/// \brief TOML node type identifiers.
enum class node_type : uint8_t
enum class TOML_CLOSED_ENUM node_type : uint8_t
{
none, ///< Not-a-node.
table, ///< The node is a toml::table.
@ -262,7 +262,7 @@ TOML_NAMESPACE_START // abi namespace
}
/// \brief Metadata associated with TOML values.
enum class value_flags : uint16_t
enum class TOML_OPEN_FLAGS_ENUM value_flags : uint16_t
{
/// \brief None.
none,
@ -287,7 +287,7 @@ TOML_NAMESPACE_START // abi namespace
///
/// \note Formatters may disregard/override any of these flags according to the requirements of their
/// output target (e.g. #toml::json_formatter will always apply quotes to dates and times).
enum class format_flags : uint64_t
enum class TOML_CLOSED_FLAGS_ENUM format_flags : uint64_t
{
/// \brief None.
none,
@ -898,7 +898,7 @@ TOML_IMPL_NAMESPACE_START
// Q: "why not use std::fpclassify?"
// A: Because it gets broken by -ffast-math and friends
enum class fp_class : unsigned
enum class TOML_CLOSED_ENUM fp_class : unsigned
{
ok,
neg_inf,

View File

@ -2546,7 +2546,7 @@ TOML_IMPL_NAMESPACE_START
// value types from here down require more than one character to unambiguously identify
// so scan ahead and collect a set of value 'traits'.
enum value_traits : int
enum TOML_CLOSED_FLAGS_ENUM value_traits : int
{
has_nothing = 0,
has_digits = 1,
@ -2563,14 +2563,11 @@ TOML_IMPL_NAMESPACE_START
has_dot = 1 << 11,
begins_sign = 1 << 12,
begins_digit = 1 << 13,
begins_zero = 1 << 14
begins_zero = 1 << 14,
// Q: "why not make these real values in the enum??"
// A: because the visual studio debugger stops treating them as a set of flags if you add
// non-pow2 values, making them much harder to debug.
#define signs_msk (has_plus | has_minus)
#define bzero_msk (begins_zero | has_digits)
#define bdigit_msk (begins_digit | has_digits)
signs_msk = has_plus | has_minus,
bzero_msk = begins_zero | has_digits,
bdigit_msk = begins_digit | has_digits,
};
value_traits traits = has_nothing;
const auto has_any = [&](auto t) noexcept { return (traits & t) != has_nothing; };
@ -3432,7 +3429,8 @@ TOML_IMPL_NAMESPACE_START
}
public:
parser(utf8_reader_interface&& reader_) : reader{ reader_ }
parser(utf8_reader_interface&& reader_) //
: reader{ reader_ }
{
root.source_ = { prev_pos, prev_pos, reader.source_path() };
@ -3486,7 +3484,7 @@ TOML_IMPL_NAMESPACE_START
node_ptr arr_ptr{ new array{} };
array& arr = arr_ptr->ref_cast<array>();
enum parse_elem : int
enum TOML_CLOSED_ENUM parse_elem : int
{
none,
comma,
@ -3552,7 +3550,7 @@ TOML_IMPL_NAMESPACE_START
node_ptr tbl_ptr{ new table{} };
table& tbl = tbl_ptr->ref_cast<table>();
tbl.inline_ = true;
enum parse_elem : int
enum TOML_CLOSED_ENUM parse_elem : int
{
none,
comma,

View File

@ -130,6 +130,17 @@
#if !defined(TOML_TRIVIAL_ABI) && __has_attribute(trivial_abi)
#define TOML_TRIVIAL_ABI __attribute__((__trivial_abi__))
#endif
#if !defined(TOML_FLAGS_ENUM) && __has_attribute(flag_enum)
#define TOML_FLAGS_ENUM __attribute__((__flag_enum__))
#endif
#if __has_attribute(enum_extensibility)
#ifndef TOML_OPEN_ENUM
#define TOML_OPEN_ENUM __attribute__((enum_extensibility(open)))
#endif
#ifndef TOML_CLOSED_ENUM
#define TOML_CLOSED_ENUM __attribute__((enum_extensibility(closed)))
#endif
#endif
#endif
#define TOML_LIKELY(...) (__builtin_expect(!!(__VA_ARGS__), 1) )
#define TOML_UNLIKELY(...) (__builtin_expect(!!(__VA_ARGS__), 0) )
@ -584,6 +595,26 @@
#define TOML_UNREACHABLE TOML_ASSERT(false)
#endif
#ifndef TOML_FLAGS_ENUM
#define TOML_FLAGS_ENUM
#endif
#ifndef TOML_OPEN_ENUM
#define TOML_OPEN_ENUM
#endif
#ifndef TOML_CLOSED_ENUM
#define TOML_CLOSED_ENUM
#endif
#ifndef TOML_OPEN_FLAGS_ENUM
#define TOML_OPEN_FLAGS_ENUM TOML_OPEN_ENUM TOML_FLAGS_ENUM
#endif
#ifndef TOML_CLOSED_FLAGS_ENUM
#define TOML_CLOSED_FLAGS_ENUM TOML_CLOSED_ENUM TOML_FLAGS_ENUM
#endif
#ifdef __has_cpp_attribute
#define TOML_HAS_ATTR(...) __has_cpp_attribute(__VA_ARGS__)
#else
@ -1003,6 +1034,7 @@ TOML_ENABLE_WARNINGS;
/// \remark If you're building for a platform that has a built-in half precision float (e.g. `_Float16`), you don't
/// need to use this configuration option to make toml++ aware of it; the library comes with that built-in.
#define TOML_SMALL_INT_TYPE
/// \def TOML_SMALL_INT_TYPE
/// \brief If your codebase has an additional 'small' integer type (e.g. 24-bits), this tells toml++ about it.

View File

@ -79,6 +79,8 @@ TOML_POP_WARNINGS;
#undef TOML_ASYMMETRICAL_EQUALITY_OPS
#undef TOML_ATTR
#undef TOML_CLANG
#undef TOML_CLOSED_ENUM
#undef TOML_CLOSED_FLAGS_ENUM
#undef TOML_COMPILER_EXCEPTIONS
#undef TOML_CONCAT
#undef TOML_CONCAT_1
@ -101,6 +103,7 @@ TOML_POP_WARNINGS;
#undef TOML_EXTERN
#undef TOML_EXTERN_NOEXCEPT
#undef TOML_EXTERNAL_LINKAGE
#undef TOML_FLAGS_ENUM
#undef TOML_FLOAT_CHARCONV
#undef TOML_FLOAT128
#undef TOML_FLOAT16
@ -140,6 +143,8 @@ TOML_POP_WARNINGS;
#undef TOML_NEVER_INLINE
#undef TOML_NODISCARD
#undef TOML_NODISCARD_CTOR
#undef TOML_OPEN_ENUM
#undef TOML_OPEN_FLAGS_ENUM
#undef TOML_PARSER_TYPENAME
#undef TOML_POP_WARNINGS
#undef TOML_PURE_GETTER

View File

@ -91,6 +91,7 @@
<None Include=".github\pull_request_template.md" />
<None Include=".gitignore" />
<None Include=".runsettings" />
<None Include="CHANGELOG.md" />
<None Include="CODE_OF_CONDUCT.md" />
<None Include="CONTRIBUTING.md" />
<None Include="include\toml++\impl\node_view_extern.inl" />
@ -110,6 +111,7 @@
<None Include="tools\ci_single_header_check.py" />
<None Include="tools\clang_format.bat" />
<None Include="tools\generate_conformance_tests.py" />
<None Include="tools\generate_single_header.bat" />
<None Include="tools\generate_single_header.py" />
<None Include="tools\generate_windows_test_targets.py" />
<None Include="tools\utils.py" />

View File

@ -207,6 +207,10 @@
<None Include="include\toml++\impl\yaml_formatter.inl">
<Filter>include\impl</Filter>
</None>
<None Include="CHANGELOG.md" />
<None Include="tools\generate_single_header.bat">
<Filter>tools</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Filter Include=".circleci">

View File

@ -166,6 +166,17 @@
#if !defined(TOML_TRIVIAL_ABI) && __has_attribute(trivial_abi)
#define TOML_TRIVIAL_ABI __attribute__((__trivial_abi__))
#endif
#if !defined(TOML_FLAGS_ENUM) && __has_attribute(flag_enum)
#define TOML_FLAGS_ENUM __attribute__((__flag_enum__))
#endif
#if __has_attribute(enum_extensibility)
#ifndef TOML_OPEN_ENUM
#define TOML_OPEN_ENUM __attribute__((enum_extensibility(open)))
#endif
#ifndef TOML_CLOSED_ENUM
#define TOML_CLOSED_ENUM __attribute__((enum_extensibility(closed)))
#endif
#endif
#endif
#define TOML_LIKELY(...) (__builtin_expect(!!(__VA_ARGS__), 1) )
#define TOML_UNLIKELY(...) (__builtin_expect(!!(__VA_ARGS__), 0) )
@ -599,6 +610,26 @@
#define TOML_UNREACHABLE TOML_ASSERT(false)
#endif
#ifndef TOML_FLAGS_ENUM
#define TOML_FLAGS_ENUM
#endif
#ifndef TOML_OPEN_ENUM
#define TOML_OPEN_ENUM
#endif
#ifndef TOML_CLOSED_ENUM
#define TOML_CLOSED_ENUM
#endif
#ifndef TOML_OPEN_FLAGS_ENUM
#define TOML_OPEN_FLAGS_ENUM TOML_OPEN_ENUM TOML_FLAGS_ENUM
#endif
#ifndef TOML_CLOSED_FLAGS_ENUM
#define TOML_CLOSED_FLAGS_ENUM TOML_CLOSED_ENUM TOML_FLAGS_ENUM
#endif
#ifdef __has_cpp_attribute
#define TOML_HAS_ATTR(...) __has_cpp_attribute(__VA_ARGS__)
#else
@ -1173,7 +1204,7 @@ TOML_NAMESPACE_START // abi namespace
{
}
enum class node_type : uint8_t
enum class TOML_CLOSED_ENUM node_type : uint8_t
{
none,
table,
@ -1203,7 +1234,7 @@ TOML_NAMESPACE_START // abi namespace
}
}
enum class value_flags : uint16_t
enum class TOML_OPEN_FLAGS_ENUM value_flags : uint16_t
{
none,
format_as_binary = 1,
@ -1215,7 +1246,7 @@ TOML_NAMESPACE_START // abi namespace
inline constexpr value_flags preserve_source_value_flags =
POXY_IMPLEMENTATION_DETAIL(value_flags{ static_cast<std::underlying_type_t<value_flags>>(-1) });
enum class format_flags : uint64_t
enum class TOML_CLOSED_FLAGS_ENUM format_flags : uint64_t
{
none,
quote_dates_and_times = (1ull << 0),
@ -1762,7 +1793,7 @@ TOML_IMPL_NAMESPACE_START
// Q: "why not use std::fpclassify?"
// A: Because it gets broken by -ffast-math and friends
enum class fp_class : unsigned
enum class TOML_CLOSED_ENUM fp_class : unsigned
{
ok,
neg_inf,
@ -12145,7 +12176,7 @@ TOML_IMPL_NAMESPACE_START
// value types from here down require more than one character to unambiguously identify
// so scan ahead and collect a set of value 'traits'.
enum value_traits : int
enum TOML_CLOSED_FLAGS_ENUM value_traits : int
{
has_nothing = 0,
has_digits = 1,
@ -12162,14 +12193,10 @@ TOML_IMPL_NAMESPACE_START
has_dot = 1 << 11,
begins_sign = 1 << 12,
begins_digit = 1 << 13,
begins_zero = 1 << 14
// Q: "why not make these real values in the enum??"
// A: because the visual studio debugger stops treating them as a set of flags if you add
// non-pow2 values, making them much harder to debug.
#define signs_msk (has_plus | has_minus)
#define bzero_msk (begins_zero | has_digits)
#define bdigit_msk (begins_digit | has_digits)
begins_zero = 1 << 14,
signs_msk = has_plus | has_minus,
bzero_msk = begins_zero | has_digits,
bdigit_msk = begins_digit | has_digits,
};
value_traits traits = has_nothing;
const auto has_any = [&](auto t) noexcept { return (traits & t) != has_nothing; };
@ -13031,7 +13058,8 @@ TOML_IMPL_NAMESPACE_START
}
public:
parser(utf8_reader_interface&& reader_) : reader{ reader_ }
parser(utf8_reader_interface&& reader_) //
: reader{ reader_ }
{
root.source_ = { prev_pos, prev_pos, reader.source_path() };
@ -13085,7 +13113,7 @@ TOML_IMPL_NAMESPACE_START
node_ptr arr_ptr{ new array{} };
array& arr = arr_ptr->ref_cast<array>();
enum parse_elem : int
enum TOML_CLOSED_ENUM parse_elem : int
{
none,
comma,
@ -13151,7 +13179,7 @@ TOML_IMPL_NAMESPACE_START
node_ptr tbl_ptr{ new table{} };
table& tbl = tbl_ptr->ref_cast<table>();
tbl.inline_ = true;
enum parse_elem : int
enum TOML_CLOSED_ENUM parse_elem : int
{
none,
comma,
@ -14428,6 +14456,8 @@ TOML_POP_WARNINGS;
#undef TOML_ASYMMETRICAL_EQUALITY_OPS
#undef TOML_ATTR
#undef TOML_CLANG
#undef TOML_CLOSED_ENUM
#undef TOML_CLOSED_FLAGS_ENUM
#undef TOML_COMPILER_EXCEPTIONS
#undef TOML_CONCAT
#undef TOML_CONCAT_1
@ -14450,6 +14480,7 @@ TOML_POP_WARNINGS;
#undef TOML_EXTERN
#undef TOML_EXTERN_NOEXCEPT
#undef TOML_EXTERNAL_LINKAGE
#undef TOML_FLAGS_ENUM
#undef TOML_FLOAT_CHARCONV
#undef TOML_FLOAT128
#undef TOML_FLOAT16
@ -14489,6 +14520,8 @@ TOML_POP_WARNINGS;
#undef TOML_NEVER_INLINE
#undef TOML_NODISCARD
#undef TOML_NODISCARD_CTOR
#undef TOML_OPEN_ENUM
#undef TOML_OPEN_FLAGS_ENUM
#undef TOML_PARSER_TYPENAME
#undef TOML_POP_WARNINGS
#undef TOML_PURE_GETTER

View File

@ -0,0 +1,19 @@
@ECHO off
SETLOCAL enableextensions enabledelayedexpansion
PUSHD .
CD /d "%~dp0"
REM --------------------------------------------------------------------------------------
REM Invokes generate_single_header.py.
REM --------------------------------------------------------------------------------------
py generate_single_header.py %*
if %ERRORLEVEL% NEQ 0 (
PAUSE
GOTO FINISH
)
:FINISH
POPD
@ENDLOCAL
EXIT /B %ERRORLEVEL%