Created attachment 235740 [details] Store attachment as "files/patch-src_java.desktop_share_native_libharfbuzz_hb-ot-layout-gpos-table.hh" On -CURRENT building openjdk11 fails with warnings treated as errors, e.g: > * For target support_native_java.desktop_libfontmanager_hb-ot-shape-fallback.o: > In file included from src/java.desktop/share/native/libharfbuzz/hb-ot-shape-fallback.cc:32: > 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 > 2 errors generated. The sources contain a comment: /* Note the intentional use of "|" instead of short-circuit "||". */ above line 1131 and 1417. Casting one operand to int (as suggested in the warning text) does fix the issue (see attached patch). A similar issue might exist in other openjdk ports when built on -CURRENT (not tested).
The patch proposed here worked flawlessly for me on a: 13.1-STABLE FreeBSD 13.1-STABLE #35 stable/13-n251972-fb8e858c69f: Thu Jul 28 10:03:51 CEST 2022 Thank you.
This bug also crops up with recent version of 13-STABLE.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=3d41392b6e049ff56d2abf91749a82573eb3198d commit 3d41392b6e049ff56d2abf91749a82573eb3198d Author: Stefan Eßer <se@FreeBSD.org> AuthorDate: 2022-08-28 14:40:46 +0000 Commit: Stefan Eßer <se@FreeBSD.org> CommitDate: 2022-08-28 14:54:31 +0000 java/openjdk11: fix build on 13.1 and -CURRENT Recent LLVM versions issue warnings for "|" being used with boolean operands. Such operations exist in OpenJDK and the source lines are marked with comments to not use logical operations instead. 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. Fix this issue by casting one of the boolean operands to int, as suggested by the compiler in the error message for the case that the "|" operation should actually be used on purpose. I had submitted this patch as an attachment to PR 265687 on 2022-08-07, but it has been ignored by the maintainer (java team). PR: 265687 Approved by: portmgr (implicit) ...tive_libharfbuzz_hb-ot-layout-gpos-table.hh (new) | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
Fixed? Close this?