hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cnaur...@apache.org
Subject [2/2] hadoop git commit: HADOOP-11547. hadoop-common native compilation fails on Windows due to missing support for __attribute__ declaration. Contributed by Chris Nauroth.
Date Wed, 04 Feb 2015 20:07:48 GMT
HADOOP-11547. hadoop-common native compilation fails on Windows due to missing support for
__attribute__ declaration. Contributed by Chris Nauroth.

(cherry picked from commit a35e86c6701ffec263966bab31bd9368923c7e80)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/19644331
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/19644331
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/19644331

Branch: refs/heads/branch-2
Commit: 196443318f1dd68d646f9904c34e9a945f1a1d92
Parents: 696266e
Author: cnauroth <cnauroth@apache.org>
Authored: Wed Feb 4 12:07:05 2015 -0800
Committer: cnauroth <cnauroth@apache.org>
Committed: Wed Feb 4 12:07:13 2015 -0800

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt |  3 +++
 .../src/main/native/src/exception.h             | 20 +++++++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/19644331/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index 6f732d5..3168a81 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -476,6 +476,9 @@ Release 2.7.0 - UNRELEASED
     HADOOP-11548. checknative should display a nicer error message when openssl
     support is not compiled in. (Anu Engineer via cnauroth)
 
+    HADOOP-11547. hadoop-common native compilation fails on Windows due to
+    missing support for __attribute__ declaration. (cnauroth)
+
 Release 2.6.1 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/19644331/hadoop-common-project/hadoop-common/src/main/native/src/exception.h
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/native/src/exception.h b/hadoop-common-project/hadoop-common/src/main/native/src/exception.h
index 1ec47a6..afa08e9 100644
--- a/hadoop-common-project/hadoop-common/src/main/native/src/exception.h
+++ b/hadoop-common-project/hadoop-common/src/main/native/src/exception.h
@@ -19,6 +19,19 @@
 
 #include <jni.h> /* for jthrowable */
 #include <stdarg.h> /* for va_list */
+#include "org_apache_hadoop.h"
+
+#ifdef WINDOWS
+/*
+ * gcc-style type-checked format arguments are not supported on Windows, so just
+ * stub this macro.
+ */
+#define TYPE_CHECKED_PRINTF_FORMAT(formatArg, varArgs)
+# else
+/* Use gcc type-checked format arguments. */
+#define TYPE_CHECKED_PRINTF_FORMAT(formatArg, varArgs) \
+  __attribute__((format(printf, formatArg, varArgs)))
+#endif
 
 /**
  * Create a new Exception.
@@ -48,7 +61,7 @@ jthrowable newExceptionV(JNIEnv* env, const char *name,
  * @return              The RuntimeException
  */
 jthrowable newException(JNIEnv* env, const char *name, const char *fmt, ...)
-    __attribute__((format(printf, 3, 4)));
+    TYPE_CHECKED_PRINTF_FORMAT(3, 4);
 
 /**
  * Create a new RuntimeException.
@@ -62,7 +75,7 @@ jthrowable newException(JNIEnv* env, const char *name, const char *fmt,
...)
  * @return              The RuntimeException
  */
 jthrowable newRuntimeException(JNIEnv* env, const char *fmt, ...)
-    __attribute__((format(printf, 2, 3)));
+    TYPE_CHECKED_PRINTF_FORMAT(2, 3);
 
 /**
  * Create a new IOException.
@@ -77,7 +90,7 @@ jthrowable newRuntimeException(JNIEnv* env, const char *fmt, ...)
  *                      to create the NativeIOException.
  */
 jthrowable newIOException(JNIEnv* env, const char *fmt, ...)
-    __attribute__((format(printf, 2, 3)));
+    TYPE_CHECKED_PRINTF_FORMAT(2, 3);
 
 /**
  * Thread-safe strerror alternative.
@@ -87,4 +100,5 @@ jthrowable newIOException(JNIEnv* env, const char *fmt, ...)
  */
 const char* terror(int errnum);
 
+#undef TYPE_CHECKED_PRINTF_FORMAT
 #endif


Mime
View raw message