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
86938693 if (sym->type.t != VT_VOID)
86948694 tcc_error("redefinition of parameter '%s'",
86958695 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;
86968699 convert_parameter_type(&type);
86978700 sym->type = type;
86988701 } else if (type.t & VT_TYPEDEF) {
tests/tests2/133_old_func.c+23−0
@@ -0,0 +1,23 @@
1+int printf(const char *s, ...);
2+
3+float fx(x)
4+float x;
5+{
6+ return 2.0 * x;
7+}
8+
9+int
10+main(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+
18+float fy(x)
19+float x;
20+{
21+ return 3.0 * x;
22+}
23+
tests/tests2/133_old_func.expect+2−0
@@ -0,0 +1,2 @@
1+4 30
2+4 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