Created attachment 169252 [details] Remove hand-rolled round function from games/assaultcube During the exp-run in bug 208158, it was found that games/assaultcube gives errors with libc++ 3.8.0 [1]: In file included from crypto.cpp:1: In file included from ./cube.h:8: ./tools.h:58:21: error: static declaration of 'round' follows non-static declaration static inline float round(float x) { return floor(x + 0.5f); } ^ /usr/include/c++/v1/math.h:1364:46: note: previous definition is here inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT {return roundf(__lcpp_x);} ^ This is because the header attempts to redefine round(), which is a standard function from <math.h> (or <cmath>). Remove the custom definition to make the program compile. [1] http://package18.nyi.freebsd.org/data/headamd64PR208158-default/2016-03-22_18h30m05s/logs/errors/assaultcube-1.2.0.2_4.log
Hello, Dimitry Andric. Thanks for your patch. I found, that "hand-rolled" round() function was removed by upstream for development version also: https://github.com/assaultcube/AC/commit/752950989b4e286459ca9aee3d61a868d7b20fa4 -8<-- fix some errors and warnings for GCC 6 * do not use std::abs() because math.h includes one, that converts ints to double. Use own iabs(), which directly uses labs() instead. * don't use the word "gamma" as name for variables * don't use a homebrew round() function -->8- There are also some upstream fixes for Clang warnings, some of which already included: https://github.com/assaultcube/AC/commit/6e4b23734f115888ce73907a85739ec833a333fd Therefore, I propose to use mentioned upstream fixes (adapted for current 1.2.0.2 version), which includes your fix for round() function. The proposed patch attached to the following message.
Created attachment 169270 [details] Proposed patch (since 412346 revision) - Bump PORTREVISION - Add adapted and merged upstream patches to fix some errors and warnings for (newer) GCC and Clang - Remove merged files/patch-source_src_bot_bot_waypoint.cpp file
Created attachment 169271 [details] The poudriere testport log (FreeBSD 10.2 amd64)
A commit references this bug: Author: jbeich Date: Wed Apr 13 16:17:48 UTC 2016 New revision: 413214 URL: https://svnweb.freebsd.org/changeset/ports/413214 Log: games/assaultcube: unbreak build with newer C++ library - Add upstream fixes for clang/libc++ 3.8 and gcc/libstdc++ 6.0 - Remove merged files/patch-source_src_bot_bot_waypoint.cpp file - Bump PORTREVISION In file included from crypto.cpp:1: In file included from ./cube.h:8: ./tools.h:58:21: error: static declaration of 'round' follows non-static declaration static inline float round(float x) { return floor(x + 0.5f); } ^ /usr/include/c++/v1/math.h:1364:46: note: previous definition is here inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT {return roundf(__lcpp_x);} ^ In file included from cube.h:8:0, from crypto.cpp:1: tools.h: In function 'float round(float)': tools.h:58:34: error: 'float round(float)' conflicts with a previous declaration static inline float round(float x) { return floor(x + 0.5f); } ^ In file included from /usr/local/lib/gcc6/include/c++/math.h:36:0, from platform.h:9, from cube.h:7, from crypto.cpp:1: /usr/local/lib/gcc6/include/c++/cmath:1708:3: note: previous declaration 'constexpr float std::round(float)' round(float __x) ^~~~~ PR: 208754 Reported by: dim (libc++), lightside (libstdc++) Submitted by: lightside <lightside@gmx.com> (maintainer) Changes: head/games/assaultcube/Makefile head/games/assaultcube/files/patch-fixes-for-GCC-and-Clang.diff head/games/assaultcube/files/patch-source_src_bot_bot_waypoint.cpp
Thanks. Committed.