scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 29c41bb0dff693a78b4a77a0a3485eb340e07a6c
parent 493d5098799d588ed3878e2bc79f2f437cba4fb3
Author: FRIGN <dev@frign.de>
Date:   Tue, 17 May 2016 16:27:50 +0200

Emit function prototypes

so we actually know which functions we are actually calling in the IR.
Also update the tests accordingly.

"Mientras se gana algo no se pierde nada."
 - Miguel de Cervantes Saavedra

Diffstat:
Mcc1/decl.c | 1+
Mcc1/tests/test001.c | 1+
Mcc1/tests/test029.c | 6++++--
Mcc1/tests/test034.c | 5+++--
Mcc1/tests/test038.c | 3++-
Mcc1/tests/test041.c | 13+++++++------
Mcc1/tests/test042.c | 3++-
7 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/cc1/decl.c b/cc1/decl.c @@ -847,6 +847,7 @@ decl(void) * against GLOBALCTX+1 */ if (curctx != GLOBALCTX+1 || yytoken == ';') { + emit(ODECL, sym); /* * avoid non used warnings in prototypes */ diff --git a/cc1/tests/test001.c b/cc1/tests/test001.c @@ -3,6 +3,7 @@ name: TEST001 description: Basic hello world test error: output: +X4 I F "printf G6 I F "main { \ diff --git a/cc1/tests/test029.c b/cc1/tests/test029.c @@ -6,8 +6,10 @@ comments: f(2) will expand to 2*g, which will expand to 2*f, and in this moment f will not be expanded because the macro definition is a function alike macro, and in this case there is no arguments. error: -test029.c:34: error: redefinition of 'f1' -test029.c:35: error: 'f' undeclared +test029.c:31: warning: expression without side effects +test029.c:36: error: redefinition of 'f1' +test029.c:37: error: 'f' undeclared +test029.c:37: warning: expression without side effects output: G3 I F "f1 { diff --git a/cc1/tests/test034.c b/cc1/tests/test034.c @@ -3,10 +3,11 @@ name: TEST034 description: Basic test for incomplete structures error: -test034.c:44: error: declared variable 'bar' of incomplete type -test034.c:44: error: redeclaration of 'bar' +test034.c:45: error: declared variable 'bar' of incomplete type +test034.c:45: error: redeclaration of 'bar' output: X3 S2 "x +X5 I F "foo G6 I F "main { \ diff --git a/cc1/tests/test038.c b/cc1/tests/test038.c @@ -3,12 +3,13 @@ name: TEST038 description: Basic test for tentative definitions error: -test038.c:43: error: redeclaration of 'x' +test038.c:44: error: redeclaration of 'x' output: G1 I "x G1 I "x ( #I0 ) +X3 I F "main G5 P F "foo { \ diff --git a/cc1/tests/test041.c b/cc1/tests/test041.c @@ -2,12 +2,13 @@ name: TEST041 description: Test for bug parsing ternary operators error: -test041.c:48: error: type mismatch in conditional expression -test041.c:48: error: incompatible types when assigning -test041.c:49: error: used struct/union type value where scalar is required -test041.c:50: warning: 'i' defined but not used -test041.c:50: warning: 'foo' defined but not used -test041.c:50: warning: 's' defined but not used +test041.c:49: error: type mismatch in conditional expression +test041.c:49: error: incompatible types when assigning +test041.c:50: error: used struct/union type value where scalar is required +test041.c:50: warning: expression without side effects +test041.c:51: warning: 'i' defined but not used +test041.c:51: warning: 'foo' defined but not used +test041.c:51: warning: 's' defined but not used output: G2 I F "main { diff --git a/cc1/tests/test042.c b/cc1/tests/test042.c @@ -2,11 +2,12 @@ name: TEST042 description: Test for bug parsing ternary operators error: -test042.c:17: error: bad type convertion requested +test042.c:18: error: bad type convertion requested output: G2 I F "main { \ +X4 0 F "f */ int