Bug 265521 - graphics/png: fix build with clang 15
Summary: graphics/png: fix build with clang 15
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Dimitry Andric
URL:
Keywords:
Depends on:
Blocks: 265425
  Show dependency treegraph
 
Reported: 2022-07-30 16:39 UTC by Dimitry Andric
Modified: 2022-07-31 17:19 UTC (History)
0 users

See Also:
antoine: maintainer-feedback+


Attachments
graphics/png: fix build with clang 15 (1.13 KB, patch)
2022-07-30 16:40 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 2022-07-30 16:39:39 UTC
During an exp-run for llvm 15 (see bug 265425), it turned out that graphics/png  fails to build with clang 15, with an error:

    contrib/libtests/pngvalid.c:11662:4: error: call to undeclared function 'feenableexcept'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
       feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
       ^

This is because clang 15 introduced this new warning, and fenv.h only declares feenableexcept() when compiling for C standards before C11.

The least disruptive way to solve this is to make the port build with USE_CSTD=gnu89.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2022-07-30 16:40:06 UTC
Created attachment 235561 [details]
graphics/png: fix build with clang 15
Comment 2 Antoine Brodin freebsd_committer freebsd_triage 2022-07-30 19:48:23 UTC
Approved
Comment 3 commit-hook freebsd_committer freebsd_triage 2022-07-31 17:15:16 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4ba3797c9993a25a082ed767d4f44234b1f7dc04

commit 4ba3797c9993a25a082ed767d4f44234b1f7dc04
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-07-30 16:37:48 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-07-31 17:12:11 +0000

    graphics/png: fix build with clang 15

    Building png with clang 15 results in an error:

        contrib/libtests/pngvalid.c:11662:4: error: call to undeclared function 'feenableexcept'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
           feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
           ^

    This is because clang 15 introduced this new warning, and fenv.h only
    declares feenableexcept() when compiling for C standards before C11.

    The least disruptive way to solve this is to make the port build with
    USE_CSTD=gnu89.

    PR:             265521
    Approved by:    portmgr (antoine)
    MFH:            2022Q3

 graphics/png/Makefile | 1 +
 1 file changed, 1 insertion(+)