]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Makefile.in (PARSE_C, [...]): Move dependencies on lex.c, lex.h, and PARSE_H to...
authorZack Weinberg <zack@wolery.cumb.org>
Thu, 17 Feb 2000 04:19:34 +0000 (04:19 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Thu, 17 Feb 2000 04:19:34 +0000 (04:19 +0000)
* Makefile.in (PARSE_C, PARSE_SCAN_C): Move dependencies on
lex.c, lex.h, and PARSE_H to...
(parse.o, parse-scan.o): ...here, respectively.

* lex.c: Split out code that may trigger SIGFPE from yylex()
to its own function.
* lex.h (JAVA_FLOAT_RANGE_ERROR): Don't set value.

From-SVN: r32025

gcc/java/ChangeLog
gcc/java/Makefile.in
gcc/java/lex.c
gcc/java/lex.h

index 3a0bf8cc5d3af94456ab567452019efd46d96f4e..7047b9d006819313883b59a7d746bd506e3a8eb0 100644 (file)
@@ -1,3 +1,13 @@
+2000-02-16  Zack Weinberg  <zack@wolery.cumb.org>
+
+       * Makefile.in (PARSE_C, PARSE_SCAN_C): Move dependencies on
+       lex.c, lex.h, and PARSE_H to...                            
+       (parse.o, parse-scan.o): ...here, respectively.
+
+       * lex.c: Split out code that may trigger SIGFPE from yylex()
+       to its own function.
+       * lex.h (JAVA_FLOAT_RANGE_ERROR): Don't set value.
+
 2000-02-16  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * Make-lang.in (jvspec.o): Depend on $(GCC_H), not gcc.h.
index 07e4f22db5fd6a86fb10f0a868c66426adf00941..633a13f11fbb6a312cf4ba9001058b662e9f3d97 100644 (file)
@@ -217,12 +217,11 @@ PARSE_C = $(PARSE_DIR)/parse.c
 PARSE_SCAN_C = $(PARSE_DIR)/parse-scan.c
 PARSE_H = $(srcdir)/parse.h
 
-$(PARSE_C):  $(srcdir)/parse.y $(srcdir)/lex.c $(PARSE_H) $(srcdir)/lex.h
+$(PARSE_C):  $(srcdir)/parse.y
        $(SET_BISON); \
        cd $(PARSE_DIR) && $$bison -t $(BISONFLAGS) $(JAVABISONFLAGS) \
            -o parse.c $(PARSE_RELDIR)/parse.y
-$(PARSE_SCAN_C):  $(srcdir)/parse-scan.y $(srcdir)/lex.c $(PARSE_H) \
-         $(srcdir)/lex.h
+$(PARSE_SCAN_C):  $(srcdir)/parse-scan.y
        $(SET_BISON); \
        cd $(PARSE_DIR) && $$bison -t $(BISONFLAGS) -o parse-scan.c \
            $(PARSE_RELDIR)/parse-scan.y
@@ -262,7 +261,8 @@ clean:  mostlyclean
 force:
 
 parse.o : $(PARSE_C) jcf-reader.c $(CONFIG_H) $(srcdir)/../system.h \
-  $(srcdir)/../function.h $(JAVA_TREE_H)
+  $(srcdir)/../function.h $(JAVA_TREE_H) $(srcdir)/lex.c $(PARSE_H) \
+  $(srcdir)/lex.h
 jcf-dump.o : $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H) jcf-dump.c \
   jcf-reader.c jcf.h javaop.h javaop.def $(srcdir)/../version.h
 gjavah.o : $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H) gjavah.c \
@@ -300,7 +300,8 @@ lang.o : lang.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../input.h \
   $(srcdir)/../toplev.h $(srcdir)/../system.h $(RTL_H) $(EXPR_H)
 mangle.o : mangle.c $(CONFIG_H) jcf.h $(JAVA_TREE_H) $(srcdir)/../system.h \
   $(srcdir)/../toplev.h
-parse-scan.o : $(CONFIG_H) $(srcdir)/../system.h $(srcdir)/../toplev.h
+parse-scan.o : $(CONFIG_H) $(srcdir)/../system.h $(srcdir)/../toplev.h \
+  $(srcdir)/lex.c $(PARSE_H) $(srcdir)/lex.h
 typeck.o : typeck.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h convert.h \
   $(srcdir)/../toplev.h $(srcdir)/../system.h
 verify.o : verify.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h javaop.h java-opcodes.h \
index 24ab8ef8b5fe5b7d0104585aadcab3c95f57f03a..58df299f1a5f007add2d5c6eb439221214782916 100644 (file)
@@ -517,6 +517,44 @@ java_parse_escape_sequence ()
     }
 }
 
+/* Isolate the code which may raise an arithmetic exception in its
+   own function.  */
+
+#ifndef JC1_LITE
+struct jpa_args
+{
+  YYSTYPE *java_lval;
+  char *literal_token;
+  int fflag;
+  int number_beginning;
+};
+
+static void java_perform_atof  PARAMS ((PTR));
+
+static void
+java_perform_atof (av)
+     PTR av;
+{
+  struct jpa_args *a = (struct jpa_args *)av;
+  YYSTYPE *java_lval = a->java_lval;
+  int number_beginning = a->number_beginning;
+  REAL_VALUE_TYPE value;
+  tree type = (a->fflag ? FLOAT_TYPE_NODE : DOUBLE_TYPE_NODE);
+
+  SET_REAL_VALUE_ATOF (value,
+                      REAL_VALUE_ATOF (a->literal_token, TYPE_MODE (type)));
+
+  if (REAL_VALUE_ISINF (value)
+      || REAL_VALUE_ISNAN (value))
+    {
+      JAVA_FLOAT_RANGE_ERROR ((a->fflag ? "float" : "double"));
+      value = DCONST0;
+    }
+
+  SET_LVAL_NODE_TYPE (build_real (type, value), type);
+}
+#endif
+
 static int yylex               PARAMS ((YYSTYPE *));
 
 static int
@@ -762,12 +800,9 @@ java_lex (java_lval)
                }
              else
                {
-                 jmp_buf handler;
-                 REAL_VALUE_TYPE value;
 #ifndef JC1_LITE
-                 tree type = (fflag ? FLOAT_TYPE_NODE : DOUBLE_TYPE_NODE);
+                 struct jpa_args a;
 #endif
-
                  if (stage != 4) /* Don't push back fF/dD */
                    java_unget_unicode ();
                  
@@ -778,28 +813,18 @@ java_lex (java_lval)
                  literal_token [literal_index] = '\0';
                  JAVA_LEX_LIT (literal_token, radix);
 
-                 if (setjmp (handler))
-                   {
-                     JAVA_FLOAT_RANGE_ERROR ((fflag ? "float" : "double"));
-                     value = DCONST0;
-                   }
-                 else
-                   {
-                     SET_FLOAT_HANDLER (handler);
-                     SET_REAL_VALUE_ATOF 
-                       (value, REAL_VALUE_ATOF (literal_token, 
-                                                TYPE_MODE (type)));
-
-                     if (REAL_VALUE_ISINF (value))
-                       JAVA_FLOAT_RANGE_ERROR ((fflag ? "float" : "double"));
-
-                     if (REAL_VALUE_ISNAN (value))
-                       JAVA_FLOAT_RANGE_ERROR ((fflag ? "float" : "double"));
-
-                     SET_LVAL_NODE_TYPE (build_real (type, value), type);
-                     SET_FLOAT_HANDLER (NULL_PTR);
-                     return FP_LIT_TK;
-                   }
+#ifndef JC1_LITE
+                 a.literal_token = literal_token;
+                 a.fflag = fflag;
+                 a.java_lval = java_lval;
+                 a.number_beginning = number_beginning;
+                 if (do_float_handler (java_perform_atof, (PTR) &a))
+                   return FP_LIT_TK;
+
+                 JAVA_FLOAT_RANGE_ERROR ((fflag ? "float" : "double"));
+#else
+                 return FP_LIT_TK;
+#endif
                }
            }
        } /* JAVA_ASCCI_FPCHAR (c) */
index 7bb6558d85e7c3bce22b472bd727b1cda0a4039d..d4754aba67ff62dd1685e08954cde73b50094624 100644 (file)
@@ -180,7 +180,6 @@ extern void set_float_handler PARAMS ((jmp_buf));
     sprintf (msg, "Floating pointer literal exceeds range of `%s'", (m)); \
     java_lex_error (msg, 0);                                             \
     ctxp->c_line->current = i;                                           \
-    value = dconst0;                                                     \
   }
 #define JAVA_INTEGRAL_RANGE_ERROR(m)           \
   {                                            \