Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove binary_function from ginac's code in sage #34573

Closed
kiwifb opened this issue Sep 23, 2022 · 15 comments
Closed

Remove binary_function from ginac's code in sage #34573

kiwifb opened this issue Sep 23, 2022 · 15 comments

Comments

@kiwifb
Copy link
Member

kiwifb commented Sep 23, 2022

The use of std::binary_function and std::unary_function have been deprecated for almost 10 years and gcc-12 is now signalling it. They may be completely removed soon. We get the following warnings when building sage

INFO: compile options: '-I./sage/cpython -I/home/portage/sci-mathematics/sage-9999/work/sage-9999/src -I/usr/lib/python3.10/site-packages/numpy/core/include -I/usr/include/python3.10 -Ibuild/cythonized -I/usr/include/python3.10 -c'
extra options: '-fno-strict-aliasing -DCYTHON_CLINE_IN_TRACEBACK=1'
INFO: x86_64-pc-linux-gnu-gcc: build/cythonized/sage/symbolic/ring.c
INFO: x86_64-pc-linux-gnu-gcc: sage/symbolic/ginac/ex.cpp
In file included from sage/symbolic/ginac/basic.h:35,
                 from sage/symbolic/ginac/ex.h:26,
                 from sage/symbolic/ginac/assume.cpp:8:
sage/symbolic/ginac/ptr.h:162:11: warning: ‘template<class _Arg1, class _Arg2, class _Result> struct std::binary_function’ is deprecated [-Wdeprecated-declarations]
  162 |  : public binary_function<GiNaC::ptr<T>, GiNaC::ptr<T>, bool> {
      |           ^~~~~~~~~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/include/g++-v12/bits/refwrap.h:39,
                 from /usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/include/g++-v12/vector:66,
                 from sage/symbolic/ginac/basic.h:26:
/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/include/g++-v12/bits/stl_function.h:131:12: note: declared here

The following files contain offending code

src/sage/symbolic/ginac/order.h:class print_order : public std::binary_function<ex, ex, bool> {
src/sage/symbolic/ginac/order.h:        public std::binary_function<expair, expair, bool>
src/sage/symbolic/ginac/expair.h:struct expair_is_less : public std::binary_function<expair, expair, bool> {
src/sage/symbolic/ginac/expair.h:struct expair_rest_is_less : public std::binary_function<expair, expair, bool> {
src/sage/symbolic/ginac/expair.h:struct expair_swap : public std::binary_function<expair, expair, void> {
src/sage/symbolic/ginac/ptr.h: : public binary_function<GiNaC::ptr<T>, GiNaC::ptr<T>, bool> {
src/sage/symbolic/ginac/ex.h:struct ex_is_less : public std::binary_function<ex, ex, bool> {
src/sage/symbolic/ginac/ex.h:struct ex_is_equal : public std::binary_function<ex, ex, bool> {
src/sage/symbolic/ginac/ex.h:struct op0_is_equal : public std::binary_function<ex, ex, bool> {
src/sage/symbolic/ginac/ex.h:struct ex_swap : public std::binary_function<ex, ex, void> {

There are no instances of unary_function in sage.

I did a similar clean up in brial quite recently https://github.com/BRiAl/BRiAl/pull/52/files

CC: @antonio-rojas

Component: porting

Author: François Bissey

Branch/Commit: 0dc211b

Reviewer: Matthias Koeppe

Issue created by migration from https://trac.sagemath.org/ticket/34573

@kiwifb kiwifb added this to the sage-9.8 milestone Sep 23, 2022
@mkoeppe
Copy link
Contributor

mkoeppe commented Sep 23, 2022

comment:1

We should take a look at what upstream did with the affected code (see #33401). They had many C++ cleanups over the years.

@kiwifb
Copy link
Member Author

kiwifb commented Sep 23, 2022

comment:2

That is true, but right now I will just focus on that bit. Most of the time just removing the offending characters works. In real time, it appears to have compiled cleanly locally. Moving on doctesting.

@mkoeppe
Copy link
Contributor

mkoeppe commented Sep 23, 2022

comment:3

Upstream did this change in 319c9533e12eba2449001c47545e3c3cf48c482f

@kiwifb
Copy link
Member Author

kiwifb commented Sep 23, 2022

comment:4

Right, I supposed I should discard what I have just done and use that instead. It should have gone through more testing.

@kiwifb
Copy link
Member Author

kiwifb commented Sep 23, 2022

comment:5

I never thought about that before, how do I track a hash down on github? Do You have to check out and search with git manually?

@mkoeppe
Copy link
Contributor

mkoeppe commented Sep 23, 2022

comment:6

Only tried this out now, but a global search for that sha finds repo & commit!
https://github.com/search?q=319c9533e12eba2449001c47545e3c3cf48c482f&type=commits

@kiwifb
Copy link
Member Author

kiwifb commented Sep 23, 2022

comment:7

OK, that's interesting. So, my patch includes touching one file not in that commit because it is not in that repository. And the commit touches files we do not have in sage. Where they overlap, my job is identical to one white space difference.

So, I think I'll just send my branch and we'll think about synchronisation later because that won't be fun.

@mkoeppe
Copy link
Contributor

mkoeppe commented Sep 23, 2022

comment:8

Yes, I agree.

@kiwifb
Copy link
Member Author

kiwifb commented Sep 23, 2022

Branch: u/fbissey/binary_function

@kiwifb
Copy link
Member Author

kiwifb commented Sep 23, 2022

Commit: 0dc211b

@kiwifb
Copy link
Member Author

kiwifb commented Sep 23, 2022

New commits:

0dc211bRemovin binary_function from ginac code

@kiwifb
Copy link
Member Author

kiwifb commented Sep 23, 2022

Author: François Bissey

@mkoeppe
Copy link
Contributor

mkoeppe commented Sep 23, 2022

Reviewer: Matthias Koeppe

@sheerluck
Copy link
Contributor

comment:11

positive review from gentoo user

@vbraun
Copy link
Member

vbraun commented Sep 27, 2022

Changed branch from u/fbissey/binary_function to 0dc211b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants