History

Convert float to double for old function code.

herman ten brugge committed 1 year ago

Commit 37e1c881 parent 087cf2e3 files · +28 −0Browse files

Unified · Split

3 files
  1. tccgen.c +3 −0
  2. tests/tests2/133_old_func.c +23 −0
  3. tests/tests2/133_old_func.expect +2 −0
tccgen.c+3−0
@@ -8693,6 +8693,9 @@ static int decl(int l) · 8692 unmodified lines
8693 if (sym->type.t != VT_VOID)8693 if (sym->type.t != VT_VOID)
8694 tcc_error("redefinition of parameter '%s'",8694 tcc_error("redefinition of parameter '%s'",
8695 get_tok_str(v, NULL));8695 get_tok_str(v, NULL));
8696 if (func_vt.ref->f.func_type == FUNC_OLD &&
8697 type.t == VT_FLOAT)
8698 type.t = VT_DOUBLE;
8696 convert_parameter_type(&type);8699 convert_parameter_type(&type);
8697 sym->type = type;8700 sym->type = type;
8698 } else if (type.t & VT_TYPEDEF) {8701 } else if (type.t & VT_TYPEDEF) {
tests/tests2/133_old_func.c+23−0
@@ -0,0 +1,23 @@
1int printf(const char *s, ...);
2
3float fx(x)
4float x;
5{
6 return 2.0 * x;
7}
8
9int
10main(void)
11{
12 float fy();
13
14 printf("%g %g\n", fx(2.0), fy(10.0));
15 printf("%g %g\n", fx(2.0f), fy(10.0f));
16}
17
18float fy(x)
19float x;
20{
21 return 3.0 * x;
22}
23
tests/tests2/133_old_func.expect+2−0
@@ -0,0 +1,2 @@
14 30
24 30

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t