Bug 217001 - graphics/gle-graphics: fails to build with lang/gcc6 or later
Summary: graphics/gle-graphics: fails to build with lang/gcc6 or later
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: Raphael Kubo da Costa
URL: https://gcc.gnu.org/gcc-6/porting_to....
Keywords:
Depends on:
Blocks: 219275
  Show dependency treegraph
 
Reported: 2017-02-11 14:55 UTC by Jan Beich
Modified: 2017-08-06 17:54 UTC (History)
3 users (show)

See Also:
nivit: maintainer-feedback+


Attachments
Fix error of narrowing conversion (204 bytes, text/x-chdr)
2017-02-11 17:16 UTC, Nicola Vitale
no flags Details
Fix clang/libc++ and gcc6 errors (4.63 KB, patch)
2017-02-12 00:12 UTC, Jan Beich
no flags Details | Diff
Fix clang/libc++ and gcc6 errors (4.56 KB, patch)
2017-02-12 00:57 UTC, Jan Beich
no flags Details | Diff
Fix clang/libc++ and gcc6 errors (4.63 KB, patch)
2017-02-12 01:06 UTC, Jan Beich
rakuco: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2017-02-11 14:55:19 UTC
op_def.cpp:224:29: error: narrowing conversion of '4278190080u' from 'unsigned int' to 'int' inside { } [-Wnarrowing]
   { "END",  typ_end,  1, 1} };
                             ^

build log: http://sprunge.us/QNSi

clang++ -std=c++11 has a more clear error message:

op_def.cpp:205:29: error: constant expression evaluates to 4278190080 which cannot be narrowed to
      type 'int' [-Wc++11-narrowing]
                { "CLEAR",      typ_switch,     1, GLE_FILL_CLEAR },
                                                   ^~~~~~~~~~~~~~
./color.h:63:25: note: expanded from macro 'GLE_FILL_CLEAR'
#define GLE_FILL_CLEAR  0XFF000000
                        ^~~~~~~~~~
op_def.cpp:205:29: note: insert an explicit cast to silence this issue
                { "CLEAR",      typ_switch,     1, GLE_FILL_CLEAR },
                                                   ^~~~~~~~~~~~~~
                                                   static_cast<int>( )
./color.h:63:25: note: expanded from macro 'GLE_FILL_CLEAR'
#define GLE_FILL_CLEAR  0XFF000000
                        ^~~~~~~~~~
Comment 1 Jan Beich freebsd_committer 2017-02-11 14:58:11 UTC
Either fix it or shove under USE_CXXSTD=gnu++98 carpet but it'd requiring respect of CXXFLAGS.
Comment 2 Nicola Vitale freebsd_committer 2017-02-11 17:16:49 UTC
Created attachment 179878 [details]
Fix error of narrowing conversion
Comment 3 Jan Beich freebsd_committer 2017-02-12 00:10:44 UTC
d_x.cpp: In member function 'void X11GLEDevice::setfillstyle(int)':
d_x.cpp:239:1: error: narrowing conversion of '128' from 'int' to 'char' inside { } [-Wnarrowing]
 };
 ^
d_x.cpp:239:1: error: narrowing conversion of '128' from 'int' to 'char' inside { } [-Wnarrowing]
d_x.cpp:239:1: error: narrowing conversion of '136' from 'int' to 'char' inside { } [-Wnarrowing]
[...]

gcc6 build log: http://sprunge.us/bUhW

clang++ -std=c++11 is more informative:

d_x.cpp:203:10: error: constant expression evaluates to 128 which cannot be narrowed to type 'char'
      [-Wc++11-narrowing]
{  0x00, 0x80, 0x00, 0x40, 0x00, 0x20, 0x00, 0x10, 0x00, 0x08, 0x00, 0x04,
         ^~~~
d_x.cpp:203:10: note: insert an explicit cast to silence this issue
{  0x00, 0x80, 0x00, 0x40, 0x00, 0x20, 0x00, 0x10, 0x00, 0x08, 0x00, 0x04,
         ^~~~
         static_cast<char>( )
d_x.cpp:204:28: error: constant expression evaluates to 128 which cannot be narrowed to type 'char'
      [-Wc++11-narrowing]
   0x00, 0x02, 0x00, 0x01, 0x80, 0x00, 0x40, 0x00, 0x20, 0x00, 0x10, 0x00,
                           ^~~~
d_x.cpp:204:28: note: insert an explicit cast to silence this issue
   0x00, 0x02, 0x00, 0x01, 0x80, 0x00, 0x40, 0x00, 0x20, 0x00, 0x10, 0x00,
                           ^~~~
                           static_cast<char>( )
d_x.cpp:206:16: error: constant expression evaluates to 136 which cannot be narrowed to type 'char'
      [-Wc++11-narrowing]
{  0x11, 0x11, 0x88, 0x88, 0x44, 0x44, 0x22, 0x22, 0x11, 0x11, 0x88, 0x88,
               ^~~~
d_x.cpp:206:16: note: insert an explicit cast to silence this issue
{  0x11, 0x11, 0x88, 0x88, 0x44, 0x44, 0x22, 0x22, 0x11, 0x11, 0x88, 0x88,
               ^~~~
               static_cast<char>( )
[...]
Comment 4 Jan Beich freebsd_committer 2017-02-12 00:12:30 UTC
Created attachment 179889 [details]
Fix clang/libc++ and gcc6 errors

Ironically, with a little more push Clang builds fine: http://sprunge.us/FYLA
Comment 5 Jan Beich freebsd_committer 2017-02-12 00:57:01 UTC
Created attachment 179890 [details]
Fix clang/libc++ and gcc6 errors

Oops, unbreak GCC + libc++ as used by some architectures (sparc64, mips*).

In file included from Tokenizer.h:51:0,
                 from Tokenizer.cpp:47:
StringKeyHash.h:79:18: error: '__gnu_cxx' is not a namespace-name
  using namespace __gnu_cxx;  // using gnu extensions such as "hash"
                  ^~~~~~~~~
StringKeyHash.h:79:27: error: expected namespace-name before ';' token
  using namespace __gnu_cxx;  // using gnu extensions such as "hash"
                           ^
Comment 6 Jan Beich freebsd_committer 2017-02-12 01:06:33 UTC
Created attachment 179891 [details]
Fix clang/libc++ and gcc6 errors

Previous one accidentally broke clang + libc++.
Comment 7 Nicola Vitale freebsd_committer 2017-05-16 09:27:17 UTC
I approve the patch/attachment #179891 [details]. (I set flag + meaning that)
Comment 8 commit-hook freebsd_committer 2017-08-06 17:54:25 UTC
A commit references this bug:

Author: rakuco
Date: Sun Aug  6 17:53:22 UTC 2017
New revision: 447478
URL: https://svnweb.freebsd.org/changeset/ports/447478

Log:
  Fix libc++ and GCC6 build errors.

  This allows us to drop USE_GCC=yes while also allowing it to build with GCC 6,
  which uses -std=gnu++14 by default.

  PR:		217001
  Submitted by:	jbeich
  Approved by:	nivit (maintainer)

Changes:
  head/graphics/gle-graphics/Makefile
  head/graphics/gle-graphics/files/patch-src_gle_d__x.cpp
  head/graphics/gle-graphics/files/patch-src_gle_op__def.h
  head/graphics/gle-graphics/files/patch-src_gle_surface_ffitcontour.cpp
  head/graphics/gle-graphics/files/patch-src_gle_tokens_StringKeyHash.h