Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jul 2016 21:31:34 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 209742] devel/godot: Update to 2.0.4.1; add devel/godot-tools port
Message-ID:  <bug-209742-13-VMsScERKnn@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-209742-13@https.bugs.freebsd.org/bugzilla/>
References:  <bug-209742-13@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D209742

lightside <lightside@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #172374|0                           |1
        is obsolete|                            |
 Attachment #172566|                            |maintainer-approval?(FreeBS
              Flags|                            |D@ShaneWare.Biz)

--- Comment #54 from lightside <lightside@gmx.com> ---
Created attachment 172566
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D172566&action=
=3Dedit
Proposed patch (since 415742 revision)

Even GCC 4.8.5 from current lang/gcc port doesn't give such suggestions as
Clang 3.8:
-8<--
% g++48 -Wall -Wextra test.cpp -o test_g++48 && ./test_g++48
check(44100, 44200) =3D 1; check_abs(44100, 44200) =3D 0
check(44200, 44200) =3D 0; check_abs(44200, 44200) =3D 0
check(44300, 44200) =3D 0; check_abs(44300, 44200) =3D 0
-->8-
But GCC 6.1.0 from current lang/gcc6 port gives following error:
-8<--
% g++6 -Wall -Wextra test.cpp -o test_g++6 && ./test_g++6
test.cpp: In function 'int check_abs(int, unsigned int)':
test.cpp:11:18: error: call of overloaded 'abs(unsigned int)' is ambiguous
  return abs(a - b) > 100;
                  ^
In file included from /usr/local/lib/gcc6/include/c++/cstdlib:75:0,
                 from /usr/local/lib/gcc6/include/c++/stdlib.h:36,
                 from test.cpp:2:
/usr/local/lib/gcc6/gcc/x86_64-portbld-freebsd10.2/6.1.0/include-fixed/stdl=
ib.h:100:6:
note: candidate: int abs(int)
 int  abs(int) __pure2;
      ^~~
In file included from /usr/local/lib/gcc6/include/c++/stdlib.h:36:0,
                 from test.cpp:2:
/usr/local/lib/gcc6/include/c++/cstdlib:185:3: note: candidate: __int128
std::abs(__int128)
   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >=3D 0 ? __x : -__x; }
   ^~~
/usr/local/lib/gcc6/include/c++/cstdlib:180:3: note: candidate: long long i=
nt
std::abs(long long int)
   abs(long long __x) { return __builtin_llabs (__x); }
   ^~~
/usr/local/lib/gcc6/include/c++/cstdlib:172:3: note: candidate: long int
std::abs(long int)
   abs(long __i) { return __builtin_labs(__i); }
   ^~~
-->8-
Therefore, the fix might be "abs(a - (int)b) > 100":
-8<--
#include <stdio.h>
#include <stdlib.h>

int check(int a, unsigned int b)
{
        return (a - b) > 100;
}

int check_abs(int a, unsigned int b)
{
        return abs(a - (int)b) > 100;
}

int main()
{
        unsigned int c =3D 44200;
        for (int i =3D 44100; i <=3D 44300; i +=3D 100)
                printf("check(%d, %d) =3D %d; check_abs(%d, %d) =3D %d\n", =
i, c,
check(i, c), i, c, check_abs(i, c));

        return 0;
}
-->8-
-8<--
% g++6 -Wall -Wextra test2.cpp -o test2_g++6 && ./test2_g++6
check(44100, 44200) =3D 1; check_abs(44100, 44200) =3D 0
check(44200, 44200) =3D 0; check_abs(44200, 44200) =3D 0
check(44300, 44200) =3D 0; check_abs(44300, 44200) =3D 0
-->8-

while the implementation of "-Wabsolute-value" in Clang (3.6, 3.7 and) 3.8 =
is
questionable (about exact suggestions).

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-209742-13-VMsScERKnn>