Skip to content

Commit

Permalink
added support for implementations without <charconv> (fixes #21)
Browse files Browse the repository at this point in the history
also:
- fixed some parsing and printing ops being locale-dependent (fixes #19)
- fixed pkgconfig subdir being wrong (fixes #23)
- 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
- added debug/release awareness to CI tests
- added locale awareness to catch test runner
  • Loading branch information
marzer committed Apr 7, 2020
1 parent 3f04e12 commit 5ca6b29
Show file tree
Hide file tree
Showing 47 changed files with 2,437 additions and 1,532 deletions.
100 changes: 75 additions & 25 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ version: 2.1

jobs:

clang_build_with_dox:
debug_clang9_dox:
docker:
- image: marzer/misc_cpp17_dev:latest
steps:
- checkout
- run:
name: Initializing locales
command: |
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'
- run:
name: Checking toml.hpp
command: |
Expand All @@ -17,14 +21,10 @@ jobs:
git submodule update --init extern/Catch2
git submodule update --init extern/tloptional
- run:
name: Building with clang
name: Building and testing with clang 9
command: |
CXX=clang++-9 meson build-clang
cd build-clang && ninja -v -j 4
- run:
name: Running tests
command: |
cd build-clang && ninja test
CXX=clang++-9 meson build --buildtype=debug
cd build && ninja -v && ninja test
- run:
name: Generating documentation
command: |
Expand All @@ -35,11 +35,15 @@ jobs:
paths: html


clang_build:
debug_clang9:
docker:
- image: marzer/misc_cpp17_dev:latest
steps:
- checkout
- run:
name: Initializing locales
command: |
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'
- run:
name: Checking toml.hpp
command: |
Expand All @@ -50,35 +54,77 @@ jobs:
git submodule update --init extern/Catch2
git submodule update --init extern/tloptional
- run:
name: Building with clang
name: Building and testing with clang 9
command: |
CXX=clang++-9 meson build --buildtype=debug
cd build && ninja -v && ninja test
release_clang9:
docker:
- image: marzer/misc_cpp17_dev:latest
steps:
- checkout
- run:
name: Initializing locales
command: |
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'
- run:
name: Checking toml.hpp
command: |
cd python && python3 ci_single_header_check.py
- run:
name: Pulling submodules
command: |
CXX=clang++-9 meson build-clang
cd build-clang && ninja -v -j 4
git submodule update --init extern/Catch2
git submodule update --init extern/tloptional
- run:
name: Running tests
name: Building and testing with clang 9
command: |
cd build-clang && ninja test
CXX=clang++-9 meson build --buildtype=release
cd build && ninja -v && ninja test
gcc_build:
debug_gcc9:
docker:
- image: marzer/misc_cpp17_dev:latest
steps:
- checkout
- run:
name: Initializing locales
command: |
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'
- run:
name: Pulling submodules
command: |
git submodule update --init extern/Catch2
git submodule update --init extern/tloptional
- run:
name: Building with gcc
name: Building and testing with gcc9
command: |
CXX=g++-9 meson build-gcc
cd build-gcc && ninja -v -j 4
CXX=g++-9 meson build --buildtype=debug
cd build && ninja -v -j 4 && ninja test
release_gcc9:
docker:
- image: marzer/misc_cpp17_dev:latest
steps:
- checkout
- run:
name: Initializing locales
command: |
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'
- run:
name: Pulling submodules
command: |
git submodule update --init extern/Catch2
git submodule update --init extern/tloptional
- run:
name: Running tests
name: Building and testing with gcc9
command: |
cd build-gcc && ninja test
CXX=g++-9 meson build --buildtype=release
cd build && ninja -v -j 4 && ninja test
deploy_dox:
Expand Down Expand Up @@ -110,16 +156,20 @@ workflows:
version: 2
build:
jobs:
- clang_build_with_dox:
- debug_clang9_dox:
filters:
branches:
only: master
- clang_build:
- debug_clang9:
filters:
branches:
ignore: master
- gcc_build
- release_clang9
- debug_gcc9
- release_gcc9
- deploy_dox:
requires:
- clang_build_with_dox
- gcc_build
- debug_clang9_dox
- release_clang9
- debug_gcc9
- release_gcc9
2 changes: 1 addition & 1 deletion docs/tomlplusplus.css
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pre a.tpp-injected
}
}

@media screen and (max-width: 576px)
@media screen and (max-width: 575px)
{
nav .m-thin, nav .github
{
Expand Down
1 change: 1 addition & 0 deletions include/toml++/toml.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

// macro hygiene
#if TOML_UNDEF_MACROS
#undef TOML_INTEGER_CHARCONV
#undef TOML_FLOATING_POINT_CHARCONV
#undef TOML_GNU_ATTR
#undef TOML_PUSH_WARNINGS
Expand Down
32 changes: 19 additions & 13 deletions include/toml++/toml_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,18 @@
#ifndef TOML_DISABLE_INIT_WARNINGS
#define TOML_DISABLE_INIT_WARNINGS
#endif
#ifndef TOML_INTEGER_CHARCONV
#define TOML_INTEGER_CHARCONV 1
#endif
#ifndef TOML_FLOATING_POINT_CHARCONV
#define TOML_FLOATING_POINT_CHARCONV 1
#endif
#if (TOML_INTEGER_CHARCONV || TOML_FLOATING_POINT_CHARCONV) && !__has_include(<charconv>)
#undef TOML_INTEGER_CHARCONV
#undef TOML_FLOATING_POINT_CHARCONV
#define TOML_INTEGER_CHARCONV 0
#define TOML_FLOATING_POINT_CHARCONV 0
#endif
#ifndef TOML_PUSH_WARNINGS
#define TOML_PUSH_WARNINGS
#endif
Expand Down Expand Up @@ -298,7 +307,6 @@

TOML_PUSH_WARNINGS
TOML_DISABLE_ALL_WARNINGS

#if __has_include(<version>)
#include <version>
#endif
Expand All @@ -310,22 +318,20 @@ TOML_DISABLE_ALL_WARNINGS
#include <vector>
#include <map>
#include <iosfwd>
#include <charconv>
#ifndef TOML_ASSERT
#if !defined(NDEBUG) || defined(_DEBUG) || defined(DEBUG)
#include <cassert>
#define TOML_ASSERT(expr) assert(expr)
#else
#define TOML_ASSERT(expr) (void)0
#endif
#endif
#ifndef TOML_OPTIONAL_TYPE
#include <optional>
#endif
#if TOML_EXCEPTIONS
#include <stdexcept>
#endif

#ifndef TOML_ASSERT
#ifdef NDEBUG
#define TOML_ASSERT(expr) (void)0
#else
#include <cassert>
#define TOML_ASSERT(expr) assert(expr)
#endif
#endif
TOML_POP_WARNINGS

#if TOML_CHAR_8_STRINGS
Expand Down Expand Up @@ -893,9 +899,9 @@ namespace toml::impl
"date-time"sv
};

#define TOML_P2S_DECL(linkage, type) \
#define TOML_P2S_DECL(Linkage, Type) \
template <typename Char> \
linkage void print_to_stream(type, std::basic_ostream<Char>&)
Linkage void print_to_stream(Type, std::basic_ostream<Char>&)

TOML_P2S_DECL(TOML_ALWAYS_INLINE, int8_t);
TOML_P2S_DECL(TOML_ALWAYS_INLINE, int16_t);
Expand Down
1 change: 1 addition & 0 deletions include/toml++/toml_default_formatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ namespace toml
size_t child_table_array_count{};
for (auto&& [child_k, child_v] : child_tbl)
{
(void)child_k;
const auto child_type = child_v.type();
switch (child_type)
{
Expand Down
5 changes: 5 additions & 0 deletions include/toml++/toml_node_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ namespace toml
/// \brief Returns a pointer to the viewed node as a toml::value<date_time>, if it is one.
[[nodiscard]] auto as_date_time() const noexcept { return as<date_time>(); }

TOML_PUSH_WARNINGS
TOML_DISABLE_INIT_WARNINGS

/// \brief Gets the raw value contained by the referenced node.
///
/// \tparam U One of the TOML value types. Can also be a string_view.
Expand All @@ -182,6 +185,8 @@ namespace toml
return {};
}

TOML_POP_WARNINGS

/// \brief Gets the raw value contained by the referenced node, or a default.
///
/// \tparam U Default value type. Must be (or be promotable to) one of the TOML value types.
Expand Down
Loading

0 comments on commit 5ca6b29

Please sign in to comment.