A non-maintainer, here are my 2c:

As a matter of style, I like this idea but:
- tcc is probably already the smallest C compiler that compiles a decent C 
compiler
- as you probably noticed, there is not a huge activity on tcc these days and I 
personally prefer than one spent time on something immediately useful for tcc 
core, like C11 support.
- changing code that works is risky because we must ensure nothing is broken 
and tcc tests suite is far from complete (not counting the fact that we have no 
platform regression tests)
- it's a common practice for a compiler X to be compiled by itself. This has 
the advantage to test more code combinations it is supposed to support.
- it will introduce gratuitous diff that will make harder to identify real 
regression

That said, and especially because the lack of a decent non-regression tests 
suite, I personally vote against your proposal.

-----Original Message-----
From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org] On 
Behalf Of Jan Nieuwenhuizen
Sent: dimanche 24 septembre 2017 09:48
To: tinycc-devel@nongnu.org
Cc: Jeremiah Orians
Subject: [Tinycc-devel] Using tinycc for full source bootstrapping

Hi!

Are you willing to consider discussing/taking patches that reduce the variety 
and complexity of C constructs used in TinyCC source code?

I have a list of about 20 unpolished patches[0] for constructs like:
comma operator

-    p[0] = x & 255, p[1] = x >> 8 & 255;
+    p[0] = x & 255; p[1] = x >> 8 & 255;

or (heterogeneous) initialzer lists

-    uint8_t buf[1000], *p = buf;
+    uint8_t buf[1000];
+    uint8_t *p = buf;

or function return derefencing

-    v = tok_alloc(astr.data, astr.size - 1)->tok;
+    TokenSym *tk = tok_alloc(astr.data, astr.size - 1);
+    v = tk->tok;

or complex field access

-    return table_ident[v]->sym_define;
+    TokenSym *t = table_ident[v];
+    Sym *s = t->sym_define;
+    return s;

or even struct by value assign

-    vtop->type = *type;
+    memcpy (&vtop->type, type, sizeof (CType));

that allow tcc to be compiled with a simpler C compiler, so that in time we 
could add to README something like

    - BOOTSTRAPPABLE!  Because tcc uses only a subset of C99 (C99--), it
    can be bootstrapped with a simple C compiler.

Knowing[1] that TinyCC can build Gcc (wow!) and building tcc is easier than 
building gcc, it is a good candidate for use in a bootstrap path.

The past couple of months I have been working to bootstrap tcc using mescc, a 
simple C compiler that can (almost) be bootstrapped from source.  I have just 
released[2] Mes 0.10 which can compile a modified version of mes-tcc, which can 
compile a trivial C program into a working executable.

Much work will have to be done before mes-tcc will be able to build a 
functional Gcc.  I would like to start by reducing the delta on tcc that I'm 
carrying.

What do you think, is bootstrappable builds[4] something you would want to 
support and what could C99-- look like?

Greetings,
janneke

[0] https://gitlab.com/janneke/tinycc/commits/wip-mescc
[1] https://lists.gnu.org/archive/html/tinycc-devel/2017-05/msg00099.html
[2] http://lists.gnu.org/archive/html/guile-user/2017-09/msg00027.html
[3] http://bootstrappable.org

--
Jan Nieuwenhuizen <jann...@gnu.org> | GNU LilyPond http://lilypond.org 
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com

_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to