Created attachment 176392 [details] Fix for lang/gcc5
Created attachment 176421 [details] Fix for lang/gcc5 Removed test for __GNUC_MINOR__
Please include the error message into bug reports. Or at least specify what the patches are trying to fix. mfg Tobias
(In reply to Tobias C. Berner from comment #2) lang/gcc5's cmath requires scope std:: to access isnan, isinf
I'm not trying to be annyoing. But it is quite helpful for readers of the bugs, if you include the compiler error message. Also that way, the bug reports will crop up if one searches for the error message via a search-engine. Which is also helpful for people who hit the same issue for other ports.
(In reply to Tobias C. Berner from comment #4) Hi, Tobias. Sorry for being so terse, I submitted 14 patches at once for lang/gcc5 :) /wrkdirs/usr/ports/math/kmplot/work/kmplot-4.14.3/kmplot/view.cpp: In member function 'QPointF View::toPixel(const QPointF&, View::ClipBehaviour, const QPointF&)': /wrkdirs/usr/ports/math/kmplot/work/kmplot-4.14.3/kmplot/view.cpp:480:14: error: 'isnan' was not declared in this scope if ( isnan(x) ) ^ /wrkdirs/usr/ports/math/kmplot/work/kmplot-4.14.3/kmplot/view.cpp:480:14: note: suggested alternative: In file included from /wrkdirs/usr/ports/math/kmplot/work/kmplot-4.14.3/kmplot/view.cpp:71:0: /usr/local/lib/gcc5/include/c++/cmath:862:5: note: 'std::isnan' isnan(_Tp __f) ^ /wrkdirs/usr/ports/math/kmplot/work/kmplot-4.14.3/kmplot/view.cpp:500:15: error: 'isinf' was not declared in this scope if ( isinf(x) == -1 ) ^ /wrkdirs/usr/ports/math/kmplot/work/kmplot-4.14.3/kmplot/view.cpp:500:15: note: suggested alternative: In file included from /wrkdirs/usr/ports/math/kmplot/work/kmplot-4.14.3/kmplot/view.cpp:71:0: /usr/local/lib/gcc5/include/c++/cmath:853:5: note: 'std::isinf' isinf(_Tp __f) ^ /wrkdirs/usr/ports/math/kmplot/work/kmplot-4.14.3/kmplot/view.cpp:507:14: error: 'isnan' was not declared in this scope if ( isnan(y) ) ^ /wrkdirs/usr/ports/math/kmplot/work/kmplot-4.14.3/kmplot/view.cpp:507:14: note: suggested alternative: In file included from /wrkdirs/usr/ports/math/kmplot/work/kmplot-4.14.3/kmplot/view.cpp:71:0: /usr/local/lib/gcc5/include/c++/cmath:862:5: note: 'std::isnan' isnan(_Tp __f) ^ /wrkdirs/usr/ports/math/kmplot/work/kmplot-4.14.3/kmplot/view.cpp:527:15: error: 'isinf' was not declared in this scope if ( isinf(y) == -1 ) ^ /wrkdirs/usr/ports/math/kmplot/work/kmplot-4.14.3/kmplot/view.cpp:527:15: note: suggested alternative: In file included from /wrkdirs/usr/ports/math/kmplot/work/kmplot-4.14.3/kmplot/view.cpp:71:0: /usr/local/lib/gcc5/include/c++/cmath:853:5: note: 'std::isinf' isinf(_Tp __f) ^
I think the proper fix would be to rather than add an #ifdef GCC, to switch to #include <cmath> and replace the function calls by std::foo. I think then it should work with all compilers. Could you give that a try? mfg Tobias
Created attachment 176715 [details] view.cpp patch Patch as requested. Tested successfully with __MAKE_CONF=/dev/null (clang) and lang/gcc5. Note 1: Original source was already including cmath - no change there Note 2: By adding std::, the existing lines become unnecessary #if defined(Q_CC_MINGW) using namespace std; #endif Note 3: The reason clang++ does not need std:: to call isnan/isinf in scope is because LLVM's /usr/include/c++/v1/cmath has "using ::isnan/::isinf" defined as well as namespace std { }. Either patch version will work, I just think my patch would have been easier to maintain than touching view.cpp on so many lines that could get adjusted in future releases and be a headache.
There's an upstream commit that does exactly that, which we could import with probably minimal/to none changes. https://quickgit.kde.org/?p=kmplot.git&a=blobdiff&h=cdb11afe3e2eac73edc2d58c7e07af888334af8b&hp=538e69ceb1bb092d977ddae4e6e7917c3c3316e9&hb=e903ca56ad26311fcaeb650acf96046c726fb809&f=kmplot%2Fview.cpp
(In reply to Tobias C. Berner from comment #8) Perfect!
A commit references this bug: Author: tcberner Date: Tue Nov 8 19:54:16 UTC 2016 New revision: 425760 URL: https://svnweb.freebsd.org/changeset/ports/425760 Log: Fix build with newer gcc versions. Add upstream patch [1] that uses * isnan() -> std::isnan() * isinf() -> std::isinf() This fixes compilation with gcc5. [1] https://quickgit.kde.org/?p=kmplot.git&a=commit&h=e903ca56ad26311fcaeb650acf96046c726fb809 PR: 213993 Reported by: Kenneth Salerno <kennethsalerno@yahoo.com> Approved by: rakuco (mentor) Obtained from: https://quickgit.kde.org/?p=kmplot.git&a=commit&h=e903ca56ad26311fcaeb650acf96046c726fb809 Changes: head/math/kmplot/files/ head/math/kmplot/files/patch-git_e903ca5
Committed, thanks.