Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8263833

Stop disabling warnings for sunFont.c with gcc

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 17
    • None
    • client-libs
    • None
    • 2d
    • b15

    Description

      In Awt2dLibraries.gmk we have
      ifeq ($(TOOLCHAIN_TYPE), gcc)
        # Turn off all warnings for sunFont.c. This is needed because the specific warning
        # about discarding 'const' qualifier cannot be turned off individually.
        BUILD_LIBFONTMANAGER_sunFont.c_CFLAGS := -w
      endif

      It appears this was done over 5 years ago in JDK 9 days

      https://mail.openjdk.java.net/pipermail/build-dev/2016-February/016535.html
      https://bugs.openjdk.java.net/browse/JDK-8148629

      The logic disables it for GCC but the bug report only has a log of a warning for this with the Solaris compiler and the bug report says it is about Solaris

      However the linked bug https://bugs.openjdk.java.net/browse/JDK-8079977
      shows the error and the claim it can't be disabled :
      We get rid of all warnings but one, which cannot be silenced:
      /localhome/hg/jdk9-dev-ALT/jdk/src/java.desktop/share/native/libfontmanager/sunFont.c: In function 'freeLayoutTableCache':
      /localhome/hg/jdk9-dev-ALT/jdk/src/java.desktop/share/native/libfontmanager/sunFont.c:361:37: error: passing argument 1 of 'free' discards 'const' qualifier from pointer target type [-Werror]
             if(ltc->entries[i].ptr) free (ltc->entries[i].ptr);


      However the code that causes this was removed well over a year ago :
      https://bugs.openjdk.java.net/browse/JDK-8220231
      http://mail.openjdk.java.net/pipermail/jdk-updates-dev/2019-November/002116.html

      So I think we can safely dispense with disabling warnings on this file - and it does indeed build fine
      with whatever gcc we use today.

      Attachments

        Issue Links

          Activity

            People

              prr Philip Race
              prr Philip Race
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: