This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: link.cc indentation fixes


Hi,
as requested I fixed the indentation of my previous patch.

For the indentation of the big if-statement in create_errror_method I used the
if-statement around line 1932 as an example.

When compiling with USE_LIBFFI being undefined, the compiler would complain
about an unused argument. I fixed this by putting the method head into the
#IFDEF-block.

Looks good?

The ChangeLog:

2006-02-05  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.

cya
Robert
Index: link.cc
===================================================================
--- link.cc	(Revision 110544)
+++ link.cc	(Arbeitskopie)
@@ -142,10 +142,10 @@
 	  // 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 () ? 
+	  if ((field->isResolved () ? 
                 _Jv_equalUtf8Classnames (type_name, field->type->name) :
                 _Jv_equalUtf8Classnames (
-                  type_name, (_Jv_Utf8Const *) field->type)) )
+                  type_name, (_Jv_Utf8Const *) field->type)))
 	    {
 	      *declarer = search;
 	      return field;
@@ -779,7 +779,7 @@
                                         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
@@ -955,29 +955,33 @@
 }
 
 
+#ifdef USE_LIBFFI
 void *
 _Jv_Linker::create_error_method (_Jv_Utf8Const *class_name)
 {
-#ifdef USE_LIBFFI
   // TODO: The following structs/objects are heap allocated are
   // unreachable by the garbage collector:
   // - cif, arg_types
 
-  ffi_closure *closure = (ffi_closure *) _Jv_Malloc( sizeof( ffi_closure ));
-  ffi_cif *cif = (ffi_cif *) _Jv_Malloc( sizeof( ffi_cif ));
+  ffi_closure *closure = (ffi_closure *) _Jv_Malloc(sizeof(ffi_closure));
+  ffi_cif *cif = (ffi_cif *) _Jv_Malloc(sizeof(ffi_cif));
 
   // Pretends that we want to call a void (*) (void) function via
   // ffi_call.
-  ffi_type **arg_types = (ffi_type **) _Jv_Malloc( sizeof( ffi_type * ));
+  ffi_type **arg_types = (ffi_type **) _Jv_Malloc(sizeof(ffi_type *));
   arg_types[0] = &ffi_type_void;
 
   // 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 (
-        cif, FFI_DEFAULT_ABI, 1, &ffi_type_void, arg_types) == FFI_OK
-      && (ffi_prep_closure (
-            closure, cif, _Jv_ThrowNoClassDefFoundErrorTrampoline,
-            class_name) == FFI_OK))
+  if (   ffi_prep_cif (cif,
+                       FFI_DEFAULT_ABI,
+                       1,
+                       &ffi_type_void,
+                       arg_types) == FFI_OK
+      && ffi_prep_closure (closure,
+                           cif,
+                           _Jv_ThrowNoClassDefFoundErrorTrampoline,
+                           class_name) == FFI_OK)
     {
       return closure;
     }
@@ -992,13 +996,17 @@
 
       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
-}
 
 // Functions for indirect dispatch (symbolic virtual binding) support.
 
@@ -1216,7 +1224,7 @@
 	}
 
       // 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;

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]