PR gas/11395
[deliverable/binutils-gdb.git] / gdb / p-exp.y
index fce3fc7966521f76aa1c286b17a3dd24e84fb39b..19f5cebb06ac245c3d1f0650efd80b97cc9d0e2d 100644 (file)
@@ -525,6 +525,9 @@ exp :       SIZEOF '(' type ')'     %prec UNARY
                          write_exp_elt_opcode (OP_LONG); }
        ;
 
+exp    :       SIZEOF  '(' exp ')'      %prec UNARY
+                       { write_exp_elt_opcode (UNOP_SIZEOF); }
+       
 exp    :       STRING
                        { /* C strings are converted into array constants with
                             an explicit null byte added at the end.  Thus
@@ -788,11 +791,7 @@ name_not_typename :        NAME
 /*** 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)
 {
   /* FIXME: Shouldn't these be unsigned?  We don't deal with negative values
      here, and we do kind of silly things like cast to unsigned.  */
@@ -817,30 +816,10 @@ parse_number (p, len, parsed_float, putithere)
 
   if (parsed_float)
     {
-      /* It's a float since it contains a point or an exponent.  */
-      char c;
-      int num = 0;     /* number of tokens scanned by scanf */
-      char saved_char = p[len];
-
-      p[len] = 0;      /* null-terminate the token */
-      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 ... */
+      if (! parse_c_float (parse_gdbarch, p, len,
+                          &putithere->typed_val_float.dval,
+                          &putithere->typed_val_float.type))
        return ERROR;
-      /* See if it has `f' or `l' suffix (float or long double).  */
-
-      c = tolower (p[len - 1]);
-
-      if (c == 'f')
-       putithere->typed_val_float.type = parse_type->builtin_float;
-      else if (c == 'l')
-       putithere->typed_val_float.type = parse_type->builtin_long_double;
-      else if (isdigit (c) || c == '.')
-       putithere->typed_val_float.type = parse_type->builtin_double;
-      else
-       return ERROR;
-
       return FLOAT;
     }
 
This page took 0.025362 seconds and 4 git commands to generate.