Skip to content

Commit

Permalink
Merge branch 'master' into goetz_backport_8264152
Browse files Browse the repository at this point in the history
  • Loading branch information
GoeLin authored Mar 28, 2024
2 parents d08f693 + 741b340 commit 596cd11
Show file tree
Hide file tree
Showing 10 changed files with 218 additions and 60 deletions.
74 changes: 46 additions & 28 deletions make/autoconf/flags-cflags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -172,28 +172,53 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS],
DISABLE_WARNING_PREFIX="-wd"
BUILD_CC_DISABLE_WARNING_PREFIX="-wd"
CFLAGS_WARNINGS_ARE_ERRORS="-WX"
WARNINGS_ENABLE_ALL="-W3"
DISABLED_WARNINGS="4800"
;;
solstudio)
DISABLE_WARNING_PREFIX="-erroff="
CFLAGS_WARNINGS_ARE_ERRORS="-errtags -errwarn=%all"
CFLAGS_WARNINGS_ARE_ERRORS="-errwarn=%all"
WARNINGS_ENABLE_ALL_CFLAGS="-v"
WARNINGS_ENABLE_ALL_CXXFLAGS="+w"
DISABLED_WARNINGS_C=""
DISABLED_WARNINGS_CXX=""
;;
gcc)
DISABLE_WARNING_PREFIX="-Wno-"
BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
;;
clang)
DISABLE_WARNING_PREFIX="-Wno-"
CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
WARNINGS_ENABLE_ALL="-Wall -Wextra -Wformat=2"
WARNINGS_ENABLE_ADDITIONAL_JVM="-Wpointer-arith -Wsign-compare -Wunused-function -Wundef -Wunused-value -Woverloaded-virtual -Wreorder"
DISABLED_WARNINGS="unused-parameter unused"
;;
xlc)
DISABLE_WARNING_PREFIX="-qsuppress="
CFLAGS_WARNINGS_ARE_ERRORS="-qhalt=w"
# Possibly a better subset than "all" is "lan:trx:ret:zea:cmp:ret"
WARNINGS_ENABLE_ALL="-qinfo=all -qformat=all"
DISABLED_WARNINGS=""
;;
esac
AC_SUBST(DISABLE_WARNING_PREFIX)
AC_SUBST(BUILD_CC_DISABLE_WARNING_PREFIX)
AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
AC_SUBST(DISABLED_WARNINGS)
AC_SUBST(DISABLED_WARNINGS_C)
AC_SUBST(DISABLED_WARNINGS_CXX)
])

AC_DEFUN([FLAGS_SETUP_QUALITY_CHECKS],
Expand Down Expand Up @@ -527,18 +552,22 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX
fi
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
TOOLCHAIN_CFLAGS_JDK="-mt"
TOOLCHAIN_CFLAGS_JDK_CONLY="-xCC -Xa -v -W0,-noglobal" # C only
TOOLCHAIN_FLAGS="-errtags -errfmt"
TOOLCHAIN_CFLAGS="-errshort=tags"
TOOLCHAIN_CFLAGS_JDK="-mt $TOOLCHAIN_FLAGS"
TOOLCHAIN_CFLAGS_JDK_CONLY="-xc99=%none -xCC -Xa -W0,-noglobal $TOOLCHAIN_CFLAGS" # C only
TOOLCHAIN_CFLAGS_JDK_CXXONLY="-features=no%except -norunpath -xnolib" # CXX only
TOOLCHAIN_CFLAGS_JVM="-template=no%extdef -features=no%split_init \
-library=stlport4 -mt -features=no%except"
-library=stlport4 -mt -features=no%except $TOOLCHAIN_FLAGS"
if test "x$DEBUG_LEVEL" = xslowdebug; then
# Previously -g was used instead of -g0 for slowdebug; this is equivalent
# to setting +d.
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM +d"
fi
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
# Suggested additions: -qsrcmsg to get improved error reporting
# set -qtbtable=full for a better traceback table/better stacks in hs_err when xlc16 is used
TOOLCHAIN_CFLAGS_JDK="-qtbtable=full -qchars=signed -qfullpath -qsaveopt -qstackprotect" # add on both CFLAGS
TOOLCHAIN_CFLAGS_JVM="-qtbtable=full -qtune=balanced \
Expand All @@ -550,37 +579,26 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
# CFLAGS WARNINGS STUFF
# Set JVM_CFLAGS warning handling
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
# COMMON to gcc and clang
WARNING_CFLAGS_JVM="-Wpointer-arith -Wsign-compare -Wunused-function"
if ! HOTSPOT_CHECK_JVM_VARIANT(zero); then
# Non-zero builds have stricter warnings
WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wundef -Wformat=2"
fi
fi
if test "x$TOOLCHAIN_TYPE" = xgcc; then
WARNING_CFLAGS_JDK="-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2"
WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wunused-value -Woverloaded-virtual"
WARNING_CFLAGS_JDK="$WARNINGS_ENABLE_ALL"
WARNING_CFLAGS_JVM="$WARNINGS_ENABLE_ALL $WARNINGS_ENABLE_ADDITIONAL_JVM"
if ! HOTSPOT_CHECK_JVM_VARIANT(zero); then
# Non-zero builds have stricter warnings
WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wreturn-type"
fi
elif test "x$TOOLCHAIN_TYPE" = xclang; then
WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wno-deprecated"
if test "x$OPENJDK_TARGET_OS" = xlinux; then
WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wno-sometimes-uninitialized"
WARNING_CFLAGS_JDK="-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2"
WARNING_CFLAGS_JDK="$WARNINGS_ENABLE_ALL"
else
WARNING_CFLAGS_JDK="" # currently left empty
fi
WARNING_CFLAGS_JVM="$WARNINGS_ENABLE_ALL $WARNINGS_ENABLE_ADDITIONAL_JVM"
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
WARNING_CFLAGS_JDK_CONLY="-errshort=tags"
WARNING_CFLAGS_JDK_CXXONLY="+w"
WARNING_CFLAGS_JDK="-errtags=yes -errfmt"
WARNING_CFLAGS_JDK_CONLY="$WARNINGS_ENABLE_ALL_CFLAGS"
WARNING_CFLAGS_JDK_CXXONLY="$WARNINGS_ENABLE_ALL_CXXFLAGS"
WARNING_CFLAGS_JVM="" # currently left empty
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
WARNING_CFLAGS="-W3"
WARNING_CFLAGS_JDK="-wd4800"
WARNING_CFLAGS_JVM="-wd4800"
WARNING_CFLAGS="$WARNINGS_ENABLE_ALL"
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
WARNING_CFLAGS="" # currently left empty
fi
# Set some additional per-OS defines.
Expand Down
8 changes: 8 additions & 0 deletions make/autoconf/flags-ldflags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
fi
fi
# Setup warning flags
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
LDFLAGS_WARNINGS_ARE_ERRORS="-Wl,-z,fatal-warnings"
else
LDFLAGS_WARNINGS_ARE_ERRORS=""
fi
AC_SUBST(LDFLAGS_WARNINGS_ARE_ERRORS)
# Setup LDFLAGS for linking executables
if test "x$TOOLCHAIN_TYPE" = xgcc; then
EXECUTABLE_LDFLAGS="$EXECUTABLE_LDFLAGS -Wl,--allow-shlib-undefined"
Expand Down
4 changes: 4 additions & 0 deletions make/autoconf/spec.gmk.in
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,10 @@ CXX_FLAG_DEPS:=@CXX_FLAG_DEPS@

DISABLE_WARNING_PREFIX := @DISABLE_WARNING_PREFIX@
CFLAGS_WARNINGS_ARE_ERRORS:=@CFLAGS_WARNINGS_ARE_ERRORS@
LDFLAGS_WARNINGS_ARE_ERRORS:=@LDFLAGS_WARNINGS_ARE_ERRORS@
DISABLED_WARNINGS := @DISABLED_WARNINGS@
DISABLED_WARNINGS_C := @DISABLED_WARNINGS_C@
DISABLED_WARNINGS_CXX := @DISABLED_WARNINGS_CXX@

# A global flag (true or false) determining if native warnings are considered errors.
WARNINGS_AS_ERRORS := @WARNINGS_AS_ERRORS@
Expand Down
9 changes: 7 additions & 2 deletions make/common/NativeCompilation.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -747,9 +747,13 @@ define SetupNativeCompilationBody
# Pick up disabled warnings, if possible on this platform.
ifneq ($(DISABLE_WARNING_PREFIX), )
$1_EXTRA_CFLAGS += $$(addprefix $(DISABLE_WARNING_PREFIX), \
$$(DISABLED_WARNINGS) \
$$(DISABLED_WARNINGS_C) \
$$($1_DISABLED_WARNINGS_$(TOOLCHAIN_TYPE)) \
$$($1_DISABLED_WARNINGS_C_$(TOOLCHAIN_TYPE)))
$1_EXTRA_CXXFLAGS += $$(addprefix $(DISABLE_WARNING_PREFIX), \
$$(DISABLED_WARNINGS) \
$$(DISABLED_WARNINGS_CXX) \
$$($1_DISABLED_WARNINGS_$(TOOLCHAIN_TYPE)) \
$$($1_DISABLED_WARNINGS_CXX_$(TOOLCHAIN_TYPE)))
endif
Expand All @@ -767,6 +771,7 @@ define SetupNativeCompilationBody
ifeq ($$($1_WARNINGS_AS_ERRORS_$(TOOLCHAIN_TYPE)), true)
$1_EXTRA_CFLAGS += $(CFLAGS_WARNINGS_ARE_ERRORS)
$1_EXTRA_CXXFLAGS += $(CFLAGS_WARNINGS_ARE_ERRORS)
$1_EXTRA_LDFLAGS += $(LDFLAGS_WARNINGS_ARE_ERRORS)
endif

ifeq (NONE, $$($1_OPTIMIZATION))
Expand Down Expand Up @@ -975,8 +980,8 @@ define SetupNativeCompilationBody

# Pickup extra OPENJDK_TARGET_OS_TYPE and/or OPENJDK_TARGET_OS dependent variables
# for LDFLAGS and LIBS
$1_EXTRA_LDFLAGS := $$($1_LDFLAGS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_LDFLAGS_$(OPENJDK_TARGET_OS))
$1_EXTRA_LIBS := $$($1_LIBS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_LIBS_$(OPENJDK_TARGET_OS))
$1_EXTRA_LDFLAGS += $$($1_LDFLAGS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_LDFLAGS_$(OPENJDK_TARGET_OS))
$1_EXTRA_LIBS += $$($1_LIBS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_LIBS_$(OPENJDK_TARGET_OS))
ifneq ($$($1_REAL_MAPFILE), )
$1_EXTRA_LDFLAGS += $(call SET_SHARED_LIBRARY_MAPFILE,$$($1_REAL_MAPFILE))
endif
Expand Down
13 changes: 8 additions & 5 deletions make/hotspot/lib/CompileGtest.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,14 @@ $(eval $(call SetupNativeCompilation, BUILD_GTEST_LIBJVM, \
CFLAGS_windows := -EHsc, \
CFLAGS_solaris := -DGTEST_HAS_EXCEPTIONS=0 -library=stlport4 +d, \
CFLAGS_macosx := -DGTEST_OS_MAC=1, \
DISABLED_WARNINGS_gcc := undef stringop-overflow, \
DISABLED_WARNINGS_clang := undef switch format-nonliteral \
tautological-undefined-compare $(BUILD_LIBJVM_DISABLED_WARNINGS_clang), \
DISABLED_WARNINGS_solstudio := identexpected, \
DISABLED_WARNINGS_microsoft := 4146, \
DISABLED_WARNINGS_gcc := $(DISABLED_WARNINGS_gcc) \
undef, \
DISABLED_WARNINGS_clang := $(DISABLED_WARNINGS_clang) \
undef switch format-nonliteral tautological-undefined-compare, \
DISABLED_WARNINGS_solstudio := $(DISABLED_WARNINGS_solstudio) \
identexpected, \
DISABLED_WARNINGS_microsoft := $(DISABLED_WARNINGS_microsoft) \
4146, \
LDFLAGS := $(JVM_LDFLAGS), \
LDFLAGS_solaris := -library=stlport4 $(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS := $(JVM_LIBS), \
Expand Down
29 changes: 24 additions & 5 deletions make/hotspot/lib/CompileJvm.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,25 @@ CFLAGS_VM_VERSION := \
-DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
#

################################################################################
# Disabled warnings

DISABLED_WARNINGS_gcc := extra all
ifeq ($(call check-jvm-feature, zero), true)
DISABLED_WARNINGS_gcc += return-type
endif

DISABLED_WARNINGS_clang := extra all tautological-compare deprecated-declarations

DISABLED_WARNINGS_solstudio :=

DISABLED_WARNINGS_xlc := 1540-0216 1540-0198 1540-1090 1540-1639 1540-1088 \
1500-010

DISABLED_WARNINGS_microsoft :=



################################################################################
# Platform specific setup

Expand Down Expand Up @@ -117,7 +136,7 @@ ifeq ($(call isTargetOs, solaris), true)
endif
# Exclude warnings in devstudio 12.6
ifeq ($(CC_VERSION_NUMBER), 5.15)
DISABLED_WARNINGS_solstudio := SEC_ARR_OUTSIDE_BOUND_READ \
DISABLED_WARNINGS_solstudio += SEC_ARR_OUTSIDE_BOUND_READ \
SEC_ARR_OUTSIDE_BOUND_WRITE
endif
endif
Expand Down Expand Up @@ -162,11 +181,11 @@ $(eval $(call SetupNativeCompilation, BUILD_LIBJVM, \
CFLAGS := $(JVM_CFLAGS), \
abstract_vm_version.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
arguments.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
DISABLED_WARNINGS_clang := tautological-compare, \
DISABLED_WARNINGS_gcc := $(DISABLED_WARNINGS_gcc), \
DISABLED_WARNINGS_clang := $(DISABLED_WARNINGS_clang), \
DISABLED_WARNINGS_solstudio := $(DISABLED_WARNINGS_solstudio), \
DISABLED_WARNINGS_xlc := 1540-0216 1540-0198 1540-1090 1540-1639 \
1540-1088 1500-010, \
DISABLED_WARNINGS_microsoft := 4146, \
DISABLED_WARNINGS_xlc := $(DISABLED_WARNINGS_xlc), \
DISABLED_WARNINGS_microsoft := $(DISABLED_WARNINGS_microsoft) 4146, \
ASFLAGS := $(JVM_ASFLAGS), \
LDFLAGS := $(JVM_LDFLAGS), \
LIBS := $(JVM_LIBS), \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@
package sun.print;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Vector;
import java.security.AccessController;
Expand All @@ -54,6 +52,8 @@
import java.net.URL;
import java.nio.file.Files;

import sun.awt.util.ThreadGroupUtils;

/*
* Remind: This class uses solaris commands. We also need a linux
* version
Expand Down Expand Up @@ -207,14 +207,18 @@ static int getBSDCommandIndex() {
return BSD_LPD;
}


@SuppressWarnings("removal")
public PrintServiceLookupProvider() {
// start the printer listener thread
if (pollServices) {
Thread thr = new Thread(null, new PrinterChangeListener(),
"PrinterListener", 0, false);
thr.setDaemon(true);
thr.start();
AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
Thread thr = new Thread(ThreadGroupUtils.getRootThreadGroup(),
new PrinterChangeListener(),
"PrinterListener", 0, false);
thr.setContextClassLoader(null);
thr.setDaemon(true);
return thr;
}).start();
IPPPrintService.debug_println(debugPrefix+"polling turned on");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

package sun.print;

import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;

import javax.print.DocFlavor;
Expand All @@ -41,6 +43,8 @@
import javax.print.attribute.PrintServiceAttributeSet;
import javax.print.attribute.standard.PrinterName;

import sun.awt.util.ThreadGroupUtils;

public class PrintServiceLookupProvider extends PrintServiceLookup {

private String defaultPrinter;
Expand Down Expand Up @@ -78,22 +82,31 @@ public static PrintServiceLookupProvider getWin32PrintLUS() {
return win32PrintLUS;
}

@SuppressWarnings("removal")
public PrintServiceLookupProvider() {

if (win32PrintLUS == null) {
win32PrintLUS = this;

// start the local printer listener thread
Thread thr = new Thread(null, new PrinterChangeListener(),
"PrinterListener", 0, false);
thr.setDaemon(true);
thr.start();
AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
Thread thr = new Thread(ThreadGroupUtils.getRootThreadGroup(),
new PrinterChangeListener(),
"PrinterListener", 0, false);
thr.setContextClassLoader(null);
thr.setDaemon(true);
return thr;
}).start();

// start the remote printer listener thread
Thread remThr = new Thread(null, new RemotePrinterChangeListener(),
"RemotePrinterListener", 0, false);
remThr.setDaemon(true);
remThr.start();
AccessController.doPrivileged((PrivilegedAction<Thread>) () -> {
Thread thr = new Thread(ThreadGroupUtils.getRootThreadGroup(),
new RemotePrinterChangeListener(),
"RemotePrinterListener", 0, false);
thr.setContextClassLoader(null);
thr.setDaemon(true);
return thr;
}).start();
} /* else condition ought to never happen! */
}

Expand Down
Loading

0 comments on commit 596cd11

Please sign in to comment.