* i386-linux-tdep.c (I386_LINUX_RECORD_SIZE_*,
[deliverable/binutils-gdb.git] / gdb / jv-exp.y
index fcbb84f2c7c847f1b85316c94e78678b6f49f941..89ec3e9460771ad0400729a22b2ca70f617a9f18 100644 (file)
@@ -1,23 +1,21 @@
 /* YACC parser for Java expressions, for GDB.
 /* YACC parser for Java expressions, for GDB.
-   Copyright (C) 1997, 1998, 1999, 2000, 2006, 2007
+   Copyright (C) 1997, 1998, 1999, 2000, 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
 
    Free Software Foundation, Inc.
 
-This file is part of GDB.
+   This file is part of GDB.
 
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
 
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Parse a Java expression from text in a string,
    and return the result as a  struct expression  pointer.
 
 /* Parse a Java expression from text in a string,
    and return the result as a  struct expression  pointer.
@@ -51,6 +49,8 @@ Boston, MA 02110-1301, USA.  */
 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
 #include "block.h"
 
 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
 #include "block.h"
 
+#define parse_type builtin_type (parse_gdbarch)
+
 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
    as well as gratuitiously global symbol names, so we can have multiple
    yacc generated parsers in gdb.  Note that these are only the variables
 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
    as well as gratuitiously global symbol names, so we can have multiple
    yacc generated parsers in gdb.  Note that these are only the variables
@@ -691,11 +691,7 @@ Expression:
 /*** Needs some error checking for the float case ***/
 
 static int
 /*** Needs some error checking for the float case ***/
 
 static int
-parse_number (p, len, parsed_float, putithere)
-     char *p;
-     int len;
-     int parsed_float;
-     YYSTYPE *putithere;
+parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere)
 {
   ULONGEST n = 0;
   ULONGEST limit, limit_div_base;
 {
   ULONGEST n = 0;
   ULONGEST limit, limit_div_base;
@@ -713,7 +709,7 @@ parse_number (p, len, parsed_float, putithere)
       char saved_char = p[len];
 
       p[len] = 0;      /* null-terminate the token */
       char saved_char = p[len];
 
       p[len] = 0;      /* null-terminate the token */
-      num = sscanf (p, DOUBLEST_SCAN_FORMAT "%c",
+      num = sscanf (p, "%" DOUBLEST_SCAN_FORMAT "%c",
                    &putithere->typed_val_float.dval, &c);
       p[len] = saved_char;     /* restore the input stream */
       if (num != 1)            /* check scanf found ONLY a float ... */
                    &putithere->typed_val_float.dval, &c);
       p[len] = saved_char;     /* restore the input stream */
       if (num != 1)            /* check scanf found ONLY a float ... */
@@ -723,9 +719,9 @@ parse_number (p, len, parsed_float, putithere)
       c = tolower (p[len - 1]);
 
       if (c == 'f' || c == 'F')
       c = tolower (p[len - 1]);
 
       if (c == 'f' || c == 'F')
-       putithere->typed_val_float.type = builtin_type_float;
+       putithere->typed_val_float.type = parse_type->builtin_float;
       else if (isdigit (c) || c == '.' || c == 'd' || c == 'D')
       else if (isdigit (c) || c == '.' || c == 'd' || c == 'D')
-       putithere->typed_val_float.type = builtin_type_double;
+       putithere->typed_val_float.type = parse_type->builtin_double;
       else
        return ERROR;
 
       else
        return ERROR;
 
@@ -849,7 +845,7 @@ static const struct token tokentab2[] =
 /* Read one token, getting characters through lexptr.  */
 
 static int
 /* Read one token, getting characters through lexptr.  */
 
 static int
-yylex ()
+yylex (void)
 {
   int c;
   int namelen;
 {
   int c;
   int namelen;
@@ -1128,34 +1124,34 @@ yylex ()
   switch (namelen)
     {
     case 7:
   switch (namelen)
     {
     case 7:
-      if (DEPRECATED_STREQN (tokstart, "boolean", 7))
+      if (strncmp (tokstart, "boolean", 7) == 0)
        return BOOLEAN;
       break;
     case 6:
        return BOOLEAN;
       break;
     case 6:
-      if (DEPRECATED_STREQN (tokstart, "double", 6))      
+      if (strncmp (tokstart, "double", 6) == 0)      
        return DOUBLE;
       break;
     case 5:
        return DOUBLE;
       break;
     case 5:
-      if (DEPRECATED_STREQN (tokstart, "short", 5))
+      if (strncmp (tokstart, "short", 5) == 0)
        return SHORT;
        return SHORT;
-      if (DEPRECATED_STREQN (tokstart, "false", 5))
+      if (strncmp (tokstart, "false", 5) == 0)
        {
          yylval.lval = 0;
          return BOOLEAN_LITERAL;
        }
        {
          yylval.lval = 0;
          return BOOLEAN_LITERAL;
        }
-      if (DEPRECATED_STREQN (tokstart, "super", 5))
+      if (strncmp (tokstart, "super", 5) == 0)
        return SUPER;
        return SUPER;
-      if (DEPRECATED_STREQN (tokstart, "float", 5))
+      if (strncmp (tokstart, "float", 5) == 0)
        return FLOAT;
       break;
     case 4:
        return FLOAT;
       break;
     case 4:
-      if (DEPRECATED_STREQN (tokstart, "long", 4))
+      if (strncmp (tokstart, "long", 4) == 0)
        return LONG;
        return LONG;
-      if (DEPRECATED_STREQN (tokstart, "byte", 4))
+      if (strncmp (tokstart, "byte", 4) == 0)
        return BYTE;
        return BYTE;
-      if (DEPRECATED_STREQN (tokstart, "char", 4))
+      if (strncmp (tokstart, "char", 4) == 0)
        return CHAR;
        return CHAR;
-      if (DEPRECATED_STREQN (tokstart, "true", 4))
+      if (strncmp (tokstart, "true", 4) == 0)
        {
          yylval.lval = 1;
          return BOOLEAN_LITERAL;
        {
          yylval.lval = 1;
          return BOOLEAN_LITERAL;
@@ -1195,8 +1191,7 @@ yylex ()
 }
 
 void
 }
 
 void
-yyerror (msg)
-     char *msg;
+yyerror (char *msg)
 {
   if (prev_lexptr)
     lexptr = prev_lexptr;
 {
   if (prev_lexptr)
     lexptr = prev_lexptr;
@@ -1208,9 +1203,7 @@ yyerror (msg)
 }
 
 static struct type *
 }
 
 static struct type *
-java_type_from_name (name)
-     struct stoken name;
+java_type_from_name (struct stoken name)
 {
   char *tmp = copy_name (name);
   struct type *typ = java_lookup_class (tmp);
 {
   char *tmp = copy_name (name);
   struct type *typ = java_lookup_class (tmp);
@@ -1229,7 +1222,7 @@ push_variable (struct stoken name)
   int is_a_field_of_this = 0;
   struct symbol *sym;
   sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN,
   int is_a_field_of_this = 0;
   struct symbol *sym;
   sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN,
-                      &is_a_field_of_this, (struct symtab **) NULL);
+                      &is_a_field_of_this);
   if (sym && SYMBOL_CLASS (sym) != LOC_TYPEDEF)
     {
       if (symbol_read_needs_frame (sym))
   if (sym && SYMBOL_CLASS (sym) != LOC_TYPEDEF)
     {
       if (symbol_read_needs_frame (sym))
@@ -1269,8 +1262,7 @@ push_variable (struct stoken name)
    qualified name (has '.'), generate a field access for each part. */
 
 static void
    qualified name (has '.'), generate a field access for each part. */
 
 static void
-push_fieldnames (name)
-     struct stoken name;
+push_fieldnames (struct stoken name)
 {
   int i;
   struct stoken token;
 {
   int i;
   struct stoken token;
@@ -1361,8 +1353,7 @@ push_qualified_expression_name (struct stoken name, int dot_index)
    Handle VAR, TYPE, TYPE.FIELD1....FIELDN and VAR.FIELD1....FIELDN. */
 
 static void
    Handle VAR, TYPE, TYPE.FIELD1....FIELDN and VAR.FIELD1....FIELDN. */
 
 static void
-push_expression_name (name)
-     struct stoken name;
+push_expression_name (struct stoken name)
 {
   char *tmp;
   struct type *typ;
 {
   char *tmp;
   struct type *typ;
@@ -1397,11 +1388,7 @@ push_expression_name (name)
 
       msymbol = lookup_minimal_symbol (tmp, NULL, NULL);
       if (msymbol != NULL)
 
       msymbol = lookup_minimal_symbol (tmp, NULL, NULL);
       if (msymbol != NULL)
-       {
-         write_exp_msymbol (msymbol,
-                            lookup_function_type (builtin_type_int),
-                            builtin_type_int);
-       }
+       write_exp_msymbol (msymbol);
       else if (!have_full_symbols () && !have_partial_symbols ())
        error (_("No symbol table is loaded.  Use the \"file\" command"));
       else
       else if (!have_full_symbols () && !have_partial_symbols ())
        error (_("No symbol table is loaded.  Use the \"file\" command"));
       else
@@ -1420,9 +1407,7 @@ push_expression_name (name)
    into a freshly malloc'ed struct expression.  Its language_defn is set
    to null.  */
 static struct expression *
    into a freshly malloc'ed struct expression.  Its language_defn is set
    to null.  */
 static struct expression *
-copy_exp (expr, endpos)
-     struct expression *expr;
-     int endpos;
+copy_exp (struct expression *expr, int endpos)
 {
   int len = length_of_subexp (expr, endpos);
   struct expression *new
 {
   int len = length_of_subexp (expr, endpos);
   struct expression *new
@@ -1436,9 +1421,7 @@ copy_exp (expr, endpos)
 
 /* Insert the expression NEW into the current expression (expout) at POS.  */
 static void
 
 /* Insert the expression NEW into the current expression (expout) at POS.  */
 static void
-insert_exp (pos, new)
-     int pos;
-     struct expression *new;
+insert_exp (int pos, struct expression *new)
 {
   int newlen = new->nelts;
 
 {
   int newlen = new->nelts;
 
This page took 0.061106 seconds and 4 git commands to generate.