[Bug 209742] devel/godot: Update to 2.0.4.1; add devel/godot-tools port

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Jul 15 21:31:34 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209742

lightside <lightside at gmx.com> changed:

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

--- Comment #54 from lightside <lightside at gmx.com> ---
Created attachment 172566
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=172566&action=edit
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) = 1; check_abs(44100, 44200) = 0
check(44200, 44200) = 0; check_abs(44200, 44200) = 0
check(44300, 44200) = 0; check_abs(44300, 44200) = 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/stdlib.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 >= 0 ? __x : -__x; }
   ^~~
/usr/local/lib/gcc6/include/c++/cstdlib:180:3: note: candidate: long long int
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 = 44200;
        for (int i = 44100; i <= 44300; i += 100)
                printf("check(%d, %d) = %d; check_abs(%d, %d) = %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) = 1; check_abs(44100, 44200) = 0
check(44200, 44200) = 0; check_abs(44200, 44200) = 0
check(44300, 44200) = 0; check_abs(44300, 44200) = 0
-->8-

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

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


More information about the freebsd-ports-bugs mailing list