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


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

More java dir patches, part 4/5


	This is part 4/5, okay to install?

		--Kaveh


Tue Mar  9 15:10:05 1999  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* jcf-write.c: Include jcf.h before tree.h/java-tree.h.
	(alloc_chunk, append_chunk, append_chunk_copy, gen_jcf_label,
	finish_jcf_block, define_jcf_label, get_jcf_label_here,
	put_linenumber, localvar_alloc, localvar_free, get_access_flags,
	write_chunks, adjust_typed_op, generate_bytecode_conditional,
	generate_bytecode_return, perform_relocations, init_jcf_state,
	init_jcf_method, release_jcf_state, generate_classfile):
 	Add static prototype.
	(emit_unop): Mark parameter `type' with ATTRIBUTE_UNUSED.
	(make_class_file_name): Const-ify.


diff -rup orig/egcs-CVS19990307/gcc/java/jcf-write.c egcs-CVS19990307/gcc/java/jcf-write.c
--- orig/egcs-CVS19990307/gcc/java/jcf-write.c	Mon Feb 22 10:40:47 1999
+++ egcs-CVS19990307/gcc/java/jcf-write.c	Tue Mar  9 13:12:40 1999
@@ -23,9 +23,9 @@ The Free Software Foundation is independ
 
 #include "config.h"
 #include "system.h"
+#include "jcf.h"
 #include "tree.h"
 #include "java-tree.h"
-#include "jcf.h"
 #include "obstack.h"
 #undef AND
 #include "rtl.h"
@@ -273,6 +273,33 @@ struct jcf_partial
 };
 
 static void generate_bytecode_insns PROTO ((tree, int, struct jcf_partial *));
+static struct chunk * alloc_chunk PROTO ((struct chunk *, unsigned char *,
+					  int, struct obstack *));
+static unsigned char * append_chunk PROTO ((unsigned char *, int,
+					    struct jcf_partial *));
+static void append_chunk_copy PROTO ((unsigned char *, int,
+				      struct jcf_partial *));
+static struct jcf_block * gen_jcf_label PROTO ((struct jcf_partial *));
+static void finish_jcf_block PROTO ((struct jcf_partial *));
+static void define_jcf_label PROTO ((struct jcf_block *,
+				     struct jcf_partial *));
+static struct jcf_block * get_jcf_label_here PROTO ((struct jcf_partial *));
+static void put_linenumber PROTO ((int, struct jcf_partial *));
+static void localvar_alloc PROTO ((tree, struct jcf_partial *));
+static int localvar_free PROTO ((tree, struct jcf_partial *));
+static int get_access_flags PROTO ((tree));
+static void write_chunks PROTO ((FILE *, struct chunk *));
+static int adjust_typed_op PROTO ((tree, int));
+static void generate_bytecode_conditional PROTO ((tree, struct jcf_block *,
+						  struct jcf_block *, int,
+						  struct jcf_partial *));
+static void generate_bytecode_return PROTO ((tree, struct jcf_partial *));
+static void perform_relocations PROTO ((struct jcf_partial *));
+static void init_jcf_state PROTO ((struct jcf_partial *, struct obstack *));
+static void init_jcf_method PROTO ((struct jcf_partial *, tree));
+static void release_jcf_state PROTO ((struct jcf_partial *));
+static struct chunk * generate_classfile PROTO ((tree, struct jcf_partial *));
+
 
 /* Utility macros for appending (big-endian) data to a buffer.
    We assume a local variable 'ptr' points into where we want to
@@ -304,7 +331,7 @@ CHECK_PUT(ptr, state, i)
    Set the data and size fields to DATA and SIZE, respectively.
    However, if DATA is NULL and SIZE>0, allocate a buffer as well. */
 
-struct chunk *
+static struct chunk *
 alloc_chunk (last, data, size, work)
      struct chunk *last;
      unsigned char *data;
@@ -339,7 +366,7 @@ CHECK_OP(struct jcf_partial *state)
 #define CHECK_OP(STATE) ((void)0)
 #endif
 
-unsigned char *
+static unsigned char *
 append_chunk (data, size, state)
      unsigned char *data;
      int size;
@@ -351,7 +378,7 @@ append_chunk (data, size, state)
   return state->chunk->data;
 }
 
-void
+static void
 append_chunk_copy (data, size, state)
      unsigned char *data;
      int size;
@@ -361,7 +388,7 @@ append_chunk_copy (data, size, state)
   memcpy (ptr, data, size);
 }
 
-struct jcf_block *
+static struct jcf_block *
 gen_jcf_label (state)
      struct jcf_partial *state;
 {
@@ -373,7 +400,7 @@ gen_jcf_label (state)
   return block;
 }
 
-void
+static void
 finish_jcf_block (state)
      struct jcf_partial *state;
 {
@@ -400,7 +427,7 @@ finish_jcf_block (state)
   state->code_length = pc;
 }
 
-void
+static void
 define_jcf_label (label, state)
      struct jcf_block *label;
      struct jcf_partial *state;
@@ -417,7 +444,7 @@ define_jcf_label (label, state)
   label->u.relocations = NULL;
 }
 
-struct jcf_block *
+static struct jcf_block *
 get_jcf_label_here (state)
      struct jcf_partial *state;
 {
@@ -433,7 +460,7 @@ get_jcf_label_here (state)
 
 /* Note a line number entry for the current PC and given LINE. */
 
-void
+static void
 put_linenumber (line, state)
      int line;
      struct jcf_partial *state;
@@ -493,7 +520,7 @@ struct localvar_info
 #define localvar_max \
   ((struct localvar_info**) state->localvars.ptr - localvar_buffer)
 
-void
+static void
 localvar_alloc (decl, state)
      tree decl;
      struct jcf_partial *state;
@@ -540,7 +567,7 @@ localvar_alloc (decl, state)
     }
 }
 
-int
+static int
 localvar_free (decl, state)
      tree decl;     
      struct jcf_partial *state;
@@ -571,7 +598,7 @@ localvar_free (decl, state)
 /* Get the access flags of a class (TYPE_DECL), a method (FUNCTION_DECL), or
    a field (FIELD_DECL or VAR_DECL, if static), as encoded in a .class file. */
 
-int
+static int
 get_access_flags (decl)
     tree decl;
 {
@@ -624,7 +651,7 @@ get_access_flags (decl)
 
 /* Write the list of segments starting at CHUNKS to STREAM. */
 
-void
+static void
 write_chunks (stream, chunks)
      FILE* stream;
      struct chunk *chunks;
@@ -786,7 +813,7 @@ field_op (field, opcode, state)
    reference) to 7 (for 'short') which matches the pattern of how JVM
    opcodes typically depend on the operand type. */
 
-int
+static int
 adjust_typed_op (type, max)
      tree type;
      int max;
@@ -940,7 +967,7 @@ emit_store (var, state)
 static void
 emit_unop (opcode, type, state)
      enum java_opcode opcode;
-     tree type;
+     tree type ATTRIBUTE_UNUSED;
      struct jcf_partial *state;
 {
   RESERVE(1);
@@ -1044,7 +1071,7 @@ emit_jsr (target, state)
    TRUE_LABEL may follow right after this. (The idea is that we
    may be able to optimize away GOTO TRUE_LABEL; TRUE_LABEL:) */
 
-void
+static void
 generate_bytecode_conditional (exp, true_label, false_label,
 			       true_branch_first, state)
      tree exp;
@@ -1268,7 +1295,7 @@ call_cleanups (limit, state)
     }
 }
 
-void
+static void
 generate_bytecode_return (exp, state)
      tree exp;
      struct jcf_partial *state;
@@ -2441,7 +2468,7 @@ generate_bytecode_insns (exp, target, st
     }
 }
 
-void
+static void
 perform_relocations (state)
      struct jcf_partial *state;
 {
@@ -2609,7 +2636,7 @@ perform_relocations (state)
   state->code_length = pc;
 }
 
-void
+static void
 init_jcf_state (state, work)
      struct jcf_partial *state;
      struct obstack *work;
@@ -2621,7 +2648,7 @@ init_jcf_state (state, work)
   BUFFER_INIT (&state->bytecode);
 }
 
-void
+static void
 init_jcf_method (state, method)
      struct jcf_partial *state;
      tree method;
@@ -2644,7 +2671,7 @@ init_jcf_method (state, method)
   state->return_value_decl = NULL_TREE;
 }
 
-void
+static void
 release_jcf_state (state)
      struct jcf_partial *state;
 {
@@ -2656,7 +2683,7 @@ release_jcf_state (state)
    in the .class file representation.  The list can be written to a
    .class file using write_chunks.  Allocate chunks from obstack WORK. */
 
-struct chunk *
+static struct chunk *
 generate_classfile (clas, state)
      tree clas;
      struct jcf_partial *state;
@@ -2934,7 +2961,8 @@ static char *
 make_class_file_name (clas)
      tree clas;
 {
-  char *cname, *dname, *slash, *r;
+  const char *dname, *slash;
+  char *cname, *r;
   struct stat sb;
 
   cname = IDENTIFIER_POINTER (identifier_subst (DECL_NAME (TYPE_NAME (clas)),


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