Re: git: 3d41392b6e04 - main - java/openjdk11: fix build on 13.1 and -CURRENT

From: Stefan_Eßer <se_at_freebsd.org>
Date: Sun, 28 Aug 2022 17:37:22 UTC
Am 28.08.22 um 18:47 schrieb Christoph Moench-Tegeder:
> ## Stefan Eßer (se@FreeBSD.org):
> 
>>      This breaks the build on 13.1 and -CURRENT when building with LLVM-13
>>      or newer due to the -Werror option being passed to the compiler.
> 
> Is there a log of a failing build? openjdk11 built perfectly fine here,
> like:
>    =>> Building java/openjdk11
>    build started at Sat Aug 27 19:22:58 CEST 2022
>    Poudriere version: 3.3.7_1
>    Host OSVERSION: 1301000
>    Jail OSVERSION: 1301000
>    * C Compiler:     Version 13.0.0 (at /usr/bin/cc)
>    * C++ Compiler:   Version 13.0.0 (at /usr/bin/c++)
> 
> and that's before your fix.

Immediately before the commit I have tested whether the fix was still
required on -CURRENT:

In file included from 
src/java.desktop/share/native/libharfbuzz/hb-aat-layout.cc:35:
In file included from 
/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-kerx-table.hh:31:
In file included from src/java.desktop/share/native/libharfbuzz/hb-kern.hh:32:
src/java.desktop/share/native/libharfbuzz/hb-ot-layout-gpos-table.hh:1131:11: 
error: use of bitwise '|' with boolean operands 
[-Werror,-Wbitwise-instead-of-logical]
       if (valueFormats[0].apply_value (c, this, &record->values[0], 
buffer->cur_pos()) |
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    ||
src/java.desktop/share/native/libharfbuzz/hb-ot-layout-gpos-table.hh:1131:11: 
note: cast one or both operands to int to silence this warning

src/java.desktop/share/native/libharfbuzz/hb-ot-layout-gpos-table.hh:1417:9: 
error: use of bitwise '|' with boolean operands 
[-Werror,-Wbitwise-instead-of-logical]
     if (valueFormat1.apply_value (c, this, v, buffer->cur_pos()) |
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                  ||
src/java.desktop/share/native/libharfbuzz/hb-ot-layout-gpos-table.hh:1417:9: 
note: cast one or both operands to int to silence this warning

(Slightly redacted for readability)

Since these operations are included into multiple source files, the error is
reported for more C++ source files.

See also comment 1 and 2 in

	https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265687

The compilation would have failed for any system that uses LLVM-13 or later
and -Werror -Wbitwise-instead-of-logical to build this port.