Bug 271422 - graphics/libcdr01: fix build with clang 16
Summary: graphics/libcdr01: fix build with clang 16
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: Dimitry Andric
URL:
Keywords:
Depends on:
Blocks: 271047
  Show dependency treegraph
 
Reported: 2023-05-14 18:11 UTC by Dimitry Andric
Modified: 2023-05-14 19:35 UTC (History)
0 users

See Also:
sunpoet: maintainer-feedback+


Attachments
graphics/libcdr01: fix build with clang 16 (3.48 KB, patch)
2023-05-14 18:12 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2023-05-14 18:11:39 UTC
Since clang 16 (and gcc 11) the default C++ standard is now gnu++17.
Because graphics/libcdr01's configure scripts and Makefiles do not
explicitly set the C++ standard, this leads to several errors:

  In file included from CDRDocument.cpp:15:
  In file included from ./CDRContentCollector.h:26:
  In file included from ./CDRCollector.h:20:
  /usr/local/include/lcms2.h:1291:44: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  typedef cmsInt32Number (* cmsSAMPLER16)   (CMSREGISTER const cmsUInt16Number In[],
                                             ^~~~~~~~~~~~
  /usr/local/include/lcms2.h:158:23: note: expanded from macro 'CMSREGISTER'
  #  define CMSREGISTER register
                        ^
  /usr/local/include/lcms2.h:1292:44: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
                                             CMSREGISTER cmsUInt16Number Out[],
                                             ^~~~~~~~~~~~
  /usr/local/include/lcms2.h:158:23: note: expanded from macro 'CMSREGISTER'
  #  define CMSREGISTER register
                        ^
  /usr/local/include/lcms2.h:1293:44: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
                                             CMSREGISTER void * Cargo);
                                             ^~~~~~~~~~~~
  /usr/local/include/lcms2.h:158:23: note: expanded from macro 'CMSREGISTER'
  #  define CMSREGISTER register
                        ^
  /usr/local/include/lcms2.h:1295:44: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
  typedef cmsInt32Number (* cmsSAMPLERFLOAT)(CMSREGISTER const cmsFloat32Number In[],
                                             ^~~~~~~~~~~~
  /usr/local/include/lcms2.h:158:23: note: expanded from macro 'CMSREGISTER'
  #  define CMSREGISTER register
                        ^
  /usr/local/include/lcms2.h:1296:44: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
                                             CMSREGISTER cmsFloat32Number Out[],
                                             ^~~~~~~~~~~~
  /usr/local/include/lcms2.h:158:23: note: expanded from macro 'CMSREGISTER'
  #  define CMSREGISTER register
                        ^
  /usr/local/include/lcms2.h:1297:44: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
                                             CMSREGISTER void * Cargo);
                                             ^~~~~~~~~~~~
  /usr/local/include/lcms2.h:158:23: note: expanded from macro 'CMSREGISTER'
  #  define CMSREGISTER register
                        ^

Add -DCMS_NO_REGISTER_KEYWORD to CPPFLAGS, to avoid lcms2.h using
register keywords in its declarations.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-05-14 18:12:12 UTC
Created attachment 242173 [details]
graphics/libcdr01: fix build with clang 16
Comment 2 Po-Chuan Hsieh freebsd_committer freebsd_triage 2023-05-14 19:06:14 UTC
LGTM. Thanks!
Comment 3 commit-hook freebsd_committer freebsd_triage 2023-05-14 19:30:06 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2ab36e0a74646c14200ab83a34670fd495ea7f51

commit 2ab36e0a74646c14200ab83a34670fd495ea7f51
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-05-14 18:08:21 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-05-14 19:28:24 +0000

    graphics/libcdr01: fix build with clang 16

    Since clang 16 (and gcc 11) the default C++ standard is now gnu++17.
    Because graphics/libcdr01's configure scripts and Makefiles do not
    explicitly set the C++ standard, this leads to several errors:

      In file included from CDRDocument.cpp:15:
      In file included from ./CDRContentCollector.h:26:
      In file included from ./CDRCollector.h:20:
      /usr/local/include/lcms2.h:1291:44: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
      typedef cmsInt32Number (* cmsSAMPLER16)   (CMSREGISTER const cmsUInt16Number In[],
                                                 ^~~~~~~~~~~~
      /usr/local/include/lcms2.h:158:23: note: expanded from macro 'CMSREGISTER'
      #  define CMSREGISTER register
                            ^
      /usr/local/include/lcms2.h:1292:44: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
                                                 CMSREGISTER cmsUInt16Number Out[],
                                                 ^~~~~~~~~~~~
      /usr/local/include/lcms2.h:158:23: note: expanded from macro 'CMSREGISTER'
      #  define CMSREGISTER register
                            ^
      /usr/local/include/lcms2.h:1293:44: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
                                                 CMSREGISTER void * Cargo);
                                                 ^~~~~~~~~~~~
      /usr/local/include/lcms2.h:158:23: note: expanded from macro 'CMSREGISTER'
      #  define CMSREGISTER register
                            ^
      /usr/local/include/lcms2.h:1295:44: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
      typedef cmsInt32Number (* cmsSAMPLERFLOAT)(CMSREGISTER const cmsFloat32Number In[],
                                                 ^~~~~~~~~~~~
      /usr/local/include/lcms2.h:158:23: note: expanded from macro 'CMSREGISTER'
      #  define CMSREGISTER register
                            ^
      /usr/local/include/lcms2.h:1296:44: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
                                                 CMSREGISTER cmsFloat32Number Out[],
                                                 ^~~~~~~~~~~~
      /usr/local/include/lcms2.h:158:23: note: expanded from macro 'CMSREGISTER'
      #  define CMSREGISTER register
                            ^
      /usr/local/include/lcms2.h:1297:44: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
                                                 CMSREGISTER void * Cargo);
                                                 ^~~~~~~~~~~~
      /usr/local/include/lcms2.h:158:23: note: expanded from macro 'CMSREGISTER'
      #  define CMSREGISTER register
                            ^

    Add -DCMS_NO_REGISTER_KEYWORD to CPPFLAGS, to avoid lcms2.h using
    register keywords in its declarations.

    PR:             271422
    Approved by:    sunpoet (maintainer)
    MFH:            2023Q2

 graphics/libcdr01/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)