Bug 213993 - math/kmplot: fix for lang/gcc5
Summary: math/kmplot: fix for lang/gcc5
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: kde
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-01 20:10 UTC by Kenneth Salerno
Modified: 2016-11-08 19:56 UTC (History)
2 users (show)

See Also:


Attachments
Fix for lang/gcc5 (400 bytes, patch)
2016-11-01 20:10 UTC, Kenneth Salerno
no flags Details | Diff
Fix for lang/gcc5 (375 bytes, patch)
2016-11-02 11:38 UTC, Kenneth Salerno
no flags Details | Diff
view.cpp patch (851 bytes, patch)
2016-11-07 11:25 UTC, Kenneth Salerno
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Salerno 2016-11-01 20:10:56 UTC
Created attachment 176392 [details]
Fix for lang/gcc5
Comment 1 Kenneth Salerno 2016-11-02 11:38:09 UTC
Created attachment 176421 [details]
Fix for lang/gcc5

Removed test for __GNUC_MINOR__
Comment 2 Tobias C. Berner freebsd_committer 2016-11-02 12:23:52 UTC
Please include the error message into bug reports.  Or at least specify what the patches are trying to fix.

mfg Tobias
Comment 3 Kenneth Salerno 2016-11-02 13:25:29 UTC
(In reply to Tobias C. Berner from comment #2)
lang/gcc5's cmath requires scope std:: to access isnan, isinf
Comment 4 Tobias C. Berner freebsd_committer 2016-11-02 13:59:04 UTC
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.
Comment 5 Kenneth Salerno 2016-11-02 15:21:44 UTC
(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)
     ^
Comment 6 Tobias C. Berner freebsd_committer 2016-11-03 08:36:37 UTC
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
Comment 7 Kenneth Salerno 2016-11-07 11:25:41 UTC
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.
Comment 8 Tobias C. Berner freebsd_committer 2016-11-07 11:32:31 UTC
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
Comment 9 Kenneth Salerno 2016-11-07 13:26:44 UTC
(In reply to Tobias C. Berner from comment #8)
Perfect!
Comment 10 commit-hook freebsd_committer 2016-11-08 19:54:40 UTC
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
Comment 11 Tobias C. Berner freebsd_committer 2016-11-08 19:56:41 UTC
Committed, thanks.