Skip to content

Commit

Permalink
Francesco's review and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
darioizzo committed Aug 25, 2023
1 parent 2d79eb8 commit cbe7690
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
7 changes: 3 additions & 4 deletions include/kep3/detail/exceptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef kep3_EXCEPTIONS_HPP
#define kep3_EXCEPTIONS_HPP
#ifndef kep3_DETAIL_EXCEPTIONS_HPP
#define kep3_DETAIL_EXCEPTIONS_HPP

#include <stdexcept>

#include <kep3/config.hpp>
#include <kep3/detail/visibility.hpp>

namespace kep3 {
struct kep3_DLL_PUBLIC not_implemented_error final
: std::runtime_error {
struct kep3_DLL_PUBLIC not_implemented_error final : std::runtime_error {
using std::runtime_error::runtime_error;
};

Expand Down
4 changes: 2 additions & 2 deletions include/kep3/detail/s11n.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef KEP3_S11N_HPP
#define KEP3_S11N_HPP
#ifndef KEP3_DETAIL_S11N_HPP
#define KEP3_DETAIL_S11N_HPP

#include <cstddef>
#include <locale>
Expand Down
4 changes: 2 additions & 2 deletions include/kep3/planet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ struct kep3_DLL_PUBLIC_INLINE_CLASS planet_inner final : planet_inner_base {

// Get the type at runtime.
[[nodiscard]] std::type_index get_type_index() const final {
return std::type_index(typeid(T));
return std::type_index{typeid(T)};
}

// Raw getters for the internal instance.
Expand Down Expand Up @@ -217,7 +217,7 @@ using is_udpla = std::conjunction<
std::is_copy_constructible<T>, std::is_move_constructible<T>,
std::is_destructible<T>, udpla_has_eph<T>>;

struct null_udpla {
struct kep3_DLL_PUBLIC null_udpla {
null_udpla() = default;
static std::array<std::array<double, 3>, 2> eph(const epoch &);

Expand Down
1 change: 1 addition & 0 deletions src/detail/type_name.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ std::string demangle_from_typeid(const char *s) {
// potential ambiguities when taking the address of std::free().
// See:
// https://stackoverflow.com/questions/27440953/stdunique-ptr-for-c-functions-that-need-free
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory, hicpp-no-malloc, cppcoreguidelines-no-malloc)
auto deleter = [](void *ptr) { std::free(ptr); };

// NOTE: abi::__cxa_demangle will return a pointer allocated by std::malloc,
Expand Down
2 changes: 2 additions & 0 deletions test/planet_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ kep3_S11N_PLANET_EXPORT(complete_udpla);

TEST_CASE("construction") {
{
kep3::detail::null_udpla udpla{};
udpla.eph(epoch(0.));
// Default constructor (a null planet)
REQUIRE_NOTHROW(planet());
auto pla = planet();
Expand Down

0 comments on commit cbe7690

Please sign in to comment.