OSDN Git Service

* diagnostic.c (print_error_function): Remove.
[pf3gnuchains/gcc-fork.git] / gcc / java / lang.c
1 /* Java(TM) language-specific utility routines.
2    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
3    Free Software Foundation, Inc.
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 
21
22 Java and all Java-based marks are trademarks or registered trademarks
23 of Sun Microsystems, Inc. in the United States and other countries.
24 The Free Software Foundation is independent of Sun Microsystems, Inc.  */
25
26 /* Hacked by Per Bothner <bothner@cygnus.com> February 1996. */
27
28 #include "config.h"
29 #include "system.h"
30 #include "tree.h"
31 #include "input.h"
32 #include "rtl.h"
33 #include "expr.h"
34 #include "java-tree.h"
35 #include "jcf.h"
36 #include "toplev.h"
37 #include "langhooks.h"
38 #include "langhooks-def.h"
39 #include "flags.h"
40 #include "xref.h"
41 #include "ggc.h"
42 #include "diagnostic.h"
43
44 struct string_option
45 {
46   const char *const string;
47   int *const variable;
48   const int on_value;
49 };
50
51 static const char *java_init PARAMS ((const char *));
52 static void java_finish PARAMS ((void));
53 static void java_init_options PARAMS ((void));
54 static int java_decode_option PARAMS ((int, char **));
55 static void put_decl_string PARAMS ((const char *, int));
56 static void put_decl_node PARAMS ((tree));
57 static void java_print_error_function PARAMS ((diagnostic_context *,
58                                                const char *));
59 static int process_option_with_no PARAMS ((const char *,
60                                            const struct string_option *,
61                                            int));
62
63 #ifndef TARGET_OBJECT_SUFFIX
64 # define TARGET_OBJECT_SUFFIX ".o"
65 #endif
66
67 /* Table indexed by tree code giving a string containing a character
68    classifying the tree code.  Possibilities are
69    t, d, s, c, r, <, 1 and 2.  See java/java-tree.def for details.  */
70
71 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
72
73 const char tree_code_type[] = {
74 #include "tree.def"
75   'x',
76 #include "java-tree.def"
77 };
78 #undef DEFTREECODE
79
80 /* Table indexed by tree code giving number of expression
81    operands beyond the fixed part of the node structure.
82    Not used for types or decls.  */
83
84 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
85
86 const unsigned char tree_code_length[] = {
87 #include "tree.def"
88   0,
89 #include "java-tree.def"
90 };
91 #undef DEFTREECODE
92
93 /* Names of tree components.
94    Used for printing out the tree and error messages.  */
95 #define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
96
97 const char *const tree_code_name[] = {
98 #include "tree.def"
99   "@@dummy",
100 #include "java-tree.def"
101 };
102 #undef DEFTREECODE
103
104 /* Used to avoid printing error messages with bogus function
105    prototypes.  Starts out false.  */
106 static bool inhibit_error_function_printing;
107
108 int compiling_from_source;
109
110 char * resource_name;
111
112 int flag_emit_class_files = 0;
113
114 /* Nonzero if input file is a file with a list of filenames to compile. */
115
116 int flag_filelist_file = 0;
117
118 /* When non zero, we emit xref strings. Values of the flag for xref
119    backends are defined in xref_flag_table, xref.c.  */
120
121 int flag_emit_xref = 0;
122
123 /* When non zero, -Wall was turned on.  */
124 int flag_wall = 0;
125
126 /* When non zero, check for redundant modifier uses.  */
127 int flag_redundant = 0;
128
129 /* When non zero, call a library routine to do integer divisions. */
130 int flag_use_divide_subroutine = 1;
131
132 /* When non zero, generate code for the Boehm GC.  */
133 int flag_use_boehm_gc = 0;
134
135 /* When non zero, assume the runtime uses a hash table to map an
136    object to its synchronization structure.  */
137 int flag_hash_synchronization;
138
139 /* When non zero, assume all native functions are implemented with
140    JNI, not CNI.  */
141 int flag_jni = 0;
142
143 /* When non zero, warn when source file is newer than matching class
144    file.  */
145 int flag_newer = 1;
146
147 /* When non zero, generate checks for references to NULL.  */
148 int flag_check_references = 0;
149
150 /* The encoding of the source file.  */
151 const char *current_encoding = NULL;
152
153 /* When non zero, report the now deprecated empty statements.  */
154 int flag_extraneous_semicolon;
155
156 /* When non zero, always check for a non gcj generated classes archive.  */
157 int flag_force_classes_archive_check;
158
159 /* When zero, don't optimize static class initialization. This flag shouldn't
160    be tested alone, use STATIC_CLASS_INITIALIZATION_OPTIMIZATION_P instead.  */
161 int flag_optimize_sci = 1;
162
163 /* When non zero, use offset tables for virtual method calls
164    in order to improve binary compatibility. */
165 int flag_indirect_dispatch = 0;
166
167 /* When zero, don't generate runtime array store checks. */
168 int flag_store_check = 1;
169
170 /* When non zero, print extra version information.  */
171 static int version_flag = 0;
172
173 /* Table of language-dependent -f options.
174    STRING is the option name.  VARIABLE is the address of the variable.
175    ON_VALUE is the value to store in VARIABLE
176     if `-fSTRING' is seen as an option.
177    (If `-fno-STRING' is seen as an option, the opposite value is stored.)  */
178
179 static const struct string_option
180 lang_f_options[] =
181 {
182   {"emit-class-file", &flag_emit_class_files, 1},
183   {"emit-class-files", &flag_emit_class_files, 1},
184   {"filelist-file", &flag_filelist_file, 1},
185   {"use-divide-subroutine", &flag_use_divide_subroutine, 1},
186   {"use-boehm-gc", &flag_use_boehm_gc, 1},
187   {"hash-synchronization", &flag_hash_synchronization, 1},
188   {"jni", &flag_jni, 1},
189   {"check-references", &flag_check_references, 1},
190   {"force-classes-archive-check", &flag_force_classes_archive_check, 1},
191   {"optimize-static-class-initialization", &flag_optimize_sci, 1 },
192   {"indirect-dispatch", &flag_indirect_dispatch, 1},
193   {"store-check", &flag_store_check, 1}
194 };
195
196 static const struct string_option
197 lang_W_options[] =
198 {
199   { "redundant-modifiers", &flag_redundant, 1 },
200   { "extraneous-semicolon", &flag_extraneous_semicolon, 1 },
201   { "out-of-date", &flag_newer, 1 }
202 };
203
204 JCF *current_jcf;
205
206 /* Variable controlling how dependency tracking is enabled in
207    java_init.  */
208 static int dependency_tracking = 0;
209
210 /* Flag values for DEPENDENCY_TRACKING.  */
211 #define DEPEND_SET_FILE 1
212 #define DEPEND_ENABLE   2
213 #define DEPEND_TARGET_SET 4
214 #define DEPEND_FILE_ALREADY_SET 8
215
216 #undef LANG_HOOKS_NAME
217 #define LANG_HOOKS_NAME "GNU Java"
218 #undef LANG_HOOKS_INIT
219 #define LANG_HOOKS_INIT java_init
220 #undef LANG_HOOKS_FINISH
221 #define LANG_HOOKS_FINISH java_finish
222 #undef LANG_HOOKS_INIT_OPTIONS
223 #define LANG_HOOKS_INIT_OPTIONS java_init_options
224 #undef LANG_HOOKS_DECODE_OPTION
225 #define LANG_HOOKS_DECODE_OPTION java_decode_option
226 #undef LANG_HOOKS_SET_YYDEBUG
227 #define LANG_HOOKS_SET_YYDEBUG java_set_yydebug
228 #undef LANG_HOOKS_PARSE_FILE
229 #define LANG_HOOKS_PARSE_FILE java_parse_file
230 #undef LANG_HOOKS_MARK_TREE
231 #define LANG_HOOKS_MARK_TREE java_mark_tree
232 #undef LANG_HOOKS_EXPAND_EXPR
233 #define LANG_HOOKS_EXPAND_EXPR java_expand_expr
234 #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
235 #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL java_dup_lang_specific_decl
236 #undef LANG_HOOKS_DECL_PRINTABLE_NAME
237 #define LANG_HOOKS_DECL_PRINTABLE_NAME lang_printable_name
238 #undef LANG_HOOKS_PRINT_ERROR_FUNCTION
239 #define LANG_HOOKS_PRINT_ERROR_FUNCTION java_print_error_function
240 #undef LANG_HOOKS_TYPE_FOR_MODE
241 #define LANG_HOOKS_TYPE_FOR_MODE java_type_for_mode
242 #undef LANG_HOOKS_TYPE_FOR_SIZE
243 #define LANG_HOOKS_TYPE_FOR_SIZE java_type_for_size
244
245 /* Each front end provides its own.  */
246 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
247
248 /* Process an option that can accept a `no-' form.
249    Return 1 if option found, 0 otherwise.  */
250 static int
251 process_option_with_no (p, table, table_size)
252      const char *p;
253      const struct string_option *table;
254      int table_size;
255 {
256   int j;
257
258   for (j = 0; j < table_size; j++)
259     {
260       if (!strcmp (p, table[j].string))
261         {
262           *table[j].variable = table[j].on_value;
263           return 1;
264         }
265       if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
266           && ! strcmp (p+3, table[j].string))
267         {
268           *table[j].variable = ! table[j].on_value;
269           return 1;
270         }
271     }
272
273   return 0;
274 }
275
276 /*
277  * process java-specific compiler command-line options
278  * return 0, but do not complain if the option is not recognised.
279  */
280 static int
281 java_decode_option (argc, argv)
282      int argc __attribute__ ((__unused__));
283      char **argv;
284 {
285   char *p = argv[0];
286
287   jcf_path_init ();
288
289   if (strcmp (p, "-version") == 0)
290     {
291       version_flag = 1;
292       /* We return 0 so that the caller can process this.  */
293       return 0;
294     }
295
296 #define CLARG "-fcompile-resource="
297   if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
298     {
299       resource_name = p + sizeof (CLARG) - 1;
300       return 1;
301     }
302 #undef CLARG
303 #define CLARG "-fassume-compiled="
304   if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
305     {
306       add_assume_compiled (p + sizeof (CLARG) - 1, 0);
307       return 1;
308     }
309 #undef CLARG
310 #define CLARG "-fno-assume-compiled="
311   if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
312     {
313       add_assume_compiled (p + sizeof (CLARG) - 1, 1);
314       return 1;
315     }
316 #undef CLARG
317 #define CLARG "-fassume-compiled"
318   if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
319     {
320       add_assume_compiled ("", 0);
321       return 1;
322     }
323 #undef CLARG
324 #define CLARG "-fno-assume-compiled"
325   if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
326     {
327       add_assume_compiled ("", 1);
328       return 1;
329     }
330 #undef CLARG
331 #define CLARG "-fCLASSPATH="
332   if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
333     {
334       jcf_path_classpath_arg (p + sizeof (CLARG) - 1);
335       return 1;
336     }
337 #undef CLARG
338 #define CLARG "-fclasspath="
339   if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
340     {
341       jcf_path_classpath_arg (p + sizeof (CLARG) - 1);
342       return 1;
343     }
344 #undef CLARG
345 #define CLARG "-fbootclasspath="
346   if (strncmp (p, CLARG, sizeof (CLARG) - 1) == 0)
347     {
348       jcf_path_bootclasspath_arg (p + sizeof (CLARG) - 1);
349       return 1;
350     }
351 #undef CLARG
352   else if (strncmp (p, "-I", 2) == 0)
353     {
354       jcf_path_include_arg (p + 2);
355       return 1;
356     }
357
358 #define ARG "-foutput-class-dir="
359   if (strncmp (p, ARG, sizeof (ARG) - 1) == 0)
360     {
361       jcf_write_base_directory = p + sizeof (ARG) - 1;
362       return 1;
363     }
364 #undef ARG
365 #define ARG "-fencoding="
366   if (strncmp (p, ARG, sizeof (ARG) - 1) == 0)
367     {
368       current_encoding = p + sizeof (ARG) - 1;
369       return 1;
370     }
371 #undef ARG
372
373   if (p[0] == '-' && p[1] == 'f')
374     {
375       /* Some kind of -f option.
376          P's value is the option sans `-f'.
377          Search for it in the table of options.  */
378       p += 2;
379       if (process_option_with_no (p, lang_f_options,
380                                   ARRAY_SIZE (lang_f_options)))
381         return 1;
382       return dump_switch_p (p);
383     }
384
385   if (strcmp (p, "-Wall") == 0)
386     {
387       flag_wall = 1;
388       flag_redundant = 1;
389       flag_extraneous_semicolon = 1;
390       /* When -Wall given, enable -Wunused.  We do this because the C
391          compiler does it, and people expect it.  */
392       set_Wunused (1);
393       return 1;
394     }
395
396   if (p[0] == '-' && p[1] == 'W')
397     {
398       /* Skip `-W' and see if we accept the option or its `no-' form.  */
399       p += 2;
400       return process_option_with_no (p, lang_W_options,
401                                      ARRAY_SIZE (lang_W_options));
402     }
403
404   if (strcmp (p, "-MD") == 0)
405     {
406       jcf_dependency_init (1);
407       dependency_tracking |= DEPEND_SET_FILE | DEPEND_ENABLE;
408       return 1;
409     }
410   else if (strcmp (p, "-MMD") == 0)
411     {
412       jcf_dependency_init (0);
413       dependency_tracking |= DEPEND_SET_FILE | DEPEND_ENABLE;
414       return 1;
415     }
416   else if (strcmp (p, "-M") == 0)
417     {
418       jcf_dependency_init (1);
419       dependency_tracking |= DEPEND_ENABLE;
420       return 1;
421     }
422   else if (strcmp (p, "-MM") == 0)
423     {
424       jcf_dependency_init (0);
425       dependency_tracking |= DEPEND_ENABLE;
426       return 1;
427     }
428   else if (strcmp (p, "-MP") == 0)
429     {
430       jcf_dependency_print_dummies ();
431       return 1;
432     }
433   else if (strcmp (p, "-MT") == 0)
434     {
435       jcf_dependency_set_target (argv[1]);
436       dependency_tracking |= DEPEND_TARGET_SET;
437       return 2;
438     }
439   else if (strcmp (p, "-MF") == 0)
440     {
441       jcf_dependency_set_dep_file (argv[1]);
442       dependency_tracking |= DEPEND_FILE_ALREADY_SET;
443       return 2;
444     }
445
446   return 0;
447 }
448
449 /* Global open file.  */
450 FILE *finput;
451
452 static const char *
453 java_init (filename)
454      const char *filename;
455 {
456 #if 0
457   extern int flag_minimal_debug;
458   flag_minimal_debug = 0;
459 #endif
460
461   /* Open input file.  */
462
463   if (filename == 0 || !strcmp (filename, "-"))
464     {
465       finput = stdin;
466       filename = "stdin";
467
468       if (dependency_tracking)
469         error ("can't do dependency tracking with input from stdin");
470     }
471   else
472     {
473       if (dependency_tracking)
474         {
475           char *dot;
476
477           /* If the target is set and the output filename is set, then
478              there's no processing to do here.  Otherwise we must
479              compute one or the other.  */
480           if (! ((dependency_tracking & DEPEND_TARGET_SET)
481                  && (dependency_tracking & DEPEND_FILE_ALREADY_SET)))
482             {
483               dot = strrchr (filename, '.');
484               if (dot == NULL)
485                 error ("couldn't determine target name for dependency tracking");
486               else
487                 {
488                   char *buf = (char *) xmalloc (dot - filename +
489                                                 3 + sizeof (TARGET_OBJECT_SUFFIX));
490                   strncpy (buf, filename, dot - filename);
491
492                   /* If emitting class files, we might have multiple
493                      targets.  The class generation code takes care of
494                      registering them.  Otherwise we compute the
495                      target name here.  */
496                   if ((dependency_tracking & DEPEND_TARGET_SET))
497                     ; /* Nothing.  */
498                   else if (flag_emit_class_files)
499                     jcf_dependency_set_target (NULL);
500                   else
501                     {
502                       strcpy (buf + (dot - filename), TARGET_OBJECT_SUFFIX);
503                       jcf_dependency_set_target (buf);
504                     }
505
506                   if ((dependency_tracking & DEPEND_FILE_ALREADY_SET))
507                     ; /* Nothing.  */
508                   else if ((dependency_tracking & DEPEND_SET_FILE))
509                     {
510                       strcpy (buf + (dot - filename), ".d");
511                       jcf_dependency_set_dep_file (buf);
512                     }
513                   else
514                     jcf_dependency_set_dep_file ("-");
515
516                   free (buf);
517                 }
518             }
519         }
520     }
521
522   jcf_path_init ();
523   jcf_path_seal (version_flag);
524
525   java_init_decl_processing ();
526
527   using_eh_for_cleanups ();
528
529   return filename;
530 }
531
532 static void
533 java_finish ()
534 {
535   jcf_dependency_write ();
536 }
537
538 /* Buffer used by lang_printable_name. */
539 static char *decl_buf = NULL;
540
541 /* Allocated size of decl_buf. */
542 static int decl_buflen = 0;
543
544 /* Length of used part of decl_buf;  position for next character. */
545 static int decl_bufpos = 0;
546
547 /* Append the string STR to decl_buf.
548    It length is given by LEN;  -1 means the string is nul-terminated. */
549
550 static void
551 put_decl_string (str, len)
552      const char *str;
553      int len;
554 {
555   if (len < 0)
556     len = strlen (str);
557   if (decl_bufpos + len >= decl_buflen)
558     {
559       if (decl_buf == NULL)
560         {
561           decl_buflen = len + 100;
562           decl_buf = (char *) xmalloc (decl_buflen);
563         }
564       else
565         {
566           decl_buflen *= 2;
567           decl_buf = (char *) xrealloc (decl_buf, decl_buflen);
568         }
569     }
570   strcpy (decl_buf + decl_bufpos, str);
571   decl_bufpos += len;
572 }
573
574 /* Append to decl_buf a printable name for NODE. */
575
576 static void
577 put_decl_node (node)
578      tree node;
579 {
580   int was_pointer = 0;
581   if (TREE_CODE (node) == POINTER_TYPE)
582     {
583       node = TREE_TYPE (node);
584       was_pointer = 1;
585     }
586   if (TREE_CODE_CLASS (TREE_CODE (node)) == 'd'
587       && DECL_NAME (node) != NULL_TREE)
588     {
589       if (TREE_CODE (node) == FUNCTION_DECL)
590         {
591           /* We want to print the type the DECL belongs to. We don't do
592              that when we handle constructors. */
593           if (! DECL_CONSTRUCTOR_P (node)
594               && ! DECL_ARTIFICIAL (node) && DECL_CONTEXT (node))
595             {
596               put_decl_node (TYPE_NAME (DECL_CONTEXT (node)));
597               put_decl_string (".", 1);
598             }
599           if (! DECL_CONSTRUCTOR_P (node))
600             put_decl_node (DECL_NAME (node));
601           if (TREE_TYPE (node) != NULL_TREE)
602             {
603               int i = 0;
604               tree args = TYPE_ARG_TYPES (TREE_TYPE (node));
605               if (TREE_CODE (TREE_TYPE (node)) == METHOD_TYPE)
606                 args = TREE_CHAIN (args);
607               put_decl_string ("(", 1);
608               for ( ; args != end_params_node;  args = TREE_CHAIN (args), i++)
609                 {
610                   if (i > 0)
611                     put_decl_string (",", 1);
612                   put_decl_node (TREE_VALUE (args));
613                 }
614               put_decl_string (")", 1);
615             }
616         }
617       else
618         put_decl_node (DECL_NAME (node));
619     }
620   else if (TREE_CODE_CLASS (TREE_CODE (node)) == 't'
621       && TYPE_NAME (node) != NULL_TREE)
622     {
623       if (TREE_CODE (node) == RECORD_TYPE && TYPE_ARRAY_P (node))
624         {
625           put_decl_node (TYPE_ARRAY_ELEMENT (node));
626           put_decl_string("[]", 2);
627         }
628       else if (node == promoted_byte_type_node)
629         put_decl_string ("byte", 4);
630       else if (node == promoted_short_type_node)
631         put_decl_string ("short", 5);
632       else if (node == promoted_char_type_node)
633         put_decl_string ("char", 4);
634       else if (node == promoted_boolean_type_node)
635         put_decl_string ("boolean", 7);
636       else if (node == void_type_node && was_pointer)
637         put_decl_string ("null", 4);
638       else
639         put_decl_node (TYPE_NAME (node));
640     }
641   else if (TREE_CODE (node) == IDENTIFIER_NODE)
642     put_decl_string (IDENTIFIER_POINTER (node), IDENTIFIER_LENGTH (node));
643   else
644     put_decl_string ("<unknown>", -1);
645 }
646
647 /* Return a user-friendly name for DECL.
648    The resulting string is only valid until the next call.
649    The value of the hook decl_printable_name is this function,
650    which is also called directly by java_print_error_function. */
651
652 const char *
653 lang_printable_name (decl, v)
654      tree decl;
655      int v  __attribute__ ((__unused__));
656 {
657   decl_bufpos = 0;
658   put_decl_node (decl);
659   put_decl_string ("", 1);
660   return decl_buf;
661 }
662
663 /* Does the same thing that lang_printable_name, but add a leading
664    space to the DECL name string -- With Leading Space.  */
665
666 const char *
667 lang_printable_name_wls (decl, v)
668      tree decl;
669      int v  __attribute__ ((__unused__));
670 {
671   decl_bufpos = 1;
672   put_decl_node (decl);
673   put_decl_string ("", 1);
674   decl_buf [0] = ' ';
675   return decl_buf;
676 }
677
678 /* Print on stderr the current class and method context.  This function
679    is the value of the hook print_error_function. */
680
681 static void
682 java_print_error_function (context, file)
683      diagnostic_context *context __attribute__((__unused__));
684      const char *file;
685 {
686   static tree last_error_function_context = NULL_TREE;
687   static tree last_error_function = NULL;
688   static int initialized_p;
689
690   /* Register LAST_ERROR_FUNCTION_CONTEXT and LAST_ERROR_FUNCTION with
691      the garbage collector.  */
692   if (!initialized_p)
693     {
694       ggc_add_tree_root (&last_error_function_context, 1);
695       ggc_add_tree_root (&last_error_function, 1);
696       initialized_p = 1;
697     }
698
699   /* Don't print error messages with bogus function prototypes.  */
700   if (inhibit_error_function_printing)
701     return;
702
703   if (current_function_decl != NULL
704       && DECL_CONTEXT (current_function_decl) != last_error_function_context)
705     {
706       if (file)
707         fprintf (stderr, "%s: ", file);
708
709       last_error_function_context = DECL_CONTEXT (current_function_decl);
710       fprintf (stderr, "In class `%s':\n",
711                lang_printable_name (last_error_function_context, 0));
712     }
713   if (last_error_function != current_function_decl)
714     {
715       if (file)
716         fprintf (stderr, "%s: ", file);
717
718       if (current_function_decl == NULL)
719         fprintf (stderr, "At top level:\n");
720       else
721         {
722           const char *name = lang_printable_name (current_function_decl, 2);
723           fprintf (stderr, "In %s `%s':\n",
724                    (DECL_CONSTRUCTOR_P (current_function_decl) ? "constructor" 
725                     : "method"),
726                    name);
727         }
728
729       last_error_function = current_function_decl;
730     }
731
732 }
733
734 /* Called to install the PRINT_ERROR_FUNCTION hook differently
735    according to LEVEL. LEVEL is 1 during early parsing, when function
736    prototypes aren't fully resolved. java_print_error_function is set
737    so it doesn't print incomplete function prototypes. When LEVEL is
738    2, function prototypes are fully resolved and can be printed when
739    reporting errors.  */
740
741 void lang_init_source (level)
742      int level;
743 {
744   inhibit_error_function_printing = (level == 1);
745 }
746
747 static void
748 java_init_options ()
749 {
750   flag_bounds_check = 1;
751   flag_exceptions = 1;
752   flag_non_call_exceptions = 1;
753
754   /* In Java floating point operations never trap.  */
755   flag_trapping_math = 0;
756 }