United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6778669 Patch from Red Hat -- fixes compilation errors
JDK-6778669 : Patch from Red Hat -- fixes compilation errors

Details
Type:
Bug
Submit Date:
2008-12-02
Status:
Resolved
Updated Date:
2010-07-29
Project Name:
JDK
Resolved Date:
2009-03-18
Component:
hotspot
OS:
generic
Sub-Component:
compiler
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
hs15 (b03)

Related Reports
Backport:
Backport:
Relates:

Sub Tasks

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
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
                                     
2009-02-04
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.
                                     
2009-02-04
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.
                                     
2009-02-26
EVALUATION

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



Hardware and Software, Engineered to Work Together