JDK-6712344 : Add -errwarn=%all to Solaris Sun Studio compiles (all warnings being fatal)
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2008-06-09
  • Updated: 2010-04-02
  • Resolved: 2008-08-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
The hotspot Makefiles should add the Sun Studio compiler option -errwarn=%all on all C++ and C compile lines to turn all warnings into fatal errors.
It appears that hotspot is not asking for more warnings from the Sun Studio C++ compiler with the +w or +w2 option. I'm not sure I'd recommend the +w2 (seems a bit too noisy), but the +w option may be worth using. I did note that it issues warnings on system or compiler owned files, which isn't helpful or comfortable. By adding -errtags, the warning messages will get tagnames, and then you can add -erroff=TAG to suppress that warning.

FYI... hotspot will NOT build with -errwarn=%all now due to a few warnings, but adding +w makes it much worse.

(The option -w turns all warnings off, +w turns more warnings on).

The Sun Studio C compiler option for max warnings is -v. It uses the same -errwarn=%all to make warnings fatal.

diff -r a49545cab84a make/solaris/makefiles/sparcWorks.make
--- a/make/solaris/makefiles/sparcWorks.make    Tue May 27 09:47:18 2008 -0700
+++ b/make/solaris/makefiles/sparcWorks.make    Mon Jul 21 09:13:12 2008 -0700
@@ -437,6 +437,17 @@ VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO))
+# Ask for more warning errors (-w2 is too noisy)
+CFLAGS += +w
+# Ask for error tags on error messages
+CFLAGS += -errtags
+# Warnings selection
+#WARNINGS_ARE_ERRORS = -errwarn=%all
 # less dynamic linking (no PLTs, please)
 # %%%%% despite -znodefs, -Bsymbolic gets link errors -- Rose