[Bug 265687] openjdk11 fails due to -Wbitwise-instead-of-logical

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 07 Aug 2022 11:54:08 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265687

            Bug ID: 265687
           Summary: openjdk11 fails due to -Wbitwise-instead-of-logical
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: se@FreeBSD.org

Created attachment 235740
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=235740&action=edit
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).

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