diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 07550a42..1591219f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,155 +1,143 @@ name: ci on: - push: - branches-ignore: - - 'gh-pages' - paths: - - '**.h' - - '**.hpp' - - '**.cpp' - - '**.inl' - - '**.py' - - '**/meson.build' - - '**/workflows/**.yaml' - pull_request: - branches-ignore: - - 'gh-pages' - paths: - - '**.h' - - '**.hpp' - - '**.cpp' - - '**.inl' - - '**.py' - - '**/meson.build' - - '**/workflows/**.yaml' - workflow_dispatch: + push: + branches-ignore: + - "gh-pages" + paths: + - "**.h" + - "**.hpp" + - "**.cpp" + - "**.inl" + - "**.py" + - "**/meson.build" + - "**/workflows/**.yaml" + pull_request: + branches-ignore: + - "gh-pages" + paths: + - "**.h" + - "**.hpp" + - "**.cpp" + - "**.inl" + - "**.py" + - "**/meson.build" + - "**/workflows/**.yaml" + workflow_dispatch: concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true env: - clang_version: '14' - gcc_version: '11' + clang_version: "14" + gcc_version: "11" jobs: - linux: - strategy: - fail-fast: false - matrix: - compiler: - - 'clang++' - - 'g++' - linker: - - 'lld' - type: - - 'debug' - - 'release' - compile_library: - - 'true' - - 'false' - - runs-on: ubuntu-latest - - defaults: - run: - shell: bash - - steps: - - name: Install base dependencies - run: | - sudo apt -y update - sudo apt -y install --no-install-recommends git python3 python3-pip ninja-build locales-all - sudo -H pip3 install --no-cache-dir --upgrade meson - - - uses: actions/checkout@v3 - - - name: Check toml.hpp - run: | - cd tools - sudo -H pip3 install --upgrade --requirement ./requirements.txt - python3 ci_single_header_check.py - - - name: Update LLVM package repository - if: ${{ startsWith(matrix.compiler, 'clang') || startsWith(matrix.linker, 'lld') }} - run: | - sudo apt -y install --no-install-recommends software-properties-common wget - wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - codename=$(lsb_release -sc) - sudo add-apt-repository --yes --no-update "deb http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${{ env.clang_version }} main" - sudo apt -y update - - - name: Install clang - if: ${{ startsWith(matrix.compiler, 'clang') }} - run: | - sudo apt -y install --no-install-recommends clang-${{ env.clang_version }} - sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${{ env.clang_version }} 1000 - - - name: Install g++ - if: ${{ startsWith(matrix.compiler, 'g++') }} - run: | - sudo apt -y install --no-install-recommends g++-${{ env.gcc_version }} - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${{ env.gcc_version }} 1000 - - - name: Install lld - if: ${{ startsWith(matrix.linker, 'lld') }} - run: | - sudo apt -y install --no-install-recommends lld-${{ env.clang_version }} - sudo update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/ld.lld-${{ env.clang_version }} 1000 - - - name: Configure locales - run: | - sudo locale-gen 'en_US.utf8' 'ja_JP.utf8' 'de_DE.utf8' 'it_IT.utf8' 'tr_TR.utf8' 'fi_FI.utf8' 'fr_FR.utf8' 'zh_CN.utf8' - - - name: Configure Meson - run: | - CXX=${{ matrix.compiler }} CXX_LD=${{ matrix.linker }} meson setup build --buildtype=${{ matrix.type }} -Dcompile_library=${{ matrix.compile_library }} -Dpedantic=true -Dbuild_tests=true -Dbuild_examples=true -Dgenerate_cmake_config=false -Db_lto=false -Dubsan_examples=true -Dasan_examples=true - - - name: Build - run: meson compile -C build --jobs -1 - - - name: Test - run: meson test -C build --verbose - - windows: - strategy: - fail-fast: false - matrix: - type: - - 'debug' - - 'release' - compile_library: - - 'true' - # - 'false' # ... header-only mode takes far too long on github's windows runner - - runs-on: windows-2022 - - defaults: - run: - shell: cmd - - steps: - - name: Install dependencies - run: | - python3 -m pip install -U pip - pip3 install meson ninja - - - uses: actions/checkout@v3 - - - uses: ilammy/msvc-dev-cmd@v1 - - - name: Configure Meson - run: meson setup --vsenv --buildtype=${{ matrix.type }} -Dcompile_library=${{ matrix.compile_library }} -Dpedantic=true -Dbuild_tests=true -Dbuild_examples=true -Dgenerate_cmake_config=false build - - - name: Build - run: meson compile -C build --jobs -1 - - - name: Test - run: meson test -C build --verbose - + linux: + strategy: + fail-fast: false + matrix: + compiler: + - "clang" + - "gcc" + linker: + - "lld" + type: + - "debug" + - "release" + + runs-on: ubuntu-latest + + defaults: + run: + shell: bash + + steps: + - name: Install base dependencies + run: | + sudo apt -y update + sudo apt -y install --no-install-recommends git python3 python3-pip ninja-build libstdc++-${{ env.gcc_version }}-dev locales-all + + - uses: actions/checkout@v3 + + - name: Install python dependencies + run: | + sudo -H pip3 install --no-cache-dir --upgrade meson + sudo -H pip3 install --no-cache-dir --upgrade -r tools/requirements.txt + + - name: Check toml.hpp + run: | + python3 ./tools/ci_single_header_check.py + + - name: Install lld + if: ${{ startsWith(matrix.linker, 'lld') }} + run: | + sudo apt -y install --no-install-recommends lld-${{ env.clang_version }} + sudo update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/ld.lld-${{ env.clang_version }} 1000 + + - name: Install clang + if: ${{ startsWith(matrix.compiler, 'clang') }} + run: | + sudo apt -y install --no-install-recommends clang-${{ env.clang_version }} + sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-${{ env.clang_version }} 1000 + sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${{ env.clang_version }} 1000 + + - name: Install gcc + if: ${{ startsWith(matrix.compiler, 'gcc') }} + run: | + sudo apt -y install --no-install-recommends gcc-${{ env.gcc_version }} g++-${{ env.gcc_version }} + sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-${{ env.gcc_version }} 1000 + sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-${{ env.gcc_version }} 1000 + + - name: Configure locales + run: | + sudo locale-gen 'en_US.utf8' 'ja_JP.utf8' 'de_DE.utf8' 'it_IT.utf8' 'tr_TR.utf8' 'fi_FI.utf8' 'fr_FR.utf8' 'zh_CN.utf8' + + - name: Configure Meson + run: | + CXX=${{ matrix.compiler }} CXX_LD=${{ matrix.linker }} meson setup build --buildtype=${{ matrix.type }} -Ddevel=true -Db_lto=false + + - name: Build + run: meson compile -C build + + - name: Test + run: meson test -C build --verbose + + windows: + strategy: + fail-fast: false + matrix: + type: + - "debug" + - "release" + + runs-on: windows-2022 + + defaults: + run: + shell: cmd + + steps: + - name: Install dependencies + run: | + python3 -m pip install -U pip + pip3 install meson ninja + + - uses: actions/checkout@v3 + + - uses: ilammy/msvc-dev-cmd@v1 + + - name: Configure Meson + run: meson setup build --vsenv --buildtype=${{ matrix.type }} -Ddevel=true -Db_lto=false + + - name: Build + run: meson compile -C build + + - name: Test + run: meson test -C build --verbose # tipi-build-linux: -# name: tipi.build project build and dependency resolution +# name: tipi.build project build and dependency resolution # runs-on: ubuntu-latest # if: github.ref == 'refs/heads/master' # container: tipibuild/tipi-ubuntu @@ -167,7 +155,7 @@ jobs: # # - name: Build as project target linux-cxx20 (run tests 'odr_test_1' and 'main') # run: tipi . --dont-upgrade --verbose -t linux-cxx20 --test "odr_test_1|main" -# +# # - name: Cleanup project builds # run: rm -r ./build # @@ -181,12 +169,12 @@ jobs: # BRANCH_NAME="${GITHUB_REF##*/}" # fi # echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV -# +# # # trying if pulling the dependency with tipi works properly # - name: Build as dependency # run: | # cd examples/ -# +# # # create test directory and copy the simple_parser.cpp in there # mkdir test-as-dep # cp examples.h test-as-dep/. diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a930019..d46bb9d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,12 +25,23 @@ template: #### Fixes: -- fixed null pointer dereference in parser when exceptions are disabled (#169) (@ncaklovic) -- fixed spurious warnings in MSVC 19.34 -- fixed some `_Float16` detection issues -- fixed `toml::parse_file()` on windows for non-ASCII paths -- added `toml::format_flags::terse_key_value_pairs` -- added `TOML_ENABLE_FLOAT16` config to fix #178 (@Scrumplex) +- fixed null pointer dereference in parser when exceptions are disabled (#169) (@ncaklovic) +- fixed spurious warnings in MSVC 19.34 +- fixed `toml::parse_file()` on windows for non-ASCII paths + +#### Additions: + +- added `toml::format_flags::terse_key_value_pairs` +- added `TOML_ENABLE_FLOAT16` config (#178) (@Scrumplex) + +#### Removals: + +- removed automatic detection of `_Float16` (you must explicitly set `TOML_ENABLE_FLOAT16` to enable it) (#186) (@benthetechguy) + +#### Build system: + +- re-wrote the meson scripts to fix a number of issues (#185, #186) (@Tachi107, @benthetechguy) +- increased the minimum required meson version to `0.61.0`

@@ -40,21 +51,21 @@ template: #### Fixes: -- fixed `[dotted.table]` source columns sometimes being off by one (#152) (@vaartis) -- fixed spurious `Wnull-dereference` warning on GCC (#164) (@zaporozhets) -- fixed `print_to_stream` ambiguity for `size_t` (#167) (@acronce) +- fixed `[dotted.table]` source columns sometimes being off by one (#152) (@vaartis) +- fixed spurious `Wnull-dereference` warning on GCC (#164) (@zaporozhets) +- fixed `print_to_stream` ambiguity for `size_t` (#167) (@acronce) #### Additions: -- added value type deduction to `emplace()` methods -- added `toml::path` utility type (#153, #156, #168) (@jonestristand, @kcsaul) -- added config option `TOML_CALLCONV` -- added missing relational operators for `source_position` +- added value type deduction to `emplace()` methods +- added `toml::path` utility type (#153, #156, #168) (@jonestristand, @kcsaul) +- added config option `TOML_CALLCONV` +- added missing relational operators for `source_position` #### Changes: -- relaxed cvref requirements of `is_homogeneous()`, `emplace()`, `emplace_back()`, `emplace_hint()` -- relaxed mantissa and digits10 requirements of extended float support +- relaxed cvref requirements of `is_homogeneous()`, `emplace()`, `emplace_back()`, `emplace_hint()` +- relaxed mantissa and digits10 requirements of extended float support

@@ -64,28 +75,28 @@ template: #### Fixes: -- fixed potential segfault when calling `at_path()` with an empty string -- fixed UB in internal unicode machinery (#144) (@kchalmer) -- fixed a number of spurious warnings with Clang 10 (#145, #146) (@chronoxor) +- fixed potential segfault when calling `at_path()` with an empty string +- fixed UB in internal unicode machinery (#144) (@kchalmer) +- fixed a number of spurious warnings with Clang 10 (#145, #146) (@chronoxor) #### Additions: -- added `toml::array::for_each()` -- added `toml::table::for_each()` -- added config options `TOML_EXPORTED_CLASS`, `TOML_EXPORTED_MEMBER_FUNCTION`, `TOML_EXPORTED_STATIC_FUNCTION` & `TOML_EXPORTED_FREE_FUNCTION` -- added support for escape sequence `\e` when using `TOML_ENABLE_UNRELEASED_FEATURES` ([toml/790](https://github.com/toml-lang/toml/pull/790)) -- added support for more unicode in bare keys when using `TOML_ENABLE_UNRELEASED_FEATURES` ([toml/891](https://github.com/toml-lang/toml/pull/891)) +- added `toml::array::for_each()` +- added `toml::table::for_each()` +- added config options `TOML_EXPORTED_CLASS`, `TOML_EXPORTED_MEMBER_FUNCTION`, `TOML_EXPORTED_STATIC_FUNCTION` & `TOML_EXPORTED_FREE_FUNCTION` +- added support for escape sequence `\e` when using `TOML_ENABLE_UNRELEASED_FEATURES` ([toml/790](https://github.com/toml-lang/toml/pull/790)) +- added support for more unicode in bare keys when using `TOML_ENABLE_UNRELEASED_FEATURES` ([toml/891](https://github.com/toml-lang/toml/pull/891)) #### Removals/Deprecations: -- deprecated old `TOML_API` option in favour new `TOML_EXPORTED_X` options +- deprecated old `TOML_API` option in favour new `TOML_EXPORTED_X` options (it will continue to work as it did before if none of the new function export options are defined) #### Build system: -- meson: added `compile_library` option (@Tachi107) -- meson: added `ubsan_tests` and `ubsan_examples` options -- meson: use system dependencies where available when building tests (@Tachi107) +- meson: added `compile_library` option (@Tachi107) +- meson: added `ubsan_tests` and `ubsan_examples` options +- meson: use system dependencies where available when building tests (@Tachi107)

@@ -99,7 +110,7 @@ this release holds nothing of value over v3.0.0. #### Fixes: -- fixed erroneous use of `TOML_API` causing ODR issue (#136) (@Azarael) +- fixed erroneous use of `TOML_API` causing ODR issue (#136) (@Azarael)

@@ -112,90 +123,90 @@ Any changes that are likely to cause migration issues (API changes, build system #### Fixes: -- ⚠️ fixed `toml::table` init-list constructor requiring double-brackets -- ⚠️ fixed `TOML_API` + extern templates causing linker errors in some circumstances -- ⚠️ fixed incorrect `noexcept` specifications on many functions -- ⚠️ fixed missing `TOML_API` on some interfaces -- fixed `toml::json_formatter` not formatting inf and nan incorrectly -- fixed a number of spec conformance issues (#127, #128, #129, #130, #131, #132, #135) (@moorereason) -- fixed an illegal table redefinition edge case (#112) (@python36) -- fixed documentation issues -- fixed GCC bug causing memory leak during parse failures (#123, #124) (@rsmmr, @ronalabraham) -- fixed incorrect handling of vertical whitespace in keys when printing TOML to streams -- fixed incorrect source position in redefinition error messages -- fixed missing includes ``, `` -- fixed parser not correctly round-tripping the format of binary and octal integers in some cases -- fixed some incorrect unicode scalar sequence transformations (#125) -- fixed strong exception guarantee edge-cases in `toml::table` and `toml::array` +- ⚠️ fixed `toml::table` init-list constructor requiring double-brackets +- ⚠️ fixed `TOML_API` + extern templates causing linker errors in some circumstances +- ⚠️ fixed incorrect `noexcept` specifications on many functions +- ⚠️ fixed missing `TOML_API` on some interfaces +- fixed `toml::json_formatter` not formatting inf and nan incorrectly +- fixed a number of spec conformance issues (#127, #128, #129, #130, #131, #132, #135) (@moorereason) +- fixed an illegal table redefinition edge case (#112) (@python36) +- fixed documentation issues +- fixed GCC bug causing memory leak during parse failures (#123, #124) (@rsmmr, @ronalabraham) +- fixed incorrect handling of vertical whitespace in keys when printing TOML to streams +- fixed incorrect source position in redefinition error messages +- fixed missing includes ``, `` +- fixed parser not correctly round-tripping the format of binary and octal integers in some cases +- fixed some incorrect unicode scalar sequence transformations (#125) +- fixed strong exception guarantee edge-cases in `toml::table` and `toml::array` #### Additions: -- added value flags to array + table insert methods (#44) (@levicki) -- added support for Unicode 14.0 -- added support for ref categories and cv-qualifiers in `toml::node::ref()` -- added magic `toml::value_flags` constant `toml::preserve_source_value_flags` -- added clang's enum annotation attributes to all enums -- added `TOML_ENABLE_FORMATTERS` option -- added `toml::yaml_formatter` -- added `toml::value` copy+move constructor overloads with flags override -- added `toml::table::prune()` -- added `toml::table::lower_bound()` (same semantics as `std::map::lower_bound()`) -- added `toml::table::emplace_hint()` (same semantics as `std::map::emplace_hint()`) -- added `toml::table::at()` (same semantics as `std::map::at()`) -- added `toml::node_view::operator==` -- added `toml::key` - provides a facility to access the source_regions of parsed keys (#82) (@vaartis) -- added `toml::is_key<>` and `toml::is_key_or_convertible<>` metafunctions -- added `toml::format_flags::relaxed_float_precision` (#89) (@vaartis) -- added `toml::format_flags::quote_infinities_and_nans` -- added `toml::format_flags::indent_sub_tables` (#120) (@W4RH4WK) -- added `toml::format_flags::indent_array_elements` (#120) (@W4RH4WK) -- added `toml::format_flags::allow_unicode_strings` -- added `toml::format_flags::allow_real_tabs_in_strings` -- added `toml::format_flags::allow_octal_integers` -- added `toml::format_flags::allow_hexadecimal_integers` -- added `toml::format_flags::allow_binary_integers` -- added `toml::date_time` converting constructors from `toml::date` and `toml::time` -- added `toml::at_path()`, `toml::node::at_path()` and `toml::node_view::at_path()` for qualified path-based lookups (#118) (@ben-crowhurst) -- added `toml::array::resize()` param `default_init_flags` -- added `toml::array::replace()` (#109) (@LebJe) -- added `toml::array::prune()` -- added `toml::array::at()` (same semantics as `std::vector::at()`) -- added `parse_benchmark` example -- added `operator->` to `toml::value` for class types +- added value flags to array + table insert methods (#44) (@levicki) +- added support for Unicode 14.0 +- added support for ref categories and cv-qualifiers in `toml::node::ref()` +- added magic `toml::value_flags` constant `toml::preserve_source_value_flags` +- added clang's enum annotation attributes to all enums +- added `TOML_ENABLE_FORMATTERS` option +- added `toml::yaml_formatter` +- added `toml::value` copy+move constructor overloads with flags override +- added `toml::table::prune()` +- added `toml::table::lower_bound()` (same semantics as `std::map::lower_bound()`) +- added `toml::table::emplace_hint()` (same semantics as `std::map::emplace_hint()`) +- added `toml::table::at()` (same semantics as `std::map::at()`) +- added `toml::node_view::operator==` +- added `toml::key` - provides a facility to access the source_regions of parsed keys (#82) (@vaartis) +- added `toml::is_key<>` and `toml::is_key_or_convertible<>` metafunctions +- added `toml::format_flags::relaxed_float_precision` (#89) (@vaartis) +- added `toml::format_flags::quote_infinities_and_nans` +- added `toml::format_flags::indent_sub_tables` (#120) (@W4RH4WK) +- added `toml::format_flags::indent_array_elements` (#120) (@W4RH4WK) +- added `toml::format_flags::allow_unicode_strings` +- added `toml::format_flags::allow_real_tabs_in_strings` +- added `toml::format_flags::allow_octal_integers` +- added `toml::format_flags::allow_hexadecimal_integers` +- added `toml::format_flags::allow_binary_integers` +- added `toml::date_time` converting constructors from `toml::date` and `toml::time` +- added `toml::at_path()`, `toml::node::at_path()` and `toml::node_view::at_path()` for qualified path-based lookups (#118) (@ben-crowhurst) +- added `toml::array::resize()` param `default_init_flags` +- added `toml::array::replace()` (#109) (@LebJe) +- added `toml::array::prune()` +- added `toml::array::at()` (same semantics as `std::vector::at()`) +- added `parse_benchmark` example +- added `operator->` to `toml::value` for class types #### Changes: -- ⚠️ `toml::format_flags` is now backed by `uint64_t` (was previously `uint8_t`) -- ⚠️ `toml::source_index` is now an alias for `uint32_t` unconditionally (was previously dependent on `TOML_LARGE_FILES`) -- ⚠️ `toml::table` now uses `toml::key` as the key type (was previously `std::string`) -- ⚠️ `toml::value_flags` is now backed by `uint16_t` (was previously `uint8_t`) -- ⚠️ made all overloaded operators 'hidden friends' where possible -- ⚠️ renamed `toml::default_formatter` to `toml::toml_formatter` (`toml::default_formatter` is now an alias) -- ⚠️ renamed `TOML_PARSER` option to `TOML_ENABLE_PARSER` (`TOML_PARSER` will continue to work but is deprecated) -- ⚠️ renamed `TOML_UNRELEASED_FEATURES` to `TOML_ENABLE_UNRELEASED_FEATURES` (`TOML_UNRELEASED_FEATURES` will continue to work but is deprecated) -- ⚠️ renamed `TOML_WINDOWS_COMPAT` to `TOML_ENABLE_WINDOWS_COMPAT` (`TOML_WINDOWS_COMPAT` will continue to work but is deprecated) -- applied clang-format to all the things 🎉️ -- exposed `TOML_NAMESPACE_START` and `TOML_NAMESPACE_END` macros to help with ADL specialization scenarios -- improved performance of parser -- made date/time constructors accept any integral types -- moved all implementation headers to `/impl` -- renamed all implementation headers to `.h` and 'source' headers to `.inl` -- updated conformance tests +- ⚠️ `toml::format_flags` is now backed by `uint64_t` (was previously `uint8_t`) +- ⚠️ `toml::source_index` is now an alias for `uint32_t` unconditionally (was previously dependent on `TOML_LARGE_FILES`) +- ⚠️ `toml::table` now uses `toml::key` as the key type (was previously `std::string`) +- ⚠️ `toml::value_flags` is now backed by `uint16_t` (was previously `uint8_t`) +- ⚠️ made all overloaded operators 'hidden friends' where possible +- ⚠️ renamed `toml::default_formatter` to `toml::toml_formatter` (`toml::default_formatter` is now an alias) +- ⚠️ renamed `TOML_PARSER` option to `TOML_ENABLE_PARSER` (`TOML_PARSER` will continue to work but is deprecated) +- ⚠️ renamed `TOML_UNRELEASED_FEATURES` to `TOML_ENABLE_UNRELEASED_FEATURES` (`TOML_UNRELEASED_FEATURES` will continue to work but is deprecated) +- ⚠️ renamed `TOML_WINDOWS_COMPAT` to `TOML_ENABLE_WINDOWS_COMPAT` (`TOML_WINDOWS_COMPAT` will continue to work but is deprecated) +- applied clang-format to all the things 🎉️ +- exposed `TOML_NAMESPACE_START` and `TOML_NAMESPACE_END` macros to help with ADL specialization scenarios +- improved performance of parser +- made date/time constructors accept any integral types +- moved all implementation headers to `/impl` +- renamed all implementation headers to `.h` and 'source' headers to `.inl` +- updated conformance tests #### Removals: -- ⚠️ removed `toml::format_flags::allow_value_format_flags` -- ⚠️ removed `TOML_LARGE_FILES` (it is now default - explicitly setting `TOML_LARGE_FILES` to `0` will invoke an `#error`) -- ⚠️ removed unnecessary template machinery (esp. where ostreams were involved) -- removed unnecessary uses of `final` +- ⚠️ removed `toml::format_flags::allow_value_format_flags` +- ⚠️ removed `TOML_LARGE_FILES` (it is now default - explicitly setting `TOML_LARGE_FILES` to `0` will invoke an `#error`) +- ⚠️ removed unnecessary template machinery (esp. where ostreams were involved) +- removed unnecessary uses of `final` #### Build system: -- ⚠️ increased minimum required meson version to `0.54.0` -- disabled 'install' path when being used as a meson subproject (#114) (@Tachi107) -- fixed builds failing with meson 0.6.0 (#117) (@Tachi107) -- general meson improvements and fixes (#115) (@Tachi107) -- used `override_dependency` where supported (#116) (@Tachi107) +- ⚠️ increased minimum required meson version to `0.54.0` +- disabled 'install' path when being used as a meson subproject (#114) (@Tachi107) +- fixed builds failing with meson 0.6.0 (#117) (@Tachi107) +- general meson improvements and fixes (#115) (@Tachi107) +- used `override_dependency` where supported (#116) (@Tachi107)

@@ -205,23 +216,23 @@ Any changes that are likely to cause migration issues (API changes, build system #### 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) +- 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` +- 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 +- improved debug code size by removing unnecessary std::forwards and std::moves +- modernized the CMake build files (#102, #103, #105) (@friendlyanon) +- updated conformance tests

@@ -231,30 +242,30 @@ Any changes that are likely to cause migration issues (API changes, build system #### 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 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 +- 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 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) +- added proper cmake support (#85) (@ClausKlein) +- added cmake FetchContent information to documentation (#101) (@proydakov) #### Removals: -- removed explicit `#include ` requirement for `parse_file()` +- removed explicit `#include ` requirement for `parse_file()`

@@ -264,16 +275,16 @@ Any changes that are likely to cause migration issues (API changes, build system #### Fixes: -- fixed compiler errors caused by `` 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 `` 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) +- fixed compiler errors caused by `` 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 `` 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)

@@ -283,31 +294,31 @@ Any changes that are likely to cause migration issues (API changes, build system #### Fixes: -- fixed some issues building with VS2017 (#55) (@sobczyk) -- fixed `_Float16` erroneously detected as supported on g++ (#57) (@sobczyk) -- fixed `` 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) +- fixed some issues building with VS2017 (#55) (@sobczyk) +- fixed `_Float16` erroneously detected as supported on g++ (#57) (@sobczyk) +- fixed `` 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) +- 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) +- 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 +- 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

@@ -317,29 +328,29 @@ Any changes that are likely to cause migration issues (API changes, build system #### 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 +- 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) +- 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 +- renamed `TOML_ALL_INLINE` to `TOML_HEADER_ONLY` (the old name will still work, but is no longer documented) +- general cleanup

@@ -352,43 +363,43 @@ break (hence the version number bump). Changes that might block a migration are #### 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` +- 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` 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` +- 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` 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: -- ⚠️ deprecated `parse_result::get()` in favour of `parse_result::table()` -- ⚠️ deprecated `node_view::get()` in favour of `node_view::node()` -- ⚠️ simplified internal ABI namespaces -- improved the quality of many static_assert error messages +- ⚠️ deprecated `parse_result::get()` in favour of `parse_result::table()` +- ⚠️ deprecated `node_view::get()` in favour of `node_view::node()` +- ⚠️ simplified internal ABI namespaces +- improved the quality of many static_assert error messages #### Removals: -- ⚠️ renamed `date_time::time_offset` to just 'offset' -- ⚠️ removed `TOML_CHAR_8_STRINGS` since it no longer makes sense +- ⚠️ renamed `date_time::time_offset` to just 'offset' +- ⚠️ removed `TOML_CHAR_8_STRINGS` since it no longer makes sense

@@ -398,22 +409,22 @@ break (hence the version number bump). Changes that might block a migration are #### 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 +- 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 +- 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 +- refactored the parser to reduce binary size

@@ -423,15 +434,15 @@ break (hence the version number bump). Changes that might block a migration are #### 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 +- 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 +- improved the performance of toml::parse_file +- improved the performance of printing to streams for deepy-nested TOML data

@@ -441,21 +452,21 @@ break (hence the version number bump). Changes that might block a migration are #### 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 +- 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 +- 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 +- renamed table iterator proxy pair members to `first` and `second` to match STL

@@ -465,21 +476,21 @@ break (hence the version number bump). Changes that might block a migration are #### 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) +- 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 +- added additional error message cases to the parser +- added `error_printer` example +- added `toml_generator` example #### Changes: -- improved unicode-related codegen +- improved unicode-related codegen

@@ -489,23 +500,23 @@ break (hence the version number bump). Changes that might block a migration are #### 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) +- 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 +- 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 +- split some header files up to make future maintenance easier +- refactored and greatly simplified parser

@@ -515,18 +526,18 @@ break (hence the version number bump). Changes that might block a migration are #### 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 +- 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 `` -- added cmake package config generator (#22) (@GiulioRomualdi) -- added build config feature option `GENERATE_CMAKE_CONFIG` -- added many new tests +- added support for implementations without `` +- added cmake package config generator (#22) (@GiulioRomualdi) +- added build config feature option `GENERATE_CMAKE_CONFIG` +- added many new tests

@@ -536,18 +547,18 @@ break (hence the version number bump). Changes that might block a migration are #### Fixes: -- fixed some parser error paths not returning early enough `TOML_EXCEPTIONS=0` -- fixed a number of minor documentation issues +- 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 +- 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

@@ -557,11 +568,11 @@ break (hence the version number bump). Changes that might block a migration are #### Fixes: -- fixed minor documentation issues +- fixed minor documentation issues #### Changes: -- refactoring of ABI-based inline namespaces +- refactoring of ABI-based inline namespaces

@@ -571,13 +582,13 @@ break (hence the version number bump). Changes that might block a migration are #### Fixes: -- fixed minor preprocessor/macro issues -- fixed minor documentation issues +- fixed minor preprocessor/macro issues +- fixed minor documentation issues #### Additions: -- added `` include directly in 'debug' builds when `TOML_ASSERT` isn't defined -- added Clang's `[[trivial_abi]]` attribute to `date`, `time`, `time_offset` +- added `` include directly in 'debug' builds when `TOML_ASSERT` isn't defined +- added Clang's `[[trivial_abi]]` attribute to `date`, `time`, `time_offset`

@@ -587,19 +598,19 @@ break (hence the version number bump). Changes that might block a migration are #### 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 +- 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 +- 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

@@ -609,15 +620,15 @@ break (hence the version number bump). Changes that might block a migration are #### Fixes: -- fixed ICE in VS2019 when using `/std:c++17` instead of `/std:c++latest` +- 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 +- added `#error` when `TOML_EXCEPTIONS` is set to `1` but compiler exceptions were disabled #### Changes: -- parsing performance improvements +- parsing performance improvements

@@ -627,15 +638,15 @@ break (hence the version number bump). Changes that might block a migration are #### Fixes: -- fixed `parse_file()` failing to compile with plain string literals -- fixed tests being built when used as a meson subproject (#14) (@shdnx) +- 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()` +- 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()`

@@ -645,20 +656,20 @@ break (hence the version number bump). Changes that might block a migration are #### Fixes: -- fixed some pedantic clang warnings -- fixed some minor documentation errors +- 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 +- 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: -- removed `` dependency +- removed `` dependency

@@ -668,16 +679,16 @@ break (hence the version number bump). Changes that might block a migration are #### Fixes: -- fixed minor printing bug in `operator<<(ostream, source_position)` -- fixed minor documentation issues +- fixed minor printing bug in `operator<<(ostream, source_position)` +- fixed minor documentation issues #### Additions: -- added `operator<<(ostream&, parse_error)` +- added `operator<<(ostream&, parse_error)` #### Changes: -- improved quality of error messages for boolean and inf/nan parsing +- improved quality of error messages for boolean and inf/nan parsing

@@ -687,18 +698,18 @@ break (hence the version number bump). Changes that might block a migration are #### 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 +- 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 `` ones) +- 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 `` ones)

@@ -706,4 +717,4 @@ break (hence the version number bump). Changes that might block a migration are [Released](https://github.com/marzer/tomlplusplus/releases/tag/v0.1.0) 2020-02-20 -- First public release, yay! 🎉️ +- First public release, yay! 🎉️ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 07a10a47..f1170164 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,13 +3,13 @@ Contributions are very welcome! Either by [reporting issues] or submitting pull requests. If you wish to submit a PR, please be aware that: -- The single-header file `toml.hpp` is generated by a script; make your changes in the files in +- The single-header file `toml.hpp` is generated by a script; make your changes in the files in `include`, **not** in `toml.hpp`. -- Your changes should compile warning-free on at least one of: - - GCC 8 or higher - - Clang 8 or higher - - MSVC 19.2X (Visual Studio 2019) or higher -- You should regenerate the single-header file as part of your PR (a CI check will fail if you don't). +- Your changes should compile warning-free on at least one of: + - GCC 8 or higher + - Clang 8 or higher + - MSVC 19.2X (Visual Studio 2019) or higher +- You should regenerate the single-header file as part of your PR (a CI check will fail if you don't).
@@ -17,7 +17,7 @@ If you wish to submit a PR, please be aware that: 1. Make your changes as necessary - If you've added a new header file that isn't going to be transitively included by one of the - others, add an include directive to `include/toml++/toml.h` + others, add an include directive to `include/toml++/toml.h` 2. Install the prerequisite python packages: `pip3 install -r tools/requirements.txt` 3. Run `tools/generate_single_header.py` @@ -52,24 +52,17 @@ sudo locale-gen 'en_US.utf8' \ 'zh_CN.utf8' # create the build configs (first time only) -CXX=g++ meson build-gcc-debug --buildtype=debug -Dpedantic=true -Dbuild_tests=true -Dgenerate_cmake_config=false -CXX=clang++ meson build-clang-debug --buildtype=debug -Dpedantic=true -Dbuild_tests=true -Dgenerate_cmake_config=false -CXX=g++ meson build-gcc-release --buildtype=release -Dpedantic=true -Dbuild_tests=true -Dgenerate_cmake_config=false -CXX=clang++ meson build-clang-release --buildtype=release -Dpedantic=true -Dbuild_tests=true -Dgenerate_cmake_config=false +meson setup build-debug --buildtype=debug -Ddevel=true +meson setup build-release --buildtype=release -Ddevel=true # run the tests -cd build-gcc-debug && ninja && ninja test \ - && cd ../build-clang-debug && ninja && ninja test \ - && cd ../build-gcc-release && ninja && ninja test \ - && cd ../build-clang-release && ninja && ninja test \ +cd build-debug && ninja && ninja test \ + && cd ../build-release && ninja && ninja test \ && cd .. ``` -> ℹ️ To ensure parity between single-header and regular versions of the library, 50% of the tests -will be compiled using one, and 50% with the other. Ensure you've regenerated toml.hpp before running tests. - > ℹ️ Pass `-Duse_vendored_libs=false` to Meson if you wish to use the system-installed version -of Catch2 rather than the vendored one. +> of Catch2 rather than the vendored one.
@@ -80,9 +73,9 @@ instructions at [toml-test/README](./toml-test/README.md). Note that the toml++ offical suite via a C++ code-generation script so you are not expected to take this extra step as part of contributing to the library. -[Visual Studio]: https://visualstudio.microsoft.com/vs/ -[Test Adapter for Catch2]: https://marketplace.visualstudio.com/items?itemName=JohnnyHendriks.ext01 +[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 +[catch2]: https://github.com/catchorg/Catch2 [toml-test]: https://github.com/BurntSushi/toml-test -[BurntSushi/toml-test]: https://github.com/BurntSushi/toml-test +[burntsushi/toml-test]: https://github.com/BurntSushi/toml-test diff --git a/examples/meson.build b/examples/meson.build index 8795efec..366f37c7 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -1,21 +1,10 @@ +# This file is a part of toml++ and is subject to the the terms of the MIT license. +# Copyright (c) Mark Gillard +# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. +# SPDX-License-Identifier: MIT + example_args = [] -example_args += universal_args -example_args += devel_args -example_overrides = [] -example_overrides += overrides -if is_gcc or is_clang - example_args += [ '-Wno-switch', '-Wno-switch-default', '-Wno-switch-enum' ] -endif -if is_clang and (get_option('asan_examples') or get_option('ubsan_examples')) - example_args += [ '-g3' ] - if get_option('asan_examples') and get_option('ubsan_examples') - example_overrides += 'b_sanitize=address,undefined' - elif get_option('asan_examples') - example_overrides += 'b_sanitize=address' - else - example_overrides += 'b_sanitize=undefined' - endif -endif +example_args += global_args examples = [ 'simple_parser', @@ -32,27 +21,10 @@ foreach example : examples example, executable( example, - [ example+'.cpp' ], + [ example + '.cpp' ], cpp_args: example_args, dependencies: tomlplusplus_dep, - override_options: example_overrides + override_options: global_overrides ) ]] endforeach - -if is_clang and (get_option('asan_examples') or get_option('ubsan_examples')) - foreach executable : example_executables - - # skip the transcoder (it waits on stdin) and the benchmark (might be slow and cause CI to fail) - if executable[0].contains('transcoder') or executable[0].contains('benchmark') - continue - endif - - test( - executable[0], # name - executable[1], # executable object - workdir: meson.source_root()/'examples' - ) - - endforeach -endif diff --git a/include/meson.build b/include/meson.build index 1bfc6243..206dc6f5 100644 --- a/include/meson.build +++ b/include/meson.build @@ -1,39 +1,52 @@ -# Header-only +# This file is a part of toml++ and is subject to the the terms of the MIT license. +# Copyright (c) Mark Gillard +# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. +# SPDX-License-Identifier: MIT -tomlplusplus_dep = declare_dependency(include_directories: include_dir) +include_dir = include_directories('.') if not is_subproject - import('pkgconfig').generate( - name: meson.project_name(), - description: 'Header-only TOML config file parser and serializer for C++', - install_dir: get_option('datadir')/'pkgconfig', - url: 'https://marzer.github.io/tomlplusplus' - ) + install_subdir('toml++', install_dir: get_option('includedir')) endif -# cmake -if get_option('generate_cmake_config') and not is_subproject - cmake = import('cmake') - # Can't use until Meson 0.62.0, see https://github.com/mesonbuild/meson/pull/9916 - # and https://github.com/marzer/tomlplusplus/issues/140 - #cmake.write_basic_package_version_file( - # name: meson.project_name(), - # version: meson.project_version(), - # install_dir: get_option('datadir')/'cmake'/meson.project_name(), - # arch_independent: true - #) - # In the meantime, install a pre-generated Package Version file - configure_file( - configuration: {'version': meson.project_version()}, - input: '..'/'cmake'/'tomlplusplusConfigVersion.cmake.meson.in', - output: 'tomlplusplusConfigVersion.cmake', - install_dir: get_option('datadir')/'cmake'/meson.project_name() - ) - - cmake.configure_package_config_file( - name: meson.project_name(), - input: '..'/'cmake'/'tomlplusplusConfig.cmake.meson.in', - configuration: configuration_data({'includedir': get_option('includedir')}), - install_dir: get_option('datadir')/'cmake'/meson.project_name(), - ) +if not build_lib # header-only mode + + tomlplusplus_dep = declare_dependency(include_directories: include_dir) + + if not is_subproject + import('pkgconfig').generate( + name: meson.project_name(), + description: 'Header-only TOML config file parser and serializer for C++', + install_dir: get_option('datadir')/'pkgconfig', + url: 'https://marzer.github.io/tomlplusplus' + ) + endif + + # cmake + if get_option('generate_cmake_config') and not is_subproject and not is_devel + cmake = import('cmake') + # Can't use until Meson 0.62.0, see https://github.com/mesonbuild/meson/pull/9916 + # and https://github.com/marzer/tomlplusplus/issues/140 + #cmake.write_basic_package_version_file( + # name: meson.project_name(), + # version: meson.project_version(), + # install_dir: get_option('datadir')/'cmake'/meson.project_name(), + # arch_independent: true + #) + # In the meantime, install a pre-generated Package Version file + configure_file( + configuration: {'version': meson.project_version()}, + input: '..'/'cmake'/'tomlplusplusConfigVersion.cmake.meson.in', + output: 'tomlplusplusConfigVersion.cmake', + install_dir: get_option('datadir')/'cmake'/meson.project_name() + ) + + cmake.configure_package_config_file( + name: meson.project_name(), + input: '..'/'cmake'/'tomlplusplusConfig.cmake.meson.in', + configuration: configuration_data({'includedir': get_option('includedir')}), + install_dir: get_option('datadir')/'cmake'/meson.project_name(), + ) + endif + endif diff --git a/include/toml++/impl/preprocessor.h b/include/toml++/impl/preprocessor.h index 7305218c..890e3db7 100644 --- a/include/toml++/impl/preprocessor.h +++ b/include/toml++/impl/preprocessor.h @@ -1055,71 +1055,6 @@ TOML_ENABLE_WARNINGS; //# FLOAT16 //#===================================================================================================================== -#ifndef TOML_ENABLE_FLOAT16 - -#ifdef __FLT16_MANT_DIG__ -#define TOML_FLOAT16_MANT_DIG __FLT16_MANT_DIG__ -#define TOML_FLOAT16_DIG __FLT16_DIG__ -#define TOML_FLOAT16_MIN_EXP __FLT16_MIN_EXP__ -#define TOML_FLOAT16_MIN_10_EXP __FLT16_MIN_10_EXP__ -#define TOML_FLOAT16_MAX_EXP __FLT16_MAX_EXP__ -#define TOML_FLOAT16_MAX_10_EXP __FLT16_MAX_10_EXP__ -#else -#define TOML_FLOAT16_MANT_DIG 0 -#define TOML_FLOAT16_DIG 0 -#define TOML_FLOAT16_MIN_EXP 0 -#define TOML_FLOAT16_MIN_10_EXP 0 -#define TOML_FLOAT16_MAX_EXP 0 -#define TOML_FLOAT16_MAX_10_EXP 0 -#endif - -#if (TOML_FLOAT16_MANT_DIG && TOML_FLOAT16_DIG && TOML_FLOAT16_MIN_EXP && TOML_FLOAT16_MIN_10_EXP \ - && TOML_FLOAT16_MAX_EXP && TOML_FLOAT16_MAX_10_EXP) -#define TOML_FLOAT16_LIMITS_SET 1 -#else -#define TOML_FLOAT16_LIMITS_SET 0 -#endif - -#if TOML_FLOAT16_LIMITS_SET - -#if TOML_CLANG // >= 15 -//# {{ -// Excerpt from https://clang.llvm.org/docs/LanguageExtensions.html: -// -// _Float16 is currently only supported on the following targets, -// with further targets pending ABI standardization: -// -// 32-bit ARM -// 64-bit ARM (AArch64) -// AMDGPU -// SPIR -// X86 as long as SSE2 is available -// -//# }} -#if (TOML_ARCH_ARM || TOML_ARCH_AMD64 || TOML_ARCH_X86) -#define TOML_ENABLE_FLOAT16 1 -#endif - -#elif TOML_GCC -//# {{ -// Excerpt from https://gcc.gnu.org/onlinedocs/gcc/Floating-Types.html: -// -// The _Float16 type is supported on AArch64 systems by default, on ARM systems when the IEEE format for -// 16-bit floating-point types is selected with -mfp16-format=ieee and, -// for both C and C++, on x86 systems with SSE2 enabled. -// -// *** except: the bit about x86 seems incorrect?? *** -//# }} -#if (TOML_ARCH_ARM || TOML_ARCH_AMD64 /* || TOML_ARCH_X86*/) -#define TOML_ENABLE_FLOAT16 1 -#endif - -#endif // clang/gcc - -#endif // TOML_FLOAT16_LIMITS_SET - -#endif // !defined(TOML_ENABLE_FLOAT16) - #ifndef TOML_ENABLE_FLOAT16 #define TOML_ENABLE_FLOAT16 0 #endif diff --git a/meson.build b/meson.build index 3dd9735a..b92815b9 100644 --- a/meson.build +++ b/meson.build @@ -1,27 +1,30 @@ +# This file is a part of toml++ and is subject to the the terms of the MIT license. +# Copyright (c) Mark Gillard +# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. +# SPDX-License-Identifier: MIT + project( 'tomlplusplus', 'cpp', - version: '3.2.0', - meson_version: '>=0.54.0', license: 'MIT', - default_options: [ # https://mesonbuild.com/Builtin-options.html + version: '3.2.0', + meson_version: '>=0.61.0', + default_options: [ + # https://mesonbuild.com/Builtin-options.html # core options 'buildtype=release', - 'warning_level=3', - 'werror=true', - + 'default_library=shared', # base options - 'b_lto=true', + 'b_lto=false', 'b_ndebug=if-release', - # compiler options 'cpp_std=c++17' ] ) -####################################################################################################################### -# compiler management -####################################################################################################################### +#----------------------------------------------------------------------------------------------------------------------- +# global vars + imports +#----------------------------------------------------------------------------------------------------------------------- compiler = meson.get_compiler('cpp') message('target cpu_family: @0@'.format(host_machine.cpu_family())) @@ -29,407 +32,181 @@ message('target cpu: @0@'.format(host_machine.cpu())) message('target system: @0@'.format(host_machine.system())) message('target endian: @0@'.format(host_machine.endian())) -is_gcc = compiler.get_id() == 'gcc' -is_clang = compiler.get_id() == 'clang' -is_msvc = compiler.get_id() == 'msvc' -is_icc_cl = compiler.get_id() == 'intel-cl' -is_icc = is_icc_cl or compiler.get_id() == 'intel' -is_lld = compiler.get_linker_id() == 'ld.lld' +is_devel = get_option('devel') is_debug = get_option('debug') is_release = not is_debug -is_pedantic = get_option('pedantic') +is_pedantic = get_option('pedantic') or is_devel is_windows = host_machine.system() == 'windows' is_x64 = host_machine.cpu_family() == 'x86_64' is_subproject = meson.is_subproject() -has_exceptions = get_option('cpp_eh') != 'none' -include_dir = include_directories('include') -overrides = [] -universal_args = [] # args used in tests, examples, lib, everything -devel_args = [] # args used in everything *but* the lib - -message('is_release: @0@'.format(is_release)) -message('is_windows: @0@'.format(is_windows)) -message('is_x64: @0@'.format(is_x64)) -message('has_exceptions: @0@'.format(has_exceptions)) - -# compiler argument references: -# msvc: https://docs.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-alphabetically?view=vs-2019 -# intel and intel-cl: https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-oneapi-dev-guide-and-reference/top/compiler-reference/compiler-options/alphabetical-list-of-compiler-options.html -# gcc: -# clang: - -# GCC or Clang -if is_gcc or is_clang - devel_args += '-march=native' -endif - -# GCC -if is_gcc - universal_args += [ - '-fmax-errors=5', - '-Wno-init-list-lifetime', - ] - if is_pedantic - universal_args += [ - '-Wcast-align', - '-Wcast-qual', - '-Wctor-dtor-privacy', - '-Wdisabled-optimization', - '-Wfloat-equal', - '-Wimport', - '-Winit-self', - '-Wlogical-op', - '-Wmissing-declarations', - '-Wmissing-field-initializers', - '-Wmissing-format-attribute', - '-Wmissing-include-dirs', - '-Wmissing-noreturn', - '-Wold-style-cast', - '-Woverloaded-virtual', - '-Wpacked', - '-Wpadded', - '-Wpointer-arith', - '-Wredundant-decls', - '-Wshadow', - '-Wsign-conversion', - '-Wsign-promo', - '-Wstack-protector', - '-Wstrict-null-sentinel', - '-Wswitch-default', - '-Wswitch-enum', - '-Wundef', - '-Wunreachable-code', - '-Wunused', - '-Wunused-parameter', - '-Wuseless-cast', - '-Wvariadic-macros', - '-Wwrite-strings', - '-Wmissing-noreturn', - ] - endif - if is_release and is_pedantic - universal_args += [ - '-Wsuggest-attribute=const', - '-Wsuggest-attribute=pure', - ] - endif -endif -# Clang -if is_clang - if is_pedantic - universal_args += '-Weverything' - endif - universal_args += [ - '-ferror-limit=5', - '-Wno-unused-command-line-argument', - - # flags from here down are disabling stupidly pedantic warnings that only appear with -Weverything - '-Wno-c++98-compat', - '-Wno-c++98-compat-pedantic', - '-Wno-documentation', - '-Wno-documentation-unknown-command', - '-Wno-switch-enum', - '-Wno-covered-switch-default', - ] - if get_option('time_trace') - universal_args += ['-ftime-trace'] - endif -endif +cpp = meson.get_compiler('cpp') +is_gcc = cpp.get_id() == 'gcc' +is_clang = cpp.get_id() == 'clang' +is_msvc = cpp.get_id() == 'msvc' +is_icc_cl = cpp.get_id() == 'intel-cl' +is_icc = is_icc_cl or cpp.get_id() == 'intel' +is_lld = cpp.get_linker_id() == 'ld.lld' +has_exceptions = get_option('cpp_eh') != 'none' -# MSVC or icc-cl -if is_msvc or is_icc_cl - universal_args += [ - '/bigobj', - '/fp:except-', # disable floating-point exceptions - '/Gy', # function-level linking - '/GF', # string pooling - '/openmp-', - '/permissive-', - '/utf-8', - '/Zc:inline' - ] - if has_exceptions - universal_args += '/Zc:throwingNew' - endif +build_tests = (get_option('build_tests') or is_devel) and not is_subproject +build_examples = (get_option('build_examples') or is_devel) and not is_subproject +build_tt = (get_option('build_tt') or is_devel) and not is_subproject +build_lib = get_option('build_lib') or get_option('compile_library') or build_tests or build_examples or build_tt + +#----------------------------------------------------------------------------------------------------------------------- +# global_args +# +# these are the arguments common to everything in the project +# *** they are not forwarded to dependents when using this as a submodule. *** +#----------------------------------------------------------------------------------------------------------------------- + +global_args = cpp.get_supported_arguments( + # clang/gcc + '-ferror-limit=5', + '-fmax-errors=5', + '-Wno-unused-command-line-argument', + '-Wno-reserved-macro-identifier', + '-Wno-init-list-lifetime', + '-fchar8_t', + # msvc + '/bigobj', + '/Gy', # function-level linking + '/GF', # string pooling + '/openmp-', + '/permissive-', + '/utf-8', + '/volatile:iso', + '/Zc:__cplusplus', + '/Zc:inline', + '/Zc:externConstexpr', + '/Zc:preprocessor' +) +if has_exceptions + global_args += cpp.get_supported_arguments('/Zc:throwingNew', '-D_HAS_EXCEPTIONS=1') +else + global_args += cpp.get_supported_arguments('-D_HAS_EXCEPTIONS=0') +endif +if is_pedantic + global_args += cpp.get_supported_arguments( + # clang + '-Weverything', + # gcc + '-Wcast-align', + '-Wcast-qual', + '-Wctor-dtor-privacy', + '-Wdisabled-optimization', + '-Wfloat-equal', + '-Wimport', + '-Winit-self', + '-Wlogical-op', + '-Wmissing-declarations', + '-Wmissing-field-initializers', + '-Wmissing-format-attribute', + '-Wmissing-include-dirs', + '-Wmissing-noreturn', + '-Wold-style-cast', + '-Woverloaded-virtual', + '-Wpacked', + '-Wpadded', + '-Wpointer-arith', + '-Wredundant-decls', + '-Wshadow', + '-Wsign-conversion', + '-Wsign-promo', + '-Wstack-protector', + '-Wstrict-null-sentinel', + '-Wswitch-default', + '-Wswitch-enum', + '-Wundef', + '-Wunreachable-code', + '-Wunused', + '-Wunused-parameter', + '-Wuseless-cast', + '-Wvariadic-macros', + '-Wwrite-strings', + '-Wmissing-noreturn', + # msvc + '/Wall' + ) if is_release - universal_args += [ - '/GL', # whole program optimization - '/Gw', # Optimize Global Data - '/Ob3', # aggressive inlining - '/Oy', # omit frame pointers - '/Oi', # generate intrinsics - ] - add_project_link_arguments('/ltcg', language: 'cpp') - endif - if is_pedantic - universal_args += '/W4' + global_args += cpp.get_supported_arguments( + '-Wsuggest-attribute=const', + '-Wsuggest-attribute=pure' + ) endif endif - -# icc-cl -if is_icc_cl - universal_args += [ - '/wd82', # storage class is not first - '/wd177', # unreferenced var - '/wd280', # selector expression is constant (why the fuck is that a warning?) - '/wd411', # class provides no constructor (duh, it's an aggregate) - '/wd869', # parameter "blah" was never referenced - '/wd1011', # missing return statement (false negative) - '/wd1628', # function marked [[noreturn]] returns (false positive) - '/wd2261', # assume with side effects discarded - '/wd2557', # mismatched sign compare - '/wd3280', # declaration hides member (triggered in Catch2) - ] -endif - -# icc (any) -if is_icc - universal_args += [ - '/Qdiag-error-limit:5', - '/Qoption,cpp,--unicode_source_kind,UTF-8', - '/D__builtin_bit_cast(T, v)=([&]()noexcept{ T val; memcpy(&val, &v, sizeof(T)); return val; })()', # __builtin_bit_cast workaround - ] -endif - -# windows stuff -if is_windows - universal_args += has_exceptions ? '-D_HAS_EXCEPTIONS=1' : '-D_HAS_EXCEPTIONS=0' -elif is_release - overrides += 'strip=true' -endif - -# LTO -if is_lld or is_debug or (is_windows and is_clang) - overrides += 'b_lto=false' -endif - -####################################################################################################################### -# c++ 20 check -####################################################################################################################### - -compiler_supports_cpp20_args = [] -if is_gcc or is_clang - compiler_supports_cpp20_args += '-std=c++2a' -elif is_icc - compiler_supports_cpp20_args += '/Qstd=c++2a' -elif is_msvc - compiler_supports_cpp20_args += '/std:c++latest' -endif -compiler_supports_cpp20 = compiler_supports_cpp20_args.length() > 0 and compiler.links(''' - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - - int main() - { - std::string s = "kek"; - std::cout << s << std::endl; - return 0; - } - ''', - name: 'supports c++20', - args: compiler_supports_cpp20_args +global_args += cpp.get_supported_arguments( + '-Wno-c++98-compat', + '-Wno-c++98-compat-pedantic', + '-Wno-documentation', + '-Wno-documentation-unknown-command', + '-Wno-switch-enum', + '-Wno-covered-switch-default' ) - -####################################################################################################################### -# char8_t check -####################################################################################################################### - -compiler_supports_char8_args = [] -if is_gcc or is_clang - compiler_supports_char8_args += '-fchar8_t' +if get_option('time_trace') + global_args += cpp.get_supported_arguments('-ftime-trace') endif -compiler_supports_char8 = compiler_supports_cpp20 and compiler.links(''' - #include - #include - #include - #include - using namespace std::string_view_literals; - - #if !defined(__cpp_char8_t) || __cpp_char8_t < 201811 || !defined(__cpp_lib_char8_t) || __cpp_lib_char8_t < 201907 - #error oh noes - #endif - - static_assert(!std::is_same_v); - static_assert(!std::is_same_v); - - std::u8string func() - { - return std::u8string{ u8"this is a test."sv }; - } - - int main() - { - return 0; - } - ''', - name: 'supports char8_t', - args: [ compiler_supports_cpp20_args, compiler_supports_char8_args ] -) - -####################################################################################################################### -# consteval check -# (this doesn't inform the build in any way; it's just so i can see who supports it properly) -####################################################################################################################### - -compiler_supports_consteval = compiler_supports_cpp20 and compiler.compiles(''' - - consteval int test() noexcept - { - return 42; - } - - int main() - { - constexpr auto val = test(); // test() should be compiletime-callable - return val; - } - ''', - name: 'supports consteval keyword', - args: compiler_supports_cpp20_args -) - -compiler_supports_consteval_properly = compiler_supports_consteval and not compiler.compiles(''' - consteval int test(int i) noexcept - { - return 42 + i; - } +#----------------------------------------------------------------------------------------------------------------------- +# global_link_args +# +# these are the linker arguments common to everything in the projectwhen compiling shared libraries and executables. +# *** they are not forwarded to dependents when using this as a submodule. *** +#----------------------------------------------------------------------------------------------------------------------- - int get_value() noexcept; +global_link_args = [] - int main() - { - return test(get_value()); // test() should not be runtime-callable - } - ''', - name: 'consteval is just renamed constexpr', - args: compiler_supports_cpp20_args -) - -####################################################################################################################### -# _Float16 checks -####################################################################################################################### - -compiler_supports_float16_args = compiler.get_supported_arguments('-mfp16-format=ieee') -compiler_supports_float16 = get_option('float16') and compiler.links(''' - int main() - { - static_assert(sizeof(_Float16) == 2); - _Float16 f = static_cast<_Float16>(1); - const auto f2 = static_cast(f); - const auto f3 = static_cast<_Float16>(0.2L); - return 0; - } - ''', - name: 'supports _Float16', - args: compiler_supports_float16_args -) -if compiler_supports_float16 - devel_args += compiler_supports_float16_args +if is_release + global_link_args += cpp.get_supported_link_arguments( + # msvc + '/OPT:REF,ICF=3', + '/INCREMENTAL:NO', + ) endif -####################################################################################################################### -# int128 check -####################################################################################################################### - -compiler_supports_int128 = compiler.links(''' - #ifndef __SIZEOF_INT128__ - #error __SIZEOF_INT128__ wasn't defined! - #endif +#----------------------------------------------------------------------------------------------------------------------- +# global_overrides +# +# these are the meson overrides common to everything in the project +# *** they are not forwarded to dependents when using this as a submodule. *** +#----------------------------------------------------------------------------------------------------------------------- - #include - - int main() - { - static_assert(__SIZEOF_INT128__ == 16); - static_assert(sizeof(__int128_t) == 16); - static_assert(sizeof(__uint128_t) == 16); - __int128_t i = static_cast<__int128_t>(1); - const auto i2 = static_cast(i); - const auto i3 = static_cast(i); - return 0; - } - ''', - name: 'supports __int128_t' -) - -####################################################################################################################### -# float128 check -####################################################################################################################### - -compiler_supports_float128 = compiler.links(''' - #ifndef __SIZEOF_FLOAT128__ - #error __SIZEOF_FLOAT128__ wasn't defined! - #endif - #ifndef __FLT128_MANT_DIG__ - #error __FLT128_MANT_DIG__ wasn't defined! - #endif - #ifndef __LDBL_MANT_DIG__ - #error __LDBL_MANT_DIG__ wasn't defined! - #endif - #if __FLT128_MANT_DIG__ <= __LDBL_MANT_DIG__ - #error __FLT128_MANT_DIG__ was <= __LDBL_MANT_DIG__ - #endif - int main() - { - static_assert(__SIZEOF_FLOAT128__ == 16); - static_assert(sizeof(__float128) == 16); - __float128 f = static_cast<__float128>(1); - const auto f2 = static_cast(f); - const auto f3 = static_cast(f); - return 0; - } - ''', - name: 'supports __float128' -) - -if compiler_supports_float16 or compiler_supports_float128 or compiler_supports_int128 - devel_args += compiler.get_supported_arguments('-fext-numeric-literals') +global_overrides = [ ] +if is_pedantic + global_overrides += [ + 'warning_level=3', + 'werror=true', + ] endif -####################################################################################################################### -# subdirectories -####################################################################################################################### +#----------------------------------------------------------------------------------------------------------------------- +# subdirectories + files +#----------------------------------------------------------------------------------------------------------------------- + +public_headers = [] +internal_headers = [] # Empty dependency that will be filled either in src/ or include/ tomlplusplus_dep = dependency('', required: false) -if get_option('compile_library') +subdir('include') + +if build_lib subdir('src') -else - subdir('include') endif -build_tests = get_option('build_tests') and not is_subproject if build_tests subdir('tests') endif -build_examples = get_option('build_examples') and not is_subproject if build_examples subdir('examples') endif -build_tt = (get_option('build_tt_encoder') or get_option('build_tt_encoder')) and not is_subproject if build_tt subdir('toml-test') endif -if not is_subproject - install_subdir('include'/'toml++', install_dir: get_option('includedir')) -endif - # Allow subproject usage meson.override_dependency(meson.project_name(), tomlplusplus_dep) diff --git a/meson_options.txt b/meson_options.txt index 13c9a454..59c1b92a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,14 +1,13 @@ -option('build_tests', type: 'boolean', value: false, description: 'Build tests (default: false - no effect when included as a subproject)') -option('build_examples', type: 'boolean', value: false, description: 'Build examples (default: false - no effect when included as a subproject)') -option('generate_cmake_config', type: 'boolean', value: true, description: 'Generate a cmake package config file (default: true - no effect when included as a subproject)') -option('pedantic', type: 'boolean', value: false, description: 'Enable as many compiler warnings as possible (default: false)') +option('devel', type: 'boolean', value: false, description: 'Tell meson whether or not it is a development build. (default: false)') +option('build_lib', type: 'boolean', value: false, description: 'Compile the library, rather than consuming it in header-only mode. (default: false) (implied by devel)') +option('build_examples', type: 'boolean', value: false, description: 'Build the examples (default: false) (implied by devel)') +option('build_tests', type: 'boolean', value: false, description: 'Build tests (default: false) (implied by devel)') +option('build_tt', type: 'boolean', value: false, description: 'Enable to build the toml-test encoder and decoder. (default: false) (implied by devel)') +option('pedantic', type: 'boolean', value: false, description: 'Enable as many compiler warnings as possible (default: false) (implied by devel)') option('time_trace', type: 'boolean', value: false, description: 'Enable the -ftime-trace option (Clang only)') -option('asan_examples', type: 'boolean', value: false) -option('asan_tests', type: 'boolean', value: false) -option('ubsan_examples', type: 'boolean', value: false) -option('ubsan_tests', type: 'boolean', value: false) -option('build_tt_encoder', type: 'boolean', value: false, description: 'Enable to build the toml-test encoder.') -option('build_tt_decoder', type: 'boolean', value: false, description: 'Enable to build the toml-test decoder.') -option('compile_library', type: 'boolean', value: false, description: 'Compile as a library') + +option('generate_cmake_config', type: 'boolean', value: true, description: 'Generate a cmake package config file (default: true - no effect when included as a subproject)') option('use_vendored_libs', type: 'boolean', value: true, description: 'Use the libs from the vendor dir when building tests.') -option('float16', type: 'boolean', value: true, description: 'Use _Float16 automatically where available.') + +option('compile_library', type: 'boolean', deprecated: true) +option('float16', type: 'boolean', deprecated: true) diff --git a/src/meson.build b/src/meson.build index b64ba54b..18c4916b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,41 +1,40 @@ -# Compiled library +# This file is a part of toml++ and is subject to the the terms of the MIT license. +# Copyright (c) Mark Gillard +# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. +# SPDX-License-Identifier: MIT + +assert(build_lib) # not header-only mode # These are the arguments needed to compile and consume the library, and # are exposed to users with the `compile_args` kwarg of declare_dependency() -lib_args = ['-DTOML_HEADER_ONLY=0'] +lib_args = cpp.get_supported_arguments('-DTOML_HEADER_ONLY=0') if get_option('default_library') != 'static' - lib_args += '-DTOML_SHARED_LIB=1' -endif -if compiler_supports_float16 - lib_args += compiler_supports_float16_args - lib_args += '-DTOML_ENABLE_FLOAT16=1' -else - lib_args += '-DTOML_ENABLE_FLOAT16=0' + lib_args += cpp.get_supported_arguments('-DTOML_SHARED_LIB=1') endif -if compiler_supports_float16 or compiler_supports_float128 or compiler_supports_int128 - lib_args += compiler.get_supported_arguments('-fext-numeric-literals') +if is_devel + lib_args += cpp.get_supported_arguments('-DTOML_ENABLE_UNRELEASED_FEATURES=1') endif -lib = library( +tomlplusplus_lib = library( meson.project_name(), - 'toml++'/'toml.cpp', - cpp_args: [universal_args, lib_args], + files('toml.cpp'), + cpp_args: [ global_args, lib_args ], gnu_symbol_visibility: 'hidden', include_directories: include_dir, install: not is_subproject, version: meson.project_version(), - override_options: overrides + override_options: global_overrides ) tomlplusplus_dep = declare_dependency( compile_args: lib_args, include_directories: include_dir, - link_with: lib + link_with: tomlplusplus_lib ) if not is_subproject import('pkgconfig').generate( - lib, + tomlplusplus_lib, description: 'TOML config file parser and serializer for C++', extra_cflags: lib_args, url: 'https://marzer.github.io/tomlplusplus' @@ -43,7 +42,7 @@ if not is_subproject endif # cmake -if get_option('generate_cmake_config') and not is_subproject +if get_option('generate_cmake_config') and not is_subproject and not is_devel cmake = import('cmake') cmake.write_basic_package_version_file( name: meson.project_name(), @@ -53,12 +52,9 @@ if get_option('generate_cmake_config') and not is_subproject # This gets the full path of the library, then considers just the last # component (i.e. the actual file name), and finally removes the # version suffix from it, because users _should_ link against the .so - # file, as opposed to the .so.x.y.z one. This last step is only doable - # with str.replace(), introduced in Meson 0.58.0, but it isn't essential - lib_name = lib.full_path().split('/')[-1] - if meson.version().version_compare('>=0.58.0') - lib_name = lib_name.replace('.' + meson.project_version(), '') - endif + # file, as opposed to the .so.x.y.z one. + lib_name = tomlplusplus_lib.full_path().split('/')[-1] + lib_name = lib_name.replace('.' + meson.project_version(), '') # CMake needs space-separated values since it doesn't have types cmake_compile_options = '' diff --git a/src/toml++/toml.cpp b/src/toml++/toml.cpp deleted file mode 100644 index a2d1d1f8..00000000 --- a/src/toml++/toml.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef TOML_IMPLEMENTATION -#define TOML_IMPLEMENTATION -#endif -#ifndef TOML_HEADER_ONLY -#define TOML_HEADER_ONLY 0 -#endif - -#include diff --git a/src/toml.cpp b/src/toml.cpp new file mode 100644 index 00000000..91f4febc --- /dev/null +++ b/src/toml.cpp @@ -0,0 +1,13 @@ +// This file is a part of toml++ and is subject to the the terms of the MIT license. +// Copyright (c) Mark Gillard +// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. +// SPDX-License-Identifier: MIT + +#ifndef TOML_IMPLEMENTATION +#define TOML_IMPLEMENTATION +#endif +#ifndef TOML_HEADER_ONLY +#define TOML_HEADER_ONLY 0 +#endif + +#include diff --git a/tests/meson.build b/tests/meson.build index 97f3cd5b..41329788 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,4 +1,11 @@ -test_sources = [ +# This file is a part of toml++ and is subject to the the terms of the MIT license. +# Copyright (c) Mark Gillard +# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. +# SPDX-License-Identifier: MIT + +assert(build_tests) + +test_sources = files( 'at_path.cpp', 'conformance_burntsushi_invalid.cpp', 'conformance_burntsushi_valid.cpp', @@ -28,199 +35,42 @@ test_sources = [ 'using_iterators.cpp', 'visit.cpp', 'windows_compat.cpp' -] +) test_deps = [ tomlplusplus_dep ] if not get_option('use_vendored_libs') test_deps += dependency('catch2') endif -####################################################################################################################### -# fast math check -####################################################################################################################### - -compiler_supports_fast_math_args = compiler.get_supported_arguments('-ffast-math', '-ffp-contract=fast', '/fp:fast') -compiler_supports_fast_math = compiler.links(''' - #include - #include - int main() - { - std::cout << std::exp2(2.0) << std::pow(2.0, 3.0) << "\n"; - return 0; - } - ''', - name: 'supports fast-math', - args: compiler_supports_fast_math_args -) -####################################################################################################################### -# do the thing! -####################################################################################################################### - -fast_math_modes = [ false, true ] -exception_modes = [ true, false ] -unreleased_feature_modes = [ false, true ] -cpp20_modes = [ false, true ] -test_executables = [] -test_counter = 0 -test_base_args = [] -test_base_args += universal_args -test_base_args += devel_args - -# there are a number of skips here for builds that choose to precompile the library for their tests; -# that's 'fine', it just means that the tests for the compiled library only test settings exactly compatible with -# the way the library itself was compiled (otherwise we risk ABI errors, link errors, etc.) -# -# regular header-only mode tests all the things like normal. - -foreach cpp20 : cpp20_modes - - # skip this target if we're testing c++20 mode and precompiling the library - if cpp20 and (not compiler_supports_cpp20 or get_option('compile_library')) - continue - endif - - foreach unrel : unreleased_feature_modes - - # skip this target if it's using 'unreleased features' and precompiling the library - if unrel and get_option('compile_library') - continue - endif - - foreach fast_math : fast_math_modes - - # skip this target if it's testing fast math and the compiler doesn't support a known fast-math mode - # (or if we're precompiling the library) - if fast_math and (not compiler_supports_fast_math or get_option('compile_library')) - continue - endif - - foreach exceptions : exception_modes - - # skip this target if exceptions are disabled and precompiling the library; - if not exceptions and get_option('compile_library') - continue - endif +#----------------------------------------------------------------------------------------------------------------------- +# tests.exe +#----------------------------------------------------------------------------------------------------------------------- - # skip this target if we've disabled exceptions and enabled fast math; - # both are already tested separately and don't interact in any way meaningful enough to warrant - # a combined permutation. - if not exceptions and fast_math - continue - endif - - # ... same for 'unreleased features' and fast math - if unrel and fast_math - continue - endif - - test_name = '' - test_overrides = [] - test_overrides += overrides - test_args = [] - test_args += test_base_args - - # use the single-header version for some tests to ensure it is the same (no header generation failures) - single_header = ( - test_counter % 2 == 0 - and not get_option('compile_library') - ) - - # use asan in the tests - address_sanitizer = ( - get_option('asan_tests') - and is_clang - ) - - # use ubsan in the tests - ub_sanitizer = ( - get_option('ubsan_tests') - and is_clang - ) - - if cpp20 - test_name = 'cpp20' - test_overrides += 'cpp_std=none' - test_args += compiler_supports_cpp20_args - if compiler_supports_char8 - test_args += compiler_supports_char8_args - endif - else - test_name = 'cpp17' - endif - - if exceptions - test_overrides += 'cpp_eh=default' - test_args += '-DSHOULD_HAVE_EXCEPTIONS=1' - if is_windows - test_args += '-D_HAS_EXCEPTIONS=1' - endif - else - test_name = test_name + '_noexcept' - test_overrides += 'cpp_eh=none' - test_args += '-DSHOULD_HAVE_EXCEPTIONS=0' - if is_windows - test_args += '-D_HAS_EXCEPTIONS=0' - endif - endif - - if address_sanitizer or ub_sanitizer - test_args += [ '-g3' ] - if address_sanitizer and ub_sanitizer - test_overrides += 'b_sanitize=address,undefined' - elif address_sanitizer - test_overrides += 'b_sanitize=address' - else - test_overrides += 'b_sanitize=undefined' - endif - endif - - if fast_math - test_name = test_name + '_fastmath' - test_args += compiler_supports_fast_math_args - endif - - if compiler_supports_float16 - test_args += '-DSHOULD_HAVE_FLOAT16=1' - endif - if compiler_supports_int128 - test_args += '-DSHOULD_HAVE_INT128=1' - endif - if compiler_supports_float128 - test_args += '-DSHOULD_HAVE_FLOAT128=1' - endif - - if unrel - test_name = test_name + '_unrel' - test_args += '-DTOML_ENABLE_UNRELEASED_FEATURES=1' - else - test_args += '-DTOML_ENABLE_UNRELEASED_FEATURES=0' - endif - - if single_header - test_args += '-DUSE_SINGLE_HEADER=1' - endif - - if not get_option('use_vendored_libs') - test_args += '-DUSE_VENDORED_LIBS=0' - endif +test_args = [] +test_args += global_args +if has_exceptions + test_args += cpp.get_supported_arguments('-DSHOULD_HAVE_EXCEPTIONS=1') +else + test_args += cpp.get_supported_arguments('-DSHOULD_HAVE_EXCEPTIONS=0') +endif +if get_option('use_vendored_libs') + test_args += cpp.get_supported_arguments('-DUSE_VENDORED_LIBS=1') +else + test_args += cpp.get_supported_arguments('-DUSE_VENDORED_LIBS=0') +endif - test_executables += [[ - test_name, - executable( - test_name, - test_sources, - cpp_args: test_args, - dependencies: test_deps, - override_options: test_overrides - ) - ]] - test_counter = test_counter + 1 +test_exe = executable( + 'tomlplusplus_tests', + test_sources, + cpp_args: test_args, + dependencies: test_deps, + override_options: global_overrides +) - endforeach # exceptions - endforeach # fast_math - endforeach # strict -endforeach # cpp20 +#----------------------------------------------------------------------------------------------------------------------- +# per-locale invocations +#----------------------------------------------------------------------------------------------------------------------- test_locales = [ 'C', @@ -234,23 +84,23 @@ test_locales = [ 'de_DE.utf8' ] -foreach executable : test_executables - foreach locale : test_locales - test( - executable[0] + ' (' + locale + ')', # name - executable[1], # executable object - env: ['LC_ALL=' + locale], - workdir: meson.source_root()/'tests' - ) - endforeach +foreach locale : test_locales + test( + 'tests - ' + locale, + test_exe, + env: ['LC_ALL=' + locale], + workdir: meson.project_source_root()/'tests' + ) endforeach +#----------------------------------------------------------------------------------------------------------------------- +# ODR build test +#----------------------------------------------------------------------------------------------------------------------- # add the ODR-test build project executable( - 'odr_test', - [ 'odr_test_1.cpp', 'odr_test_2.cpp' ], - cpp_args: test_base_args, - dependencies: tomlplusplus_dep, - override_options: overrides + 'tomlplusplus_odr_test', + files( 'odr_test_1.cpp', 'odr_test_2.cpp' ), + cpp_args: test_args, + dependencies: test_deps ) diff --git a/tests/tests.h b/tests/tests.h index 3d93069b..5c48acc9 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -5,24 +5,8 @@ #pragma once #include "settings.h" +#include -#if USE_SINGLE_HEADER -#include "../toml.hpp" -#else -#include "../include/toml++/toml.h" -#endif -#if TOML_ENABLE_FLOAT16 ^ SHOULD_HAVE_FLOAT16 -#error TOML_ENABLE_FLOAT16 was not deduced correctly -#endif -#if defined(TOML_FLOAT128) ^ SHOULD_HAVE_FLOAT128 -#error TOML_FLOAT128 was not deduced correctly -#endif -#if defined(TOML_INT128) ^ SHOULD_HAVE_INT128 -#error TOML_INT128 was not deduced correctly -#endif -#if defined(TOML_INT128) ^ defined(TOML_UINT128) -#error TOML_INT128 and TOML_UINT128 must both be defined, or neither be defined -#endif #if TOML_COMPILER_HAS_EXCEPTIONS ^ SHOULD_HAVE_EXCEPTIONS #error TOML_COMPILER_HAS_EXCEPTIONS was not deduced correctly #endif diff --git a/toml++.code-workspace b/toml++.code-workspace new file mode 100644 index 00000000..f2ffd5e1 --- /dev/null +++ b/toml++.code-workspace @@ -0,0 +1,22 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": { + "files.associations": { + "type_traits": "cpp", + "concepts": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdlib": "cpp", + "initializer_list": "cpp", + "xstddef": "cpp", + "xtr1common": "cpp", + "version": "cpp", + "xstring": "cpp" + }, + "explorer.sortOrder": "type" + } +} diff --git a/toml-test/README.md b/toml-test/README.md index 9c399eff..5814a569 100644 --- a/toml-test/README.md +++ b/toml-test/README.md @@ -8,10 +8,13 @@
## Prequisites + For this document to make sense, you will need to: + 1. Follow the installation instructions from the [toml-test] README to compile the `toml-test` runner 2. Add `toml-test` as an alias or have it on the system PATH 3. **Linux only:** Install `ninja` and `meson`: + ```bash sudo apt update && sudo apt install -y python3 python3-pip ninja-build sudo pip3 install meson @@ -22,16 +25,19 @@ sudo pip3 install meson ## Building and Testing the Encoder and Decoder ### Windows with Visual Studio + Open `toml++.sln` and build the two projects in the `toml-test` solution folder. They'll be compiled in some target-specific subfolder under `/bin` in the repo root. Then run `toml-test` against them: + ```bash toml-test ./bin/win64_vc143_Release_Application/tt_decoder.exe toml-test ./bin/win64_vc143_Release_Application/tt_encoder.exe --encoder ``` ### Linux (and WSL) + ```bash # create the meson build target folder (first time only) -meson build_tt --buildtype=release -Dbuild_tt_encoder=true -Dbuild_tt_decoder=true -Dgenerate_cmake_config=false +meson build_tt --buildtype=release -Dbuild_tt=true -Dgenerate_cmake_config=false # build and run cd build_tt @@ -39,10 +45,8 @@ ninja && toml-test ./toml-test/tt_decoder && toml-test ./toml-test/tt_encoder -- ``` > ℹ️ Pass `-Duse_vendored_libs=false` to meson if you wish to use the system-installed version -of nlohmann/json rather than the vendored one. - - +> of nlohmann/json rather than the vendored one. [toml-test]: https://github.com/BurntSushi/toml-test -[CONTRIBUTING]: ../CONTRIBUTING.md +[contributing]: ../CONTRIBUTING.md [meson]: https://mesonbuild.com/ diff --git a/toml-test/meson.build b/toml-test/meson.build index 8979e260..1196123f 100644 --- a/toml-test/meson.build +++ b/toml-test/meson.build @@ -1,28 +1,34 @@ +# This file is a part of toml++ and is subject to the the terms of the MIT license. +# Copyright (c) Mark Gillard +# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. +# SPDX-License-Identifier: MIT + +assert(build_tt) + tt_deps = [ tomlplusplus_dep ] if not get_option('use_vendored_libs') tt_deps += dependency('nlohmann_json', fallback: ['json', 'nlohmann_json_dep']) endif tt_args = [] -tt_args += devel_args -if not get_option('use_vendored_libs') - tt_args += '-DUSE_VENDORED_LIBS=0' +tt_args += global_args +if get_option('use_vendored_libs') + tt_args += cpp.get_supported_arguments('-DUSE_VENDORED_LIBS=1') +else + tt_args += cpp.get_supported_arguments('-DUSE_VENDORED_LIBS=0') endif -if get_option('build_tt_encoder') - executable( - 'tt_encoder', - 'tt_encoder.cpp', - cpp_args: tt_args, - dependencies: tt_deps - ) -endif - -if get_option('build_tt_decoder') - executable( - 'tt_decoder', - 'tt_decoder.cpp', - cpp_args: tt_args, - dependencies: tt_deps - ) -endif +executable( + 'tt_encoder', + files('tt_encoder.cpp'), + cpp_args: tt_args, + dependencies: tt_deps, + override_options: global_overrides +) +executable( + 'tt_decoder', + files('tt_decoder.cpp'), + cpp_args: tt_args, + dependencies: tt_deps, + override_options: global_overrides +) diff --git a/toml.hpp b/toml.hpp index 7f48c7da..61779a24 100644 --- a/toml.hpp +++ b/toml.hpp @@ -930,49 +930,6 @@ TOML_ENABLE_WARNINGS; TOML_REQUIRES(condition) #define TOML_HIDDEN_CONSTRAINT(condition, ...) TOML_CONSTRAINED_TEMPLATE(condition, __VA_ARGS__) -#ifndef TOML_ENABLE_FLOAT16 - -#ifdef __FLT16_MANT_DIG__ -#define TOML_FLOAT16_MANT_DIG __FLT16_MANT_DIG__ -#define TOML_FLOAT16_DIG __FLT16_DIG__ -#define TOML_FLOAT16_MIN_EXP __FLT16_MIN_EXP__ -#define TOML_FLOAT16_MIN_10_EXP __FLT16_MIN_10_EXP__ -#define TOML_FLOAT16_MAX_EXP __FLT16_MAX_EXP__ -#define TOML_FLOAT16_MAX_10_EXP __FLT16_MAX_10_EXP__ -#else -#define TOML_FLOAT16_MANT_DIG 0 -#define TOML_FLOAT16_DIG 0 -#define TOML_FLOAT16_MIN_EXP 0 -#define TOML_FLOAT16_MIN_10_EXP 0 -#define TOML_FLOAT16_MAX_EXP 0 -#define TOML_FLOAT16_MAX_10_EXP 0 -#endif - -#if (TOML_FLOAT16_MANT_DIG && TOML_FLOAT16_DIG && TOML_FLOAT16_MIN_EXP && TOML_FLOAT16_MIN_10_EXP \ - && TOML_FLOAT16_MAX_EXP && TOML_FLOAT16_MAX_10_EXP) -#define TOML_FLOAT16_LIMITS_SET 1 -#else -#define TOML_FLOAT16_LIMITS_SET 0 -#endif - -#if TOML_FLOAT16_LIMITS_SET - -#if TOML_CLANG // >= 15 -#if (TOML_ARCH_ARM || TOML_ARCH_AMD64 || TOML_ARCH_X86) -#define TOML_ENABLE_FLOAT16 1 -#endif - -#elif TOML_GCC -#if (TOML_ARCH_ARM || TOML_ARCH_AMD64 /* || TOML_ARCH_X86*/) -#define TOML_ENABLE_FLOAT16 1 -#endif - -#endif // clang/gcc - -#endif // TOML_FLOAT16_LIMITS_SET - -#endif // !defined(TOML_ENABLE_FLOAT16) - #ifndef TOML_ENABLE_FLOAT16 #define TOML_ENABLE_FLOAT16 0 #endif