changeset 5812:819d329e1fd0

8196978: JDK-8187667 fails on GCC 4.4.7 as found on RHEL 6 Summary: Move pragma to above function definition and turn off push/pop pragma warnings on GCC < 4.6 Reviewed-by: aph
author andrew
date Thu, 08 Feb 2018 00:59:32 +0000
parents e5c2b8ac6e28
children 2a2721def4a0
files make/linux/makefiles/gcc.make src/os/linux/vm/os_linux.inline.hpp
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/make/linux/makefiles/gcc.make	Mon Feb 05 23:21:41 2018 +0000
+++ b/make/linux/makefiles/gcc.make	Thu Feb 08 00:59:32 2018 +0000
@@ -149,6 +149,10 @@
 else
 ACCEPTABLE_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare
 endif
+# Only GCC 4.6 and later have the GCC diagnostic push/pop pragmas
+ifneq "$(shell expr \( $(CC_VER_MAJOR) \<= 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \< 6 \) \))" "0"
+ACCEPTABLE_WARNINGS += -Wno-pragmas
+endif
 
 CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS)
 # Special cases
--- a/src/os/linux/vm/os_linux.inline.hpp	Mon Feb 05 23:21:41 2018 +0000
+++ b/src/os/linux/vm/os_linux.inline.hpp	Thu Feb 08 00:59:32 2018 +0000
@@ -133,12 +133,12 @@
   return ::ftruncate64(fd, length);
 }
 
-inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
-{
 // readdir_r has been deprecated since glibc 2.24.
 // See https://sourceware.org/bugzilla/show_bug.cgi?id=19056 for more details.
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
+{
 
   dirent* p;
   int status;
@@ -154,8 +154,8 @@
   } else
     return p;
 
+}
 #pragma GCC diagnostic pop
-}
 
 inline int os::closedir(DIR *dirp) {
   assert(dirp != NULL, "argument is NULL");