From 592fb5106aa2587fc0a2da8591bdfca87e7dc602 Mon Sep 17 00:00:00 2001
From: Robert Schuster <robertschuster@fsfe.org>
Date: Tue, 21 Feb 2006 10:32:31 +0000
Subject: [PATCH] link.cc: Added variant of create_error_method that will not
 complain about unused...

2006-02-21  Robert Schuster  <robertschuster@fsfe.org>

        * link.cc: Added variant of create_error_method that
        will not complain about unused parameter if compiled with
        USE_LIBFFI not being defined.
        (_Jv_Linker::find_field_helper): Fixed indentation.
        (_Jv_Linker::create_error_method): Fixed indentation.
        (_Jv_Linker::link_symbol_table): Fixed indentation.

From-SVN: r111331
---
 libjava/ChangeLog |  9 +++++++++
 libjava/link.cc   | 32 ++++++++++++++++++--------------
 2 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 2e1438929dbd..d96d0316a410 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,12 @@
+2006-02-21  Robert Schuster  <robertschuster@fsfe.org>
+
+	* link.cc: Added variant of create_error_method that
+	will not complain about unused parameter if compiled with
+	USE_LIBFFI not being defined.
+	(_Jv_Linker::find_field_helper): Fixed indentation.
+	(_Jv_Linker::create_error_method): Fixed indentation.
+	(_Jv_Linker::link_symbol_table): Fixed indentation.
+
 2006-02-16  Andrew Haley  <aph@redhat.com>
 
 	* stacktrace.cc (GetStackTraceElements): Call
diff --git a/libjava/link.cc b/libjava/link.cc
index 481f98a138bc..e1dc23f5bcb5 100644
--- a/libjava/link.cc
+++ b/libjava/link.cc
@@ -142,10 +142,10 @@ _Jv_Linker::find_field_helper (jclass search, _Jv_Utf8Const *name,
 	  // pass in the descriptor and check that way, because when
 	  // the field is already resolved there is no easy way to
 	  // find its descriptor again.
-	  if ( (field->isResolved () ? 
-                _Jv_equalUtf8Classnames (type_name, field->type->name) :
-                _Jv_equalUtf8Classnames (
-                  type_name, (_Jv_Utf8Const *) field->type)) )
+	  if ((field->isResolved ()
+               ? _Jv_equalUtf8Classnames (type_name, field->type->name)
+               : _Jv_equalUtf8Classnames (type_name,
+                                          (_Jv_Utf8Const *) field->type)))
 	    {
 	      *declarer = search;
 	      return field;
@@ -771,7 +771,7 @@ _Jv_ThrowNoClassDefFoundErrorTrampoline(ffi_cif *,
                                         void *data)
 {
   throw new java::lang::NoClassDefFoundError(
-    _Jv_NewStringUtf8Const( (_Jv_Utf8Const *) data));
+    _Jv_NewStringUtf8Const((_Jv_Utf8Const *) data));
 }
 #else
 // A variant of the NoClassDefFoundError throwing method that can
@@ -947,7 +947,6 @@ _Jv_Linker::find_iindex (jclass *ifaces, jshort *offsets, jshort num)
 }
 
 #ifdef USE_LIBFFI
-
 // We use a structure of this type to store the closure that
 // represents a missing method.
 struct method_closure
@@ -960,12 +959,9 @@ struct method_closure
   ffi_type *arg_types[1];
 };
 
-#endif // USE_LIBFFI
-
 void *
 _Jv_Linker::create_error_method (_Jv_Utf8Const *class_name)
 {
-#ifdef USE_LIBFFI
   method_closure *closure
     = (method_closure *) _Jv_AllocBytes(sizeof (method_closure));
 
@@ -974,9 +970,13 @@ _Jv_Linker::create_error_method (_Jv_Utf8Const *class_name)
   // Initializes the cif and the closure.  If that worked the closure
   // is returned and can be used as a function pointer in a class'
   // atable.
-  if (ffi_prep_cif (&closure->cif, FFI_DEFAULT_ABI, 1, &ffi_type_void,
-		    closure->arg_types) == FFI_OK
-      && ffi_prep_closure (&closure->closure, &closure->cif,
+  if (   ffi_prep_cif (&closure->cif,
+                       FFI_DEFAULT_ABI,
+                       1,
+                       &ffi_type_void,
+		       closure->arg_types) == FFI_OK
+      && ffi_prep_closure (&closure->closure,
+                           &closure->cif,
 			   _Jv_ThrowNoClassDefFoundErrorTrampoline,
 			   class_name) == FFI_OK)
     return &closure->closure;
@@ -989,13 +989,17 @@ _Jv_Linker::create_error_method (_Jv_Utf8Const *class_name)
       buffer->append (_Jv_NewStringUtf8Const(class_name));
       throw new java::lang::InternalError(buffer->toString());
     }
+}
 #else
+void *
+_Jv_Linker::create_error_method (_Jv_Utf8Const *)
+{
   // Codepath for platforms which do not support (or want) libffi.
   // You have to accept that it is impossible to provide the name
   // of the missing class then.
   return (void *) _Jv_ThrowNoClassDefFoundError;
-#endif
 }
+#endif // USE_LIBFFI
 
 // Functions for indirect dispatch (symbolic virtual binding) support.
 
@@ -1213,7 +1217,7 @@ _Jv_Linker::link_symbol_table (jclass klass)
 	}
 
       // Try fields only if the target class exists.
-      if ( target_class != NULL )
+      if (target_class != NULL)
       {
 	wait_for_state(target_class, JV_STATE_PREPARED);
 	jclass found_class;
-- 
GitLab