[hackers] [scc] Emit function prototypes || FRIGN

From: <git_AT_suckless.org>
Date: Tue, 17 May 2016 16:29:51 +0200 (CEST)

commit 29c41bb0dff693a78b4a77a0a3485eb340e07a6c
Author: FRIGN <dev_AT_frign.de>
AuthorDate: Tue May 17 16:27:50 2016 +0200
Commit: FRIGN <dev_AT_frign.de>
CommitDate: Tue May 17 16:27:50 2016 +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

diff --git a/cc1/decl.c b/cc1/decl.c
index 0d87c62..122ea7c 100644
--- a/cc1/decl.c
+++ b/cc1/decl.c
_AT_@ -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
index 23b38e1..eb7d560 100644
--- a/cc1/tests/test001.c
+++ b/cc1/tests/test001.c
_AT_@ -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
index c3935d6..b259550 100644
--- a/cc1/tests/test029.c
+++ b/cc1/tests/test029.c
_AT_@ -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
index eecd3d4..3861dd6 100644
--- a/cc1/tests/test034.c
+++ b/cc1/tests/test034.c
_AT_@ -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
index fb40c94..410b43f 100644
--- a/cc1/tests/test038.c
+++ b/cc1/tests/test038.c
_AT_@ -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
index 1ee8e28..7b94ee8 100644
--- a/cc1/tests/test041.c
+++ b/cc1/tests/test041.c
_AT_@ -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
index 50b9dc8..79838d7 100644
--- a/cc1/tests/test042.c
+++ b/cc1/tests/test042.c
_AT_@ -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
Received on Tue May 17 2016 - 16:29:51 CEST

This archive was generated by hypermail 2.3.0 : Tue May 17 2016 - 16:36:13 CEST