JDK-6778669 : Patch from Red Hat -- fixes compilation errors
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 7
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2008-12-02
  • Updated: 2010-07-29
  • Resolved: 2009-03-18
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 Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 Other
6u18Fixed 7Fixed hs15Fixed
Related Reports
Relates :  
Description
Submitted by Lilian Angel.

--- openjdk/hotspot/src/share/vm/adlc/adlc.hpp.ark      2008-01-11 14:15:41.000000000 +0000
+++ openjdk/hotspot/src/share/vm/adlc/adlc.hpp  2008-01-11 14:16:14.000000000 +0000
@@ -32,7 +32,7 @@
 // standard library constants
 #include "stdio.h"
 #include "stdlib.h"
-#if _MSC_VER >= 1300  // Visual C++ 7.0 or later
+#if (defined(__GNUC__) && __GNUC__ >= 3) || (_MSC_VER >= 1300)  // gcc 3.0 or later or Visual C++ 7.0 or later
 #include <iostream>
 #else
 #include <iostream.h>
--- openjdk/hotspot/src/share/vm/adlc/filebuff.cpp.ark  2008-01-11 14:17:17.000000000 +0000
+++ openjdk/hotspot/src/share/vm/adlc/filebuff.cpp      2008-01-11 14:17:34.000000000 +0000
@@ -28,6 +28,8 @@
 // FILEBUFF.CPP - Routines for handling a parser file buffer
 #include "adlc.hpp"

+using namespace std;
+
 //------------------------------FileBuff--------------------------------------- // Create a new parsing buffer
 FileBuff::FileBuff( BufferedFile *fptr, ArchDesc& archDesc) : _fp(fptr), _AD(archDesc) {
--- openjdk/hotspot/src/share/vm/adlc/filebuff.hpp.ark  2008-01-11 14:14:45.000000000 +0000
+++ openjdk/hotspot/src/share/vm/adlc/filebuff.hpp      2008-01-11 14:15:34.000000000 +0000
@@ -27,7 +27,7 @@

 // FILEBUFF.HPP - Definitions for parser file buffering routines

-#if _MSC_VER >= 1300  // Visual C++ 7.0 or later
+#if (defined(__GNUC__) && __GNUC__ >= 3) || (_MSC_VER >= 1300)  // gcc 3.0 or later, or Visual C++ 7.0 or later
 #include <iostream>
 #else
 #include <iostream.h>
@@ -99,8 +99,11 @@
   FileBuffRegion *copy();                   // Deep copy
   FileBuffRegion *merge(FileBuffRegion*); // Merge 2 regions; delete input

-//  void print(std::ostream&);
-//  friend std::ostream& operator<< (std::ostream&, FileBuffRegion&);
+#if defined(__GNUC__) && __GNUC__ >= 3
+  void print(std::ostream&);
+  friend std::ostream& operator<< (std::ostream&, FileBuffRegion&);
+#else
   void print(ostream&);
   friend ostream& operator<< (ostream&, FileBuffRegion&);
+#endif
 };
--- openjdk/hotspot/build/linux/makefiles/gcc.make.ark  2008-01-11 14:24:05.000000000 +0000
+++ openjdk/hotspot/build/linux/makefiles/gcc.make      2008-01-11 14:24:27.000000000 +0000
@@ -94,7 +94,8 @@
 endif

 # Compiler warnings are treated as errors
-WARNINGS_ARE_ERRORS = -Werror
+# Commented out for now because of gcc 4.3 warnings OpenJDK isn't ready for
+#WARNINGS_ARE_ERRORS = -Werror
 # Except for a few acceptable ones
 ACCEPTABLE_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare
 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS)
--- openjdk/hotspot/build/solaris/makefiles/gcc.make.ark        2008-01-11 14:24:33.000000000 +0000
+++ openjdk/hotspot/build/solaris/makefiles/gcc.make    2008-01-11 14:24:48.000000000 +0000
@@ -109,7 +109,8 @@


 # Compiler warnings are treated as errors
-WARNINGS_ARE_ERRORS = -Werror
+# Commented out for now because of gcc 4.3 warnings OpenJDK isn't ready for
+# WARNINGS_ARE_ERRORS = -Werror
 # Enable these warnings. See 'info gcc' about details on these options
 ADDITIONAL_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare
 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ADDITIONAL_WARNINGS)
--- openjdk/jdk/make/common/Defs-linux.gmk.ark  2008-01-11 14:20:26.000000000 +0000
+++ openjdk/jdk/make/common/Defs-linux.gmk      2008-01-11 14:21:10.000000000 +0000
@@ -139,7 +139,9 @@
 # Treat compiler warnings as errors, if warnings not allowed
 #
 ifeq ($(COMPILER_WARNINGS_FATAL),true)
-  GCC_WARNINGS += -Werror
+  # gcc 4.3 introduces new warnings OpenJDK code isn't quite ready for, such as+  # "cast from double to float may chance its value". Let's ignore this for now.
+  # GCC_WARNINGS += -Werror
 endif

 #
The original author is Lilian Angel ###@###.###

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/dbbe28fc66b5
27-02-2009

PUBLIC COMMENTS I also changed the compiler flags for ADLC on Solaris to +w -errwarn to find more warnings GCC could complain about. This revealed a lot of problems in ADLC which I fixed. It should build now with SunCC +w -errwarn and GCC -Werror.
26-02-2009

EVALUATION The conditional include of <iostream> is already fixed in the codebase, it only includes <iostream> anymore. The std namespace in filebuff.cpp seems useful. The commented methods in FileBuffRegion which use std::, which are used conditionally in the Red Hat patch, are superfluous when using std namespace and can be removed. Furthermore I tried to replace the -w GCC flag with -Werror and only hit one warning which is trivial to fix. I think we should use -Werror for ADLC too, as we do for HotSpot.
04-02-2009

PUBLIC COMMENTS Coleen asked me to include the following patch as it was missed in a previous checkin: --- hotspot/src/share/vm/includeDB_core.orig Fri Dec 19 03:42:10 2008 +++ hotspot/src/share/vm/includeDB_core Fri Jan 16 09:38:20 2009 @@ -473,7 +473,7 @@ cardTableModRefBS.cpp cardTableRS.hp cardTableModRefBS.cpp java.hpp cardTableModRefBS.cpp mutexLocker.hpp cardTableModRefBS.cpp sharedHeap.hpp -cardTableModRefBS.cpp space.hpp +cardTableModRefBS.cpp space.inline.hpp cardTableModRefBS.cpp universe.hpp cardTableModRefBS.cpp virtualspace.hpp
04-02-2009