On 2018-03-16 12:05, David Holmes wrote:
Hi Michal,
On 16/03/2018 8:48 PM, Michal Vala wrote:
Hi,
I've been trying to build latest jdk with gcc 4.4.7 and I hit compile
error due to pragma used in function:
I don't think gcc 4.4.7 is likely to work at all. Configure will
complain (but continue) if you use a gcc prior to 4.7 (very recently
raised to 4.8).
You can try getting past this error, but you are likely to hit more
issues down the road.
Do you have any specific reasons for using such an old compiler?
/Magnus
That's a very old gcc. Our "official" version is 4.9.2 but we're
working on getting gcc 7.x working as well. This code causes no
problem on 4.9.2+ so to make any change we'd have to know it will
continue to work on later versions.
Also a google search indicates the "pragma diagnostic push" and pop
weren't added until gcc 4.6 ??
David
-----
/mnt/ramdisk/openjdk/src/hotspot/os/linux/os_linux.inline.hpp:103:
error: #pragma GCC diagnostic not allowed inside functions
I'm sending little patch that fixes the issue by wrapping whole
function. I've also created a macro for ignoring deprecated
declaration inside compilerWarnings.hpp to line up with others.
Can someone please review? If it's ok, I would also need a sponsor.
diff -r 422615764e12 src/hotspot/os/linux/os_linux.inline.hpp
--- a/src/hotspot/os/linux/os_linux.inline.hpp Thu Mar 15 14:54:10
2018 -0700
+++ b/src/hotspot/os/linux/os_linux.inline.hpp Fri Mar 16 10:50:24
2018 +0100
@@ -96,13 +96,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"
-
+PRAGMA_DIAG_PUSH
+PRAGMA_DEPRECATED_IGNORED
+inline struct dirent* os::readdir(DIR* dirp, dirent *dbuf)
+{
dirent* p;
int status;
assert(dirp != NULL, "just checking");
@@ -114,11 +113,11 @@
if((status = ::readdir_r(dirp, dbuf, &p)) != 0) {
errno = status;
return NULL;
- } else
+ } else {
return p;
-
-#pragma GCC diagnostic pop
+ }
}
+PRAGMA_DIAG_POP
inline int os::closedir(DIR *dirp) {
assert(dirp != NULL, "argument is NULL");
diff -r 422615764e12 src/hotspot/share/utilities/compilerWarnings.hpp
--- a/src/hotspot/share/utilities/compilerWarnings.hpp Thu Mar 15
14:54:10 2018 -0700
+++ b/src/hotspot/share/utilities/compilerWarnings.hpp Fri Mar 16
10:50:24 2018 +0100
@@ -48,6 +48,7 @@
#define PRAGMA_FORMAT_NONLITERAL_IGNORED _Pragma("GCC diagnostic
ignored \"-Wformat-nonliteral\"") \
_Pragma("GCC diagnostic
ignored \"-Wformat-security\"")
#define PRAGMA_FORMAT_IGNORED _Pragma("GCC diagnostic ignored
\"-Wformat\"")
+#define PRAGMA_DEPRECATED_IGNORED _Pragma("GCC diagnostic ignored
\"-Wdeprecated-declarations\"")
#if defined(__clang_major__) && \
(__clang_major__ >= 4 || \
Thanks!