Bug 208842

Summary: games/kuklomenos: Fix build with libc++ 3.8.0
Product: Ports & Packages Reporter: Dimitry Andric <dim>
Component: Individual Port(s)Assignee: Kurt Jaeger <pi>
Status: Closed FIXED    
Severity: Affects Some People CC: pi
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 208158    
Attachments:
Description Flags
Fix argument type for max() in games/kuklomenos
none
Fix argument type for max() in games/kuklomenos none

Description Dimitry Andric freebsd_committer 2016-04-16 20:27:36 UTC
Created attachment 169379 [details]
Fix argument type for max() in games/kuklomenos

During the exp-run in bug 208158, it was found that games/kuklomenos gives errors with libc++ 3.8.0 [1]:

node.cc:178:7: error: no matching function for call to 'max'
                    std::max(0.0, 1 - ( fabs(angleDiff(spin*3, 0)) * 2 )) );
                    ^~~~~~~~

This is because max() is being called with two arguments of different type (double and float).  Fix this by using 0.0f instead.

[1] http://package18.nyi.freebsd.org/data/headamd64PR208158-default/2016-03-22_18h30m05s/logs/errors/kuklomenos-0.4.5_4.log
Comment 1 Kurt Jaeger freebsd_committer 2016-04-18 05:44:41 UTC
Testbuilds on 11a, 10.3a+i, 9.3a all fail because std::max is not known ?

Did I miss something ?
Comment 2 Dimitry Andric freebsd_committer 2016-04-18 16:42:02 UTC
Created attachment 169442 [details]
Fix argument type for max() in games/kuklomenos

Right, I didn't realize that for earlier versions of libc++, the fabs() prototype is such that it always returns double.  In that case, the std::max invocation will still be with differently typed arguments, causing complaints.

I now replaced the fabs() call with fabsf(), so now both arguments to std::max are *really* floats.
Comment 3 Kurt Jaeger freebsd_committer 2016-04-18 16:52:42 UTC
Committed, thanks!
Comment 4 commit-hook freebsd_committer 2016-04-18 16:52:52 UTC
A commit references this bug:

Author: pi
Date: Mon Apr 18 16:52:26 UTC 2016
New revision: 413588
URL: https://svnweb.freebsd.org/changeset/ports/413588

Log:
  games/kuklomenos: Fix build with libc++ 3.8.0

  PR:		208842
  Submitted by:	dim

Changes:
  head/games/kuklomenos/files/
  head/games/kuklomenos/files/patch-node.cc