Skip to content

Commit

Permalink
Update macros in config file
Browse files Browse the repository at this point in the history
Changes:
- Update IPADDRESS_CONSTEVAL macro definition;
- Remove IPADDRESS_HAS_CONCEPTS macro.
  • Loading branch information
VladimirShaleev committed May 13, 2024
1 parent 824e5d2 commit 64acf2a
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 30 deletions.
10 changes: 3 additions & 7 deletions include/ipaddress/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@
# error ipaddress needs at least C++ standard version 11
#endif

#if __GNUC__ <= 9 && !defined(__llvm__) && !defined(__INTEL_COMPILER)
# define IPADDRESS_CONSTEVAL IPADDRESS_CONSTEXPR
#else
#if defined(__cpp_consteval) && __cpp_consteval >= 201811L
# define IPADDRESS_CONSTEVAL consteval
#else
# define IPADDRESS_CONSTEVAL IPADDRESS_CONSTEXPR
#endif

#if defined(_MSC_VER) && (_MSC_VER <= 1800)
Expand Down Expand Up @@ -112,10 +112,6 @@
# endif
#endif

#if defined(__cpp_lib_concepts) && __cpp_lib_concepts >= 202002L
# define IPADDRESS_HAS_CONCEPTS
#endif

#if defined(__cpp_nontype_template_parameter_class)
# define IPADDRESS_NONTYPE_TEMPLATE_PARAMETER
#elif defined(__cpp_nontype_template_args)
Expand Down
6 changes: 0 additions & 6 deletions include/ipaddress/ip-address-iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ namespace IPADDRESS_NAMESPACE {
template <typename Iterator>
class ip_reverse_iterator {
public:
#ifdef IPADDRESS_HAS_CONCEPTS
using iterator_concept = std::random_access_iterator_tag; /**< The iterator concept, defined if concepts are available. */
#endif
using iterator_category = typename std::iterator_traits<Iterator>::iterator_category; /**< The category of the iterator. */
using iterator_type = Iterator; /**< The underlying iterator type. */
using value_type = typename std::iterator_traits<Iterator>::value_type; /**< The type of the values iterated over. */
Expand Down Expand Up @@ -421,9 +418,6 @@ class ip_address_iterator;
template <typename Base>
class ip_address_iterator<ip_address_base<Base>> {
public:
#ifdef IPADDRESS_HAS_CONCEPTS
using iterator_concept = std::random_access_iterator_tag; /**< The iterator concept, defined if concepts are available. */
#endif
using iterator_category = std::random_access_iterator_tag; /**< The category of the iterator. */
using value_type = ip_address_base<Base>; /**< The type of the values iterated over. */
using difference_type = int64_t; /**< The type representing the difference between two iterators. */
Expand Down
3 changes: 0 additions & 3 deletions include/ipaddress/ip-any-iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ namespace IPADDRESS_NAMESPACE {
template <typename T, typename Ipv4Iter, typename Ipv6Iter>
class ip_any_iterator {
public:
#ifdef IPADDRESS_HAS_CONCEPTS
using iterator_concept = std::random_access_iterator_tag; /**< Iterator concept (C++20). */
#endif
using iterator_category = std::random_access_iterator_tag; /**< Iterator category. */
using value_type = T; /**< Value type iterated over. */
using difference_type = int64_t; /**< Difference type between iterators. */
Expand Down
16 changes: 9 additions & 7 deletions include/ipaddress/uint128.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1875,11 +1875,12 @@ IPADDRESS_NODISCARD IPADDRESS_CONSTEXPR IPADDRESS_FORCE_INLINE bool operator>=(T
namespace std {

#pragma warning(push, 3)
#ifdef __GNUC__
#if defined(_MSC_VER)
# pragma warning(disable:4996)
#elif defined(__GNUC__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#ifdef __clang__
#elif defined(__clang__)
_Pragma("clang diagnostic push")
_Pragma("clang diagnostic ignored \"-Wdeprecated\"")
#endif
Expand Down Expand Up @@ -2016,11 +2017,12 @@ constexpr std::float_denorm_style _numeric_limits_uint128<T>::has_denorm;
template <typename T>
constexpr std::float_round_style _numeric_limits_uint128<T>::round_style;

#ifdef __clang__
_Pragma("clang diagnostic pop")
#endif
#ifdef __GNUC__
#if defined(_MSC_VER)
# pragma warning(default:4996)
#elif defined(__GNUC__)
# pragma GCC diagnostic pop
#elif defined(__clang__)
_Pragma("clang diagnostic pop")
#endif
#pragma warning(pop)

Expand Down
1 change: 0 additions & 1 deletion include/ipaddress/unicode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ struct char_or_throw {
IPADDRESS_NODISCARD_WHEN_NO_EXCEPTIONS static IPADDRESS_CONSTEXPR IPADDRESS_FORCE_INLINE char next(const T*& it, const T* begin, const T* end) IPADDRESS_NOEXCEPT_WHEN_NO_EXCEPTIONS {
uint32_t error_symbol = 0;
auto code = error_code::no_error;
auto prev_it = it;
const auto result = char_reader<T>::next_or_error(it, end, code, error_symbol);
if (code != error_code::no_error) {
raise_error(code, error_symbol, begin, end - begin);
Expand Down
1 change: 0 additions & 1 deletion tests/ip-address-tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,6 @@ INSTANTIATE_TEST_SUITE_P(
template <typename T, size_t N1, size_t N2>
static void parse_unexpected_symbol(const T (&expected_address)[N1], const T (&expected_scope)[N2]) { // NOLINT(readability-function-cognitive-complexity)
using tstring = std::basic_string<T, std::char_traits<T>, std::allocator<T>>;
using tistringstream = std::basic_istringstream<T, std::char_traits<T>, std::allocator<T>>;

auto ip = ip_address::parse("2001:db8::1");
error_code err1 = error_code::no_error;
Expand Down
1 change: 0 additions & 1 deletion tests/ip-network-tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ INSTANTIATE_TEST_SUITE_P(
template <typename T, size_t N>
static void parse_unexpected_symbol(const T (&expected_address)[N]) {
using tstring = std::basic_string<T, std::char_traits<T>, std::allocator<T>>;
using tistringstream = std::basic_istringstream<T, std::char_traits<T>, std::allocator<T>>;

error_code err1 = error_code::no_error;
error_code err2 = error_code::no_error;
Expand Down
1 change: 0 additions & 1 deletion tests/ipv4-address-tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@ INSTANTIATE_TEST_SUITE_P(
template <typename T, size_t N>
static void parse_unexpected_symbol(const T (&expected_address)[N]) {
using tstring = std::basic_string<T, std::char_traits<T>, std::allocator<T>>;
using tistringstream = std::basic_istringstream<T, std::char_traits<T>, std::allocator<T>>;

error_code err1 = error_code::no_error;
error_code err2 = error_code::no_error;
Expand Down
1 change: 0 additions & 1 deletion tests/ipv4-network-tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,6 @@ INSTANTIATE_TEST_SUITE_P(
template <typename T, size_t N>
static void parse_unexpected_symbol(const T (&expected_address)[N]) {
using tstring = std::basic_string<T, std::char_traits<T>, std::allocator<T>>;
using tistringstream = std::basic_istringstream<T, std::char_traits<T>, std::allocator<T>>;

error_code err1 = error_code::no_error;
error_code err2 = error_code::no_error;
Expand Down
1 change: 0 additions & 1 deletion tests/ipv6-address-tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,6 @@ INSTANTIATE_TEST_SUITE_P(
template <typename T, size_t N1, size_t N2>
static void parse_unexpected_symbol(const T (&expected_address)[N1], const T (&expected_scope)[N2]) { // NOLINT(readability-function-cognitive-complexity)
using tstring = std::basic_string<T, std::char_traits<T>, std::allocator<T>>;
using tistringstream = std::basic_istringstream<T, std::char_traits<T>, std::allocator<T>>;

auto ip = ipv6_address::parse("2001:db8::1");
error_code err1 = error_code::no_error;
Expand Down
1 change: 0 additions & 1 deletion tests/ipv6-network-tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,6 @@ INSTANTIATE_TEST_SUITE_P(
template <typename T, size_t N>
static void parse_unexpected_symbol(const T (&expected_address)[N]) {
using tstring = std::basic_string<T, std::char_traits<T>, std::allocator<T>>;
using tistringstream = std::basic_istringstream<T, std::char_traits<T>, std::allocator<T>>;

error_code err1 = error_code::no_error;
error_code err2 = error_code::no_error;
Expand Down

0 comments on commit 64acf2a

Please sign in to comment.