Bug 231073 - lang/python27: consumers cannot build with Clang in C++17 mode
Summary: lang/python27: consumers cannot build with Clang in C++17 mode
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-python (Nobody)
URL:
Keywords: needs-patch
Depends on:
Blocks:
 
Reported: 2018-09-01 13:56 UTC by Jan Beich
Modified: 2021-09-16 19:16 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (python)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer freebsd_triage 2018-09-01 13:56:17 UTC
Consumers may want to switch to C++17 but some dependencies aren't ready for Python 3.* or C++17 library may want to keep supporting Python 2.* in addition to Python 3.*.

$ echo '#include <Python.h>' >a.cc
$ c++ -std=gnu++17 $(python2.7-config --cflags) -c a.cc
In file included from a.cc:1:
In file included from /usr/local/include/python2.7/Python.h:88:
/usr/local/include/python2.7/unicodeobject.h:534:5: error: ISO C++17 does not allow 'register' storage class
      specifier [-Wregister]
    register PyObject *obj,     /* Object */
    ^~~~~~~~~
/usr/local/include/python2.7/unicodeobject.h:553:5: error: ISO C++17 does not allow 'register' storage class
      specifier [-Wregister]
    register PyObject *obj      /* Object */
    ^~~~~~~~~
/usr/local/include/python2.7/unicodeobject.h:575:5: error: ISO C++17 does not allow 'register' storage class
      specifier [-Wregister]
    register const wchar_t *w,  /* wchar_t buffer */
    ^~~~~~~~~
/usr/local/include/python2.7/unicodeobject.h:593:5: error: ISO C++17 does not allow 'register' storage class
      specifier [-Wregister]
    register wchar_t *w,        /* wchar_t buffer */
    ^~~~~~~~~
In file included from a.cc:1:
In file included from /usr/local/include/python2.7/Python.h:97:
/usr/local/include/python2.7/stringobject.h:173:5: error: ISO C++17 does not allow 'register' storage class
      specifier [-Wregister]
    register PyObject *obj,     /* string or Unicode object */
    ^~~~~~~~~
/usr/local/include/python2.7/stringobject.h:174:5: error: ISO C++17 does not allow 'register' storage class
      specifier [-Wregister]
    register char **s,          /* pointer to buffer variable */
    ^~~~~~~~~
/usr/local/include/python2.7/stringobject.h:175:5: error: ISO C++17 does not allow 'register' storage class
      specifier [-Wregister]
    register Py_ssize_t *len    /* pointer to length variable or NULL
    ^~~~~~~~~
7 errors generated.
Comment 1 Jan Beich freebsd_committer freebsd_triage 2018-09-01 13:57:17 UTC
Can you backport upstream fix?

https://github.com/python/cpython/commit/9ed5f2726607
https://bugs.python.org/issue18722
Comment 2 Jan Beich freebsd_committer freebsd_triage 2018-09-01 14:01:36 UTC
GCC doesn't turn -Wregister into -Werror by default. Warnings in dependencies can be silenced via -isystem[1] but, unfortunately, "python2.7-config --cflags" uses -I instead of -isystem.

[1] https://gcc.gnu.org/onlinedocs/cpp/System-Headers.html
Comment 3 Walter Schwarzenfeld 2019-08-09 10:41:51 UTC
Is this still relevant? (I tested it in the port and it works).
Comment 4 Jan Beich freebsd_committer freebsd_triage 2019-08-09 11:13:47 UTC
(In reply to Walter Schwarzenfeld from comment #3)
> Is this still relevant? (I tested it in the port and it works).

Yes but not for devel/boost-python-libs[1]. When testing make sure to follow steps to reproduce.

[1] https://github.com/boostorg/python/commit/6bd6d7185026adbdbe398cb6ba162be9e42b9913
Comment 5 Daniel Engberg freebsd_committer freebsd_triage 2021-09-15 23:12:44 UTC
Hi Jan, as python27 is being sunset I guess we can close this?