Bug 271493

Summary: graphics/freeimage: fix build with clang 16
Product: Ports & Packages Reporter: Dimitry Andric <dim>
Component: Individual Port(s)Assignee: Nuno Teixeira <eduardo>
Status: Closed FIXED    
Severity: Affects Some People Flags: bugzilla: maintainer-feedback? (eduardo)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 271047    
Attachments:
Description Flags
graphics/freeimage: fix build with clang 16 none

Description Dimitry Andric freebsd_committer freebsd_triage 2023-05-18 15:13:40 UTC
Since clang 16 (and gcc 11) the default C++ standard is now gnu++17.
Because graphics/freeimage's Makefile does not explicitly set its C++
standard, this leads to several errors:

  In file included from Source/FreeImage/PluginEXR.cpp:33:
  In file included from Source/FreeImage/../OpenEXR/IlmImf/ImfOutputFile.h:46:
  In file included from Source/OpenEXR/IlmImf/ImfHeader.h:51:
  Source/OpenEXR/Imath/ImathVec.h:228:34: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
      const Vec2 &        normalizeExc () throw (IEX_NAMESPACE::MathExc);
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Source/OpenEXR/Imath/ImathVec.h:228:34: note: use 'noexcept(false)' instead
      const Vec2 &        normalizeExc () throw (IEX_NAMESPACE::MathExc);
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                          noexcept(false)
  Source/OpenEXR/Imath/ImathVec.h:232:37: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
      Vec2<T>             normalizedExc () const throw (IEX_NAMESPACE::MathExc);
                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Source/OpenEXR/Imath/ImathVec.h:232:37: note: use 'noexcept(false)' instead
      Vec2<T>             normalizedExc () const throw (IEX_NAMESPACE::MathExc);
                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                 noexcept(false)

Because these constructs are no longer available in C++17, add
USE_CXXSTD=gnu++14 to compile for C++14 with GNU extensions instead.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-05-18 15:14:09 UTC
Created attachment 242253 [details]
graphics/freeimage: fix build with clang 16
Comment 2 Nuno Teixeira freebsd_committer freebsd_triage 2023-05-18 19:35:30 UTC
(In reply to Dimitry Andric from comment #1)

Hello Dimitry,

I think you can commit it under fix build blanket.
Anyway I will test it this weekend.

Thanks
Comment 3 commit-hook freebsd_committer freebsd_triage 2023-05-18 21:37:38 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6a58ef80a134804463b7f9de82503bdb681b46c1

commit 6a58ef80a134804463b7f9de82503bdb681b46c1
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-05-18 15:08:08 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-05-18 21:35:52 +0000

    graphics/freeimage: fix build with clang 16

    Since clang 16 (and gcc 11) the default C++ standard is now gnu++17.
    Because graphics/freeimage's Makefile does not explicitly set its C++
    standard, this leads to several errors:

      In file included from Source/FreeImage/PluginEXR.cpp:33:
      In file included from Source/FreeImage/../OpenEXR/IlmImf/ImfOutputFile.h:46:
      In file included from Source/OpenEXR/IlmImf/ImfHeader.h:51:
      Source/OpenEXR/Imath/ImathVec.h:228:34: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
          const Vec2 &        normalizeExc () throw (IEX_NAMESPACE::MathExc);
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Source/OpenEXR/Imath/ImathVec.h:228:34: note: use 'noexcept(false)' instead
          const Vec2 &        normalizeExc () throw (IEX_NAMESPACE::MathExc);
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                              noexcept(false)
      Source/OpenEXR/Imath/ImathVec.h:232:37: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
          Vec2<T>             normalizedExc () const throw (IEX_NAMESPACE::MathExc);
                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Source/OpenEXR/Imath/ImathVec.h:232:37: note: use 'noexcept(false)' instead
          Vec2<T>             normalizedExc () const throw (IEX_NAMESPACE::MathExc);
                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                     noexcept(false)

    Because these constructs are no longer available in C++17, add
    USE_CXXSTD=gnu++14 to compile for C++14 with GNU extensions instead.

    PR:             271493
    Approved by:    portmgr (build fix blanket)
    MFH:            2023Q2

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