[Bug 262634] graphics/libavif: Fix build with clang 14

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 17 Mar 2022 21:07:45 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262634

            Bug ID: 262634
           Summary: graphics/libavif: Fix build with clang 14
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: jbeich@FreeBSD.org
          Reporter: dim@FreeBSD.org
          Assignee: jbeich@FreeBSD.org
             Flags: maintainer-feedback?(jbeich@FreeBSD.org)

During an exp-run for llvm 14 (see bug 261742), it turned out that
graphics/libavif fails to build with clang 14:

/wrkdirs/usr/ports/graphics/libavif/work/libavif-0.9.3/src/alpha.c:227:35:
error: mixing declarations and code is incompatible with standards before C99
[-Werror,-Wdeclaration-after-statement]
                            float alphaF = (float)srcAlpha / srcMaxChannelF;
                                  ^
/wrkdirs/usr/ports/graphics/libavif/work/libavif-0.9.3/src/alpha.c:242:35:
error: mixing declarations and code is incompatible with standards before C99
[-Werror,-Wdeclaration-after-statement]
                            float alphaF = (float)srcAlpha / srcMaxChannelF;
                                  ^
/wrkdirs/usr/ports/graphics/libavif/work/libavif-0.9.3/src/alpha.c:258:31:
error: mixing declarations and code is incompatible with standards before C99
[-Werror,-Wdeclaration-after-statement]
                        float alphaF = (float)srcAlpha / srcMaxChannelF;
                              ^
/wrkdirs/usr/ports/graphics/libavif/work/libavif-0.9.3/src/alpha.c:335:35:
error: mixing declarations and code is incompatible with standards before C99
[-Werror,-Wdeclaration-after-statement]
                            float alphaF = (float)srcAlpha / srcMaxChannelF;
                                  ^
/wrkdirs/usr/ports/graphics/libavif/work/libavif-0.9.3/src/alpha.c:351:35:
error: mixing declarations and code is incompatible with standards before C99
[-Werror,-Wdeclaration-after-statement]
                            float alphaF = (float)srcAlpha / srcMaxChannelF;
                                  ^
/wrkdirs/usr/ports/graphics/libavif/work/libavif-0.9.3/src/alpha.c:368:31:
error: mixing declarations and code is incompatible with standards before C99
[-Werror,-Wdeclaration-after-statement]
                        float alphaF = (float)srcAlpha / srcMaxChannelF;
                              ^
/wrkdirs/usr/ports/graphics/libavif/work/libavif-0.9.3/src/alpha.c:397:16:
error: mixing declarations and code is incompatible with standards before C99
[-Werror,-Wdeclaration-after-statement]
    avifResult libyuvResult = avifRGBImagePremultiplyAlphaLibYUV(rgb);
               ^
/wrkdirs/usr/ports/graphics/libavif/work/libavif-0.9.3/src/alpha.c:508:16:
error: mixing declarations and code is incompatible with standards before C99
[-Werror,-Wdeclaration-after-statement]
    avifResult libyuvResult = avifRGBImageUnpremultiplyAlphaLibYUV(rgb);
               ^
8 errors generated.

This is because libavif foolishly uses -Weverything, and thus has to chase
every new warning introduced by newer compiler versions. I submitted
https://github.com/AOMediaCodec/libavif/pull/886 upstream to fix this, and
added the corresponding patch to the port.

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