Skip to content

Commit

Permalink
devel/boost-libs: apply upstream patch for C++17 support
Browse files Browse the repository at this point in the history
Since clang 16 (and gcc 11) the default C++ standard is now gnu++17.
Several ports that use boost/functional.hpp now complain with (for
example print/libmspub01):

  In file included from MSPUBCollector.cpp:17:
  In file included from /usr/local/include/boost/multi_array.hpp:34:
  In file included from /usr/local/include/boost/multi_array/multi_array_ref.hpp:32:
  /usr/local/include/boost/functional.hpp:45:24: error: no member named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
              using std::unary_function;
                    ~~~~~^~~~~~~~~~~~~~
                         __unary_function
  /usr/include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
  using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
  ^
  In file included from MSPUBCollector.cpp:17:
  In file included from /usr/local/include/boost/multi_array.hpp:34:
  In file included from /usr/local/include/boost/multi_array/multi_array_ref.hpp:32:
  /usr/local/include/boost/functional.hpp:46:24: error: no member named 'binary_function' in namespace 'std'; did you mean '__binary_function'?
              using std::binary_function;
                    ~~~~~^~~~~~~~~~~~~~~
                         __binary_function
  /usr/include/c++/v1/__functional/binary_function.h:49:1: note: '__binary_function' declared here
  using __binary_function = __binary_function_keep_layout_base<_Arg1, _Arg2, _Result>;
  ^

This is because std::unary_function and std::binary_function were
removed from C++17. Upstream boost/functional fixed this in
boostorg/functional@6a573e4, so apply that
patch until boost 1.83.0 is released with it.

PR:		271488
Approved by:	fluffy (maintainer)
MFH:		2023Q2
  • Loading branch information
DimitryAndric committed May 18, 2023
1 parent 4b312f7 commit c035007
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion devel/boost-libs/Makefile
@@ -1,5 +1,5 @@
PORTNAME= boost-libs
PORTREVISION?= 0
PORTREVISION?= 1

COMMENT= Free portable C++ libraries (without Boost.Python)
WWW= https://www.boost.org/
Expand Down
28 changes: 28 additions & 0 deletions devel/boost-libs/files/patch-boost_functional.hpp
@@ -0,0 +1,28 @@
From 6a573e4b8333ee63ee62ce95558c3667348db233 Mon Sep 17 00:00:00 2001
From: Glen Fernandes <glen.fernandes@gmail.com>
Date: Mon, 17 Apr 2023 06:59:02 -0400
Subject: [PATCH] Define unary_function and binary_function unconditionally

--- boost/functional.hpp.orig 2023-04-10 13:47:33 UTC
+++ boost/functional.hpp
@@ -21,7 +21,6 @@ namespace boost
namespace functional
{
namespace detail {
-#if defined(_HAS_AUTO_PTR_ETC) && !_HAS_AUTO_PTR_ETC
// std::unary_function and std::binary_function were both removed
// in C++17.

@@ -39,12 +38,6 @@ namespace boost
typedef Arg2 second_argument_type;
typedef Result result_type;
};
-#else
- // Use the standard objects when we have them.
-
- using std::unary_function;
- using std::binary_function;
-#endif
}
}

0 comments on commit c035007

Please sign in to comment.