1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-09 22:29:35 +00:00

Added some code to handle floats/doubles.

git-svn-id: svn://svn.cc65.org/cc65/trunk@2487 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2003-10-10 11:39:30 +00:00
parent 89d4ba5553
commit f1b0fb9763
3 changed files with 20 additions and 2 deletions

View File

@ -63,6 +63,7 @@
#define CF_INT 0x0001 /* Operation on ints */
#define CF_PTR CF_INT /* Alias for readability */
#define CF_LONG 0x0000 /* Operation on longs */
#define CF_FLOAT 0x0004 /* Operation on a float */
#define CF_NOKEEP 0x0008 /* Value may get destroyed when storing */

View File

@ -570,6 +570,11 @@ unsigned TypeOf (const type* T)
case T_ULONG:
return CF_LONG | CF_UNSIGNED;
case T_FLOAT:
case T_DOUBLE:
/* These two are identical in the backend */
return CF_FLOAT;
case T_FUNC:
F = DecodePtr (T+1);
return (F->Flags & FD_VARIADIC)? 0 : CF_FIXARGC;

View File

@ -422,7 +422,7 @@ static void ParseTypeSpec (DeclSpec* D, int Default)
optionalsigned ();
optionalint ();
D->Type[0] = T_SHORT;
D->Type[1] = T_END;
D->Type[1] = T_END;
}
break;
@ -460,7 +460,7 @@ static void ParseTypeSpec (DeclSpec* D, int Default)
NextToken ();
/* FALL THROUGH */
default:
default:
D->Type[0] = T_INT;
D->Type[1] = T_END;
break;
@ -502,6 +502,18 @@ static void ParseTypeSpec (DeclSpec* D, int Default)
}
break;
case TOK_FLOAT:
NextToken ();
D->Type[0] = T_FLOAT;
D->Type[1] = T_END;
break;
case TOK_DOUBLE:
NextToken ();
D->Type[0] = T_DOUBLE;
D->Type[1] = T_END;
break;
case TOK_STRUCT:
case TOK_UNION:
StructType = (CurTok.Tok == TOK_STRUCT)? T_STRUCT : T_UNION;