[dev] [scc] typeof is a gcc keyword
Hey, I tried to compile scc with gcc and it failed because typeof is a
gcc keyword and scc has a function called typeof on cc1/expr.c
A rename from typeof to type_of fixes the issue.
--- a/cc1/expr.c
+++ b/cc1/expr.c
_AT_@ -765,7 +765,7 @@
static Node *unary(void);
static Type *
-typeof(Node *np)
+type_of(Node *np)
{
Type *tp;
_AT_@ -788,7 +788,7 @@
tp = typename();
break;
default:
- tp = typeof(unary());
+ tp = type_of(unary());
break;
}
expect(')');
_AT_@ -807,7 +807,7 @@
switch (yytoken) {
case SIZEOF:
next();
- tp = (yytoken == '(') ? sizeexp() : typeof(unary());
+ tp = (yytoken == '(') ? sizeexp() : type_of(unary());
if (!(tp->prop & TDEFINED))
errorp("sizeof applied to an incomplete type");
return sizeofnode(tp);
Then I got scc to compile.
But this leaves me with the question on how to use scc?
I got a /bin directory with cc1, cc2 and scc.
./scc hello.c gives errors.
scc: execvp /home/marcc/libexec/scc/cc1: No such file or directory
scc: execvp /home/marcc/libexec/scc/cc2: No such file or directory
Then I thought maybe the Makefile failed to create correct
directories, so I did mkdir ~/libexec && mkdir ~/libexec/scc && mv
~/scc/bin/* ~/libexec/scc
This worked, now scc could find the directory and bin files it needed.
But I got another error now.
/home/marcc/hello.c:1: error: included file 'stdio.h' not found
/home/marcc/hello.c:6: error: 'printf' undeclared
/home/marcc/hello.c:6: error: function or function pointer expected
Then I though, maybe I can install scc on the system and everything will work.
No!
"sudo make clean install" creates /root/scc which isn't usual.
How can I get it right?
Also, this got me thinking.
scc will have to be compiled the first time with another compiler.
Which one should we use? Compiling scc with a non-suckless compiler is
bad, but is there a work-around?
It appears to be a "loop", because we can't compile scc with scc the first time.
Well, that was my experience after playing with scc for a few minutes.
Best wishes.
Received on Sun Jul 03 2016 - 15:42:53 CEST
This archive was generated by hypermail 2.3.0
: Sun Jul 03 2016 - 15:48:12 CEST