[cp-patches] RFC: iconv -Werror compilation fix

Christian Thalinger twisti at complang.tuwien.ac.at
Thu Mar 29 22:10:32 UTC 2007


Hi!

This patch fixes -Werror compilation with !HAVE_ICONV.  Daney pointed me
to the (void)-solution.  I'm not sure if that is the best solution, but
it works.

Comments?

- twisti

---

Index: native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c,v
retrieving revision 1.8
diff -u -3 -p -r1.8 gnu_java_nio_charset_iconv_IconvDecoder.c
--- native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c       7 Nov 2005 22:20:39 -0000       1.8
+++ native/jni/java-nio/gnu_java_nio_charset_iconv_IconvDecoder.c       29 Mar 2007 22:07:17 -0000
@@ -48,11 +48,13 @@ exception statement from your version. *
 
 #include "gnu_java_nio_charset_iconv_IconvDecoder.h"
 
+#if defined(HAVE_ICONV)
 static void createRawData (JNIEnv * env, jobject obj, void *ptr);
 static void *getData (JNIEnv * env, jobject obj);
 
 static jfieldID infid = NULL;
 static jfieldID outfid = NULL;
+#endif
 
 /* Union used for type punning. */
 union char_union
@@ -101,6 +103,10 @@ Java_gnu_java_nio_charset_iconv_IconvDec
     }
   createRawData (env, obj, (void *) iconv_object);
 #else
+  (void) env;
+  (void) obj;
+  (void) jname;
+
   JCL_ThrowException (env, "java/lang/IllegalArgumentException",
                      "iconv not available");
 #endif
@@ -153,6 +159,15 @@ Java_gnu_java_nio_charset_iconv_IconvDec
 
   return (jint) retval;
 #else
+  (void) env;
+  (void) obj;
+  (void) inArr;
+  (void) outArr;
+  (void) posIn;
+  (void) remIn;
+  (void) posOut;
+  (void) remOut;
+
   return -1;
 #endif
 }
@@ -165,10 +180,14 @@ Java_gnu_java_nio_charset_iconv_IconvDec
   iconv_t iconv_object;
   iconv_object = getData (env, obj);
   iconv_close (iconv_object);
+#else
+  (void) env;
+  (void) obj;
 #endif
 }
 
 
+#if defined(HAVE_ICONV)
 static void
 createRawData (JNIEnv * env, jobject obj, void *ptr)
 {
@@ -199,3 +218,5 @@ getData (JNIEnv * env, jobject obj)
 
   return JCL_GetRawData(env, data);
 }
+#endif
+
Index: native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c,v
retrieving revision 1.8
diff -u -3 -p -r1.8 gnu_java_nio_charset_iconv_IconvEncoder.c
--- native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c       5 Aug 2005 17:12:52 -0000       1.8
+++ native/jni/java-nio/gnu_java_nio_charset_iconv_IconvEncoder.c       29 Mar 2007 22:07:17 -0000
@@ -48,11 +48,14 @@ exception statement from your version. *
 
 #include "gnu_java_nio_charset_iconv_IconvEncoder.h"
 
+
+#if defined(HAVE_ICONV)
 static void createRawData (JNIEnv * env, jobject obj, void *ptr);
 static void *getData (JNIEnv * env, jobject obj);
 
 static jfieldID infid = NULL;
 static jfieldID outfid = NULL;
+#endif
 
 /* Union used for type punning. */
 union char_union
@@ -101,6 +104,10 @@ Java_gnu_java_nio_charset_iconv_IconvEnc
     }
   createRawData (env, obj, (void *) iconv_object);
 #else
+  (void) env;
+  (void) obj;
+  (void) jname;
+
   JCL_ThrowException (env, "java/lang/IllegalArgumentException",
                      "iconv not available");
 #endif
@@ -153,6 +160,15 @@ Java_gnu_java_nio_charset_iconv_IconvEnc
 
   return (jint) retval;
 #else
+  (void) env;
+  (void) obj;
+  (void) inArr;
+  (void) outArr;
+  (void) posIn;
+  (void) remIn;
+  (void) posOut;
+  (void) remOut;
+
   return -1;
 #endif
 }
@@ -165,10 +181,14 @@ Java_gnu_java_nio_charset_iconv_IconvEnc
   iconv_t iconv_object;
   iconv_object = getData (env, obj);
   iconv_close (iconv_object);
+#else
+  (void) env;
+  (void) obj;
 #endif
 }
 
 
+#if defined(HAVE_ICONV)
 static void
 createRawData (JNIEnv * env, jobject obj, void *ptr)
 {
@@ -199,3 +219,4 @@ getData (JNIEnv * env, jobject obj)
 
   return JCL_GetRawData(env, data);
 }
+#endif





More information about the Classpath-patches mailing list