Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Aug 2018 21:29:42 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r477204 - head/www/newsboat/files
Message-ID:  <201808142129.w7ELTghH042577@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Tue Aug 14 21:29:42 2018
New Revision: 477204
URL: https://svnweb.freebsd.org/changeset/ports/477204

Log:
  www/newsboat: unbreak with libc++ 7
  
  In file included from src/ttrss_api.cpp:1:
  In file included from include/ttrss_api.h:4:
  ./3rd-party/json.hpp:1201:9: error: static_assert failed "could not find from_json() method in T's namespace"
          static_assert(sizeof(BasicJsonType) == 0,
          ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~
  ./3rd-party/json.hpp:1216:16: note: in instantiation of function template specialization 'nlohmann::detail::from_json_fn::call<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long, unsigned long, double, std::allocator, adl_serializer>, std::__1::basic_string_view<char, std::__1::char_traits<char> > >' requested here
          return call(j, val, priority_tag<1> {});
                 ^
  ./3rd-party/json.hpp:9660:9: note: in instantiation of function template specialization 'nlohmann::detail::from_json_fn::operator()<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long, unsigned long, double, std::allocator, adl_serializer>, std::__1::basic_string_view<char, std::__1::char_traits<char> > >' requested here
          ::nlohmann::from_json(std::forward<BasicJsonType>(j), val);
          ^
  ./3rd-party/json.hpp:12181:36: note: in instantiation of function template specialization 'nlohmann::adl_serializer<std::__1::basic_string_view<char, std::__1::char_traits<char> >, void>::from_json<const nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long, unsigned long, double, std::allocator, adl_serializer> &, std::__1::basic_string_view<char, std::__1::char_traits<char> > >' requested here
          JSONSerializer<ValueType>::from_json(*this, ret);
                                     ^
  ./3rd-party/json.hpp:12443:16: note: in instantiation of function template specialization 'nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long, unsigned long, double, std::allocator, adl_serializer>::get<std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::basic_string_view<char, std::__1::char_traits<char> >, 0>' requested here
          return get<ValueType>();
                 ^
  /usr/include/c++/v1/string:875:29: note: in instantiation of function template specialization 'nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long, unsigned long, double, std::allocator, adl_serializer>::operator basic_string_view<std::__1::basic_string_view<char, std::__1::char_traits<char> >, 0>' requested here
          {__self_view __sv = __t; return assign(__sv);}
                              ^
  src/ttrss_api.cpp:69:7: note: in instantiation of function template specialization 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long, unsigned long, double, std::allocator, adl_serializer>, void>' requested here
                  sid = content["session_id"];
                      ^
  
  PR:		230631
  Reported by:	antoine (via exp-run)
  Obtained from:	upstream (json)
  Approved by:	portmgr blanket

Added:
  head/www/newsboat/files/patch-json-libc++7   (contents, props changed)

Added: head/www/newsboat/files/patch-json-libc++7
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/newsboat/files/patch-json-libc++7	Tue Aug 14 21:29:42 2018	(r477204)
@@ -0,0 +1,63 @@
+https://github.com/nlohmann/json/commit/8165707990e4
+
+--- 3rd-party/json.hpp.orig	2018-06-24 19:26:15 UTC
++++ 3rd-party/json.hpp
+@@ -353,6 +353,16 @@ struct is_compatible_object_type_impl<true, RealType, 
+         std::is_constructible<typename RealType::mapped_type, typename CompatibleObjectType::mapped_type>::value;
+ };
+ 
++template<bool B, class RealType, class CompatibleStringType>
++struct is_compatible_string_type_impl : std::false_type {};
++
++template<class RealType, class CompatibleStringType>
++struct is_compatible_string_type_impl<true, RealType, CompatibleStringType>
++{
++    static constexpr auto value =
++        std::is_same<typename RealType::value_type, typename CompatibleStringType::value_type>::value;
++};
++
+ template<class BasicJsonType, class CompatibleObjectType>
+ struct is_compatible_object_type
+ {
+@@ -363,6 +373,15 @@ struct is_compatible_object_type
+                                   typename BasicJsonType::object_t, CompatibleObjectType >::value;
+ };
+ 
++template<class BasicJsonType, class CompatibleStringType>
++struct is_compatible_string_type
++{
++    static auto constexpr value = is_compatible_string_type_impl <
++                                  conjunction<negation<std::is_same<void, CompatibleStringType>>,
++                                  has_value_type<CompatibleStringType>>::value,
++                                  typename BasicJsonType::string_t, CompatibleStringType >::value;
++};
++
+ template<typename BasicJsonType, typename T>
+ struct is_basic_json_nested_type
+ {
+@@ -974,6 +993,25 @@ void from_json(const BasicJsonType& j, typename BasicJ
+     {
+         JSON_THROW(type_error::create(302, "type must be string, but is " + std::string(j.type_name())));
+     }
++    s = *j.template get_ptr<const typename BasicJsonType::string_t*>();
++}
++
++template <
++    typename BasicJsonType, typename CompatibleStringType,
++    enable_if_t <
++        is_compatible_string_type<BasicJsonType, CompatibleStringType>::value and
++        not std::is_same<typename BasicJsonType::string_t,
++                         CompatibleStringType>::value and
++        std::is_constructible <
++            BasicJsonType, typename CompatibleStringType::value_type >::value,
++        int > = 0 >
++void from_json(const BasicJsonType& j, CompatibleStringType& s)
++{
++    if (JSON_UNLIKELY(not j.is_string()))
++    {
++        JSON_THROW(type_error::create(302, "type must be string, but is " + std::string(j.type_name())));
++    }
++
+     s = *j.template get_ptr<const typename BasicJsonType::string_t*>();
+ }
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808142129.w7ELTghH042577>