[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: [OpenJDK 2D-Dev] Fwd: [PATCH] Fix compiler warnings with newer GCC 7.2.1
From:       Chris Plummer <chris.plummer () oracle ! com>
Date:       2018-02-06 20:56:00
Message-ID: 8eefd33c-91bf-c2f6-69be-a41dd9cc5bda () oracle ! com
[Download RAW message or body]

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">I filed
      <a class="moz-txt-link-freetext" \
href="https://bugs.openjdk.java.net/browse/JDK-8196909">https://bugs.openjdk.java.net/browse/JDK-8196909</a>. \
I will get the  fix into JDK 11.<br>
      <br>
      Chris<br>
      <br>
      On 2/6/18 12:06 PM, Chris Plummer wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:73005887-dd65-f81e-6b86-7806d4813a69@oracle.com">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <div class="moz-cite-prefix">The libdt_socket fix looks fine to
        me. Is there a bug filed for this? Do you plan on contributing
        the fix yourself and submitting a webrev for official review?<br>
        <br>
        thanks,<br>
        <br>
        Chris<br>
        <br>
        On 2/6/18 11:00 AM, Indu Bhagat wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:5eb1e208-bf8c-ec7e-2a75-3afc594e81d3@oracle.com">
        <meta content="text/html; charset=utf-8"
          http-equiv="Content-Type">
        <p>Thanks. harfbuzz is now fixed upstream. libjpeg has
          acknowledged the patch for shift-negative-value warnings.</p>
        <p>Can someone advise on the minor fix in libdt_socket component
          ?<br>
        </p>
        <br>
        <div class="moz-cite-prefix">On 02/03/2018 05:47 AM, Philip Race
          wrote:<br>
        </div>
        <blockquote cite="mid:5A75BD5F.5080309@oracle.com" type="cite">
          <meta content="text/html; charset=utf-8"
            http-equiv="Content-Type">
          jpeg + harfbuzz are imported libraries. There's no point in a
          source fix in JDK'scopy as<br>
          it will get overwritten when we upgrade. No way we are
          tracking such patches to reapply them.<br>
          <br>
          If warnings there are an issue either update the makefiles or
          use disable-warnings-as-errors<br>
          ... and perhaps report the issue upstream ..<br>
          <br>
          -phil.<br>
          <br>
          On 2/3/18, 1:35 AM, Alan Bateman wrote:
          <blockquote
            cite="mid:4c5248f3-e78d-31ba-c892-fd7df1d027af@oracle.com"
            type="cite">
            <meta http-equiv="content-type" content="text/html;
              charset=utf-8">
            <br>
            This was sent to core-libs-dev, I assume it was meant for
            2d-dev and serviceability-dev.<br>
            <div class="moz-forward-container"><br>
              -------- Forwarded Message --------
              <table class="moz-email-headers-table" border="0"
                cellspacing="0" cellpadding="0">
                <tbody>
                  <tr>
                    <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Subject:
                    </th>
                    <td>[PATCH] Fix compiler warnings with newer GCC
                      7.2.1</td>
                  </tr>
                  <tr>
                    <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Date:
                    </th>
                    <td>Fri, 2 Feb 2018 16:12:08 -0800</td>
                  </tr>
                  <tr>
                    <th align="RIGHT" nowrap="nowrap" valign="BASELINE">From:
                    </th>
                    <td>Indu Bhagat <a moz-do-not-send="true"
                        class="moz-txt-link-rfc2396E"
                        \
href="mailto:indu.bhagat@oracle.com">&lt;indu.bhagat@oracle.com&gt;</a></td>  </tr>
                  <tr>
                    <th align="RIGHT" nowrap="nowrap" valign="BASELINE">To:
                    </th>
                    <td><a moz-do-not-send="true"
                        class="moz-txt-link-abbreviated"
                        \
href="mailto:core-libs-dev@openjdk.java.net">core-libs-dev@openjdk.java.net</a></td>  \
</tr>  </tbody>
              </table>
              <br>
              <br>
              <pre>This patch fixes a few of the compiler warnings when using gcc \
7.2.1.

In general there are many other warnings (a majority of which are implicit \
fallthrough warnings in jdk.crypto.ec package's ecp_*.c files and java.desktop \
package's splashscreen_gfx_impl.h file). I can post them if there is interest.
Most warnings, however, look benign (modulo some warnings about unintialized access \
that I cannot comment on; they need that the code be thoroughly understood). \
libfdlibm misleading indentation warnings are already \
knownhttp://mail.openjdk.java.net/pipermail/jdk9-dev/2016-June/004494.html

Thanks

----------------------------------------------
The patch fixes the following warnings :

1. &lt;jdk-dev&gt;/jdk/src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c: \
In function ‘mask_s2u':  \
&lt;jdk-dev&gt;/jdk/src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c:389:22: \
                warning: left shift of negative value [-Wshift-negative-value]
     *mask = htonl(-1 &lt;&lt; (32 - m));
                      ^
2. &lt;jdk-dev&gt;/jdk/src/java.desktop/share/native/libjavajpeg/jdphuff.c: In \
function ‘decode_mcu_AC_refine':  \
&lt;jdk-dev&gt;/jdk/src/java.desktop/share/native/libjavajpeg/jdphuff.c:505:17: \
warning: left shift of negative value [-Wshift-negative-value]  int m1 = (-1) \
&lt;&lt; cinfo-&gt;Al;   /* -1 in the bit position being coded*/  ^~
3. &lt;jdk-dev&gt;/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback.cc: \
In function ‘void position_mark(const hb_ot_shape_plan_t*, hb_font_t*, \
hb_buffer_t*, hb_glyph_extents_t&amp;, unsigned int, unsigned int)':  \
&lt;jdk-dev&gt;/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback.cc:223:14: \
warning: this statement may fall through [-Wimplicit-fallthrough=]  } else if \
(buffer-&gt;props.direction == HB_DIRECTION_RTL) {  ^~
   &lt;jdk-dev&gt;/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback.cc:229:5: \
note: here  default:
     ^~~~~~~
   &lt;jdk-dev&gt;/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback.cc:261:27: \
warning: this statement may fall through [-Wimplicit-fallthrough=]  \
base_extents.height -= y_gap;  ~~~~~~~~~~~~~~~~~~~~^~~~~~~~
   &lt;jdk-dev&gt;/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback.cc:264:5: \
note: here  case HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW_LEFT:
     ^~~~
   &lt;jdk-dev&gt;/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback.cc:282:27: \
warning: this statement may fall through [-Wimplicit-fallthrough=]  \
base_extents.height -= y_gap;  ~~~~~~~~~~~~~~~~~~~~^~~~~~~~
   &lt;jdk-dev&gt;/jdk/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-shape-fallback.cc:285:5: \
note: here  case HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE:
     ^~~~
-----------

diff --git a/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-private.hh \
                b/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-private.hh
--- a/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-private.hh
+++ b/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-private.hh
@@ -158,6 +158,9 @@
     */
 #  include &lt;sal.h&gt;
 #  define HB_FALLTHROUGH __fallthrough
+#elif __GNUC__ &gt;= 7
+   /* GNU fallthrough attribute is available from GCC7 */
+#  define HB_FALLTHROUGH __attribute__((fallthrough))
 #else
 #  define HB_FALLTHROUGH /* FALLTHROUGH */
 #endif
diff --git a/src/java.desktop/share/native/libjavajpeg/jdphuff.c \
                b/src/java.desktop/share/native/libjavajpeg/jdphuff.c
--- a/src/java.desktop/share/native/libjavajpeg/jdphuff.c
+++ b/src/java.desktop/share/native/libjavajpeg/jdphuff.c
@@ -501,8 +501,10 @@
 {
   phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo-&gt;entropy;
   int Se = cinfo-&gt;Se;
-  int p1 = 1 &lt;&lt; cinfo-&gt;Al;      /* 1 in the bit position being coded */
-  int m1 = (-1) &lt;&lt; cinfo-&gt;Al;   /* -1 in the bit position being coded */
+  /* 1 in the bit position being coded */
+  int p1 = 1 &lt;&lt; cinfo-&gt;Al;
+  /* -1 in the bit position being coded */
+  int m1 = (int)((unsigned)(~0) &lt;&lt; cinfo-&gt;Al);
   register int s, k, r;
   unsigned int EOBRUN;
   JBLOCKROW block;
diff --git a/src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c \
                b/src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c
--- a/src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c
+++ b/src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c
@@ -386,7 +386,7 @@
        return instr;
     }
 
-    *mask = htonl(-1 &lt;&lt; (32 - m));
+    *mask = htonl((uint32_t)(~0) &lt;&lt; (32 - m));
     return s;
 }
 

</pre>
            </div>
          </blockquote>
        </blockquote>
        <br>
      </blockquote>
      <p><br>
      </p>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic