Re: [Tinycc-devel] Using tinycc for full source bootstrapping

2017-09-27 Thread u-jps5
On Wed, Sep 27, 2017 at 10:34:15AM +0200, Kamil Rytarowski wrote:
> On 27.09.2017 06:55, Christian Jullien wrote:
> > 1) fully supported on Linux on x86/x64/arm/aarch64
> > 2) fully supported on Windows x86/x64
> > 3) Unclear or not fully supported on *BSD and macOS, My different attempts
> > on FreeBSD/OpenBSD/NetBSD all failed from one reason or another
> 
> For NetBSD we need compiler builtin for va_list:
 ...
> Without this we cannot use TCC with our native headers.

Generally, the native headers do not have to be used.

As a workaround it is possible to use tcc on NetBSD via LinuxABI
with a C library like musl, with clean, not kernel-specific includes.

Even natively on NetBSD we could still use tcc, as long as the actual
kernel keeps backward compatibility with the version which we target. We
would have to use our own custom headers expressing the correct ABI in a
suitable fashion, like musl does on Linux. This may be hard but possibly
not very hard,

Rune


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


Re: [Tinycc-devel] Using tinycc for full source bootstrapping

2017-09-27 Thread Kamil Rytarowski
On 27.09.2017 06:55, Christian Jullien wrote:
> I have the impression that this discussion is more philosophic than
> pragmatic.
> 
> Today tcc compiles and runs on limited number of systems/processors which
> are AFAIK:
> 
> 1) fully supported on Linux on x86/x64/arm/aarch64
> 2) fully supported on Windows x86/x64
> 3) Unclear or not fully supported on *BSD and macOS, My different attempts
> on FreeBSD/OpenBSD/NetBSD all failed from one reason or another
> 

For NetBSD we need compiler builtin for va_list:

#ifdef __lint__
typedef char *__va_list;

#else
typedef __builtin_va_list __va_list;
#endif

-- sys/ansi.h

Without this we cannot use TCC with our native headers.



signature.asc
Description: OpenPGP digital signature
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Using tinycc for full source bootstrapping

2017-09-26 Thread Christian Jullien
I have the impression that this discussion is more philosophic than
pragmatic.

Today tcc compiles and runs on limited number of systems/processors which
are AFAIK:

1) fully supported on Linux on x86/x64/arm/aarch64
2) fully supported on Windows x86/x64
3) Unclear or not fully supported on *BSD and macOS, My different attempts
on FreeBSD/OpenBSD/NetBSD all failed from one reason or another

On source code I see also C67 but I have seen no discussions on it for
years.

That said, for 1, 3, standard C compiler that comes with OS supports C98 for
nearly 20 years.
For 2, VC++, clang, gcc, mingw32, Cygwin support also C98 for nearly 20
years.

As tcc developer time and resources are limited, except for the fun, who can
tell me a **real in use system** that needs to bootstrap tcc with a C
compiler that only accepts C89?

Of course, when compiled, I fully agree that tcc should accept C89 to
support legacy code that no one wants to change.

If one finds, *still in production*,  a very exotic system that supports
only C89, the solution is to cross compile tcc on, says Linux, then use this
version to bootstrap tcc natively. For years, gcc has the nice feature to
make Canadian cross-compilation that I once use to generate a working gcc on
Solaris sparc from Linux x86.

So my conclusion is that I see no reasons to limit ourselves to C89.

-Original Message-
From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org]
On Behalf Of KHMan
Sent: mercredi 27 septembre 2017 04:38
To: tinycc-devel@nongnu.org
Subject: Re: [Tinycc-devel] Using tinycc for full source bootstrapping

On 9/27/2017 10:26 AM, Michael B. Smith wrote:
> As I read your comments, especially these:
>
>>> I would find it awesome if tinycc would restrict its source to C89.
>>
>> 2017 - 1989 = 28.
>>
>> Twenty-Eight Years. It would be kinda nice to move forward. Will we stick
to C89 simply because of certain platforms that may never move forward? It's
kinda like tying stones to one's legs. Or a lowest common denominator
scenario.
>
> You were suggesting to abandon the "old" or "legacy" support.

Context.

The discussion was on tcc bootstrapping.

The question I was posing was whether tcc should be tied to a commitment to
a 28 year old standard.

English can be a very ambiguous language. A tiny thought can lead to tunnel
vision down one of many supposedly plausible paths.


> If I misunderstood, please forgive me.
>
> -Original Message-
> From: Tinycc-devel On Behalf Of KHMan
> Sent: Tuesday, September 26, 2017 10:18 PM
> To: tinycc-devel@nongnu.org
> Subject: Re: [Tinycc-devel] Using tinycc for full source bootstrapping
> [snipped everything]


-- 
Cheers,
Kein-Hong Man (esq.)
Selangor, Malaysia


___
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


Re: [Tinycc-devel] Using tinycc for full source bootstrapping

2017-09-26 Thread KHMan

On 9/27/2017 10:26 AM, Michael B. Smith wrote:

As I read your comments, especially these:


I would find it awesome if tinycc would restrict its source to C89.


2017 - 1989 = 28.

Twenty-Eight Years. It would be kinda nice to move forward. Will we stick to 
C89 simply because of certain platforms that may never move forward? It's kinda 
like tying stones to one's legs. Or a lowest common denominator scenario.


You were suggesting to abandon the "old" or "legacy" support.


Context.

The discussion was on tcc bootstrapping.

The question I was posing was whether tcc should be tied to a 
commitment to a 28 year old standard.


English can be a very ambiguous language. A tiny thought can lead 
to tunnel vision down one of many supposedly plausible paths.




If I misunderstood, please forgive me.

-Original Message-
From: Tinycc-devel On Behalf Of KHMan
Sent: Tuesday, September 26, 2017 10:18 PM
To: tinycc-devel@nongnu.org
Subject: Re: [Tinycc-devel] Using tinycc for full source bootstrapping
[snipped everything]



--
Cheers,
Kein-Hong Man (esq.)
Selangor, Malaysia


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


Re: [Tinycc-devel] Using tinycc for full source bootstrapping

2017-09-26 Thread Michael B. Smith
As I read your comments, especially these:

>> I would find it awesome if tinycc would restrict its source to C89.
>
> 2017 - 1989 = 28.
>
> Twenty-Eight Years. It would be kinda nice to move forward. Will we stick to 
> C89 simply because of certain platforms that may never move forward? It's 
> kinda like tying stones to one's legs. Or a lowest common denominator 
> scenario.

You were suggesting to abandon the "old" or "legacy" support.

If I misunderstood, please forgive me.

-Original Message-
From: Tinycc-devel 
[mailto:tinycc-devel-bounces+michael=theessentialexchange@nongnu.org] On 
Behalf Of KHMan
Sent: Tuesday, September 26, 2017 10:18 PM
To: tinycc-devel@nongnu.org
Subject: Re: [Tinycc-devel] Using tinycc for full source bootstrapping

On 9/27/2017 9:54 AM, Michael B. Smith wrote:
> You funny.
>
> I've still got hundreds of thousands of lines of C in K C. In production. 
> Supporting major applications.
>
> You are obviously one of those people who thinks that COBOL is ancient and 
> unused, aren't you?
>
> Because I've got millions of production LOC in COBOL.
>
> No offense, but I don't think you understand the real world.

Please look at this line from Rune:
"Compilers written in C89 and understanding C99 hardly exist."

This implies that his intention is to get C99 via a C89 route.

If his ending point is a C99 capable tcc and natively hosted, then it has 
nothing to do with any amount of legacy code, which can continue to use legacy 
compilers. I say certain platforms may never move forward because in those 
cases we are usually at the mercy of proprietary compilers and the companies 
that make them.

We are not talking about a C89 end point here. C89 folks continue to use their 
stuff, I'm sure it will be in use past 2100. No problem with that. tcc was 
already using // comments with nary an outcry for like ages. When was it ever a 
problem? The only problem this time is that someone wants to bootstrap without 
any tiny bit of any kind of cross compiling variations.

No offense, but I don't think I have been out of line.

> -Original Message-
> From: Tinycc-devel On Behalf Of KHMan
> Sent: Tuesday, September 26, 2017 9:41 PM
> To: tinycc-devel@nongnu.org
> Subject: Re: [Tinycc-devel] Using tinycc for full source bootstrapping
>
> On 9/27/2017 5:30 AM, u-j...@aetey.se wrote:
>> On Sun, Sep 24, 2017 at 07:40:32PM +0200, grischka wrote:
>>> Also as source tcc is supposed to be C89, except maybe 'long long'
>>> and maybe some minor things here or there which we could change 
>>> indeed if that is wanted (for example usage of compound initializers 
>>> in arm-gen.c)
>>
>> [not a tinycc developer but using / depending on compiler 
>> bootstrapping]
>>
>> I would find it awesome if tinycc would restrict its source to C89.
>
> 2017 - 1989 = 28.
>
> Twenty-Eight Years. It would be kinda nice to move forward. Will we stick to 
> C89 simply because of certain platforms that may never move forward? It's 
> kinda like tying stones to one's legs. Or a lowest common denominator 
> scenario.
>
>> Compilers written in C89 and understanding C99 hardly exist. This 
>> makes it hard to do a proper bootstrap from the ground with minimal 
>> dependency on existing binaries.
>
> Could you give an example/examples where the starting point for a 
> bootstrap is C89 for the foreseeable future? (Not trying to be a 
> nitpick pest, but actual data points are usually a good thing, and tcc 
> supports only a few processors, so it would be nice to know which one 
> and what platform, or is it some future thing.)
>
> I like Larry's posting. Item 1 can also be done by text processing.
>
> Or make a minimally functioning tcc C89 branch.
>
> Or bootstrap it the Pascal P4 way.
>
>> (Offtopic, but tightly related to the full bootstrapping: if tcc 
>> would also become relicensed to BSD-alike, this would not only make 
>> such deep bootstrapping easier but also allow getting to C99 without 
>> relying on GPL, which matters to some people and scenarios)
>>
>> Thanks for your work on tcc,
>> Rune


--
Cheers,
Kein-Hong Man (esq.)
Selangor, Malaysia


___
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


Re: [Tinycc-devel] Using tinycc for full source bootstrapping

2017-09-26 Thread KHMan

On 9/27/2017 9:54 AM, Michael B. Smith wrote:

You funny.

I've still got hundreds of thousands of lines of C in K C. In production. 
Supporting major applications.

You are obviously one of those people who thinks that COBOL is ancient and 
unused, aren't you?

Because I've got millions of production LOC in COBOL.

No offense, but I don't think you understand the real world.


Please look at this line from Rune:
"Compilers written in C89 and understanding C99 hardly exist."

This implies that his intention is to get C99 via a C89 route.

If his ending point is a C99 capable tcc and natively hosted, then 
it has nothing to do with any amount of legacy code, which can 
continue to use legacy compilers. I say certain platforms may 
never move forward because in those cases we are usually at the 
mercy of proprietary compilers and the companies that make them.


We are not talking about a C89 end point here. C89 folks continue 
to use their stuff, I'm sure it will be in use past 2100. No 
problem with that. tcc was already using // comments with nary an 
outcry for like ages. When was it ever a problem? The only problem 
this time is that someone wants to bootstrap without any tiny bit 
of any kind of cross compiling variations.


No offense, but I don't think I have been out of line.


-Original Message-
From: Tinycc-devel On Behalf Of KHMan
Sent: Tuesday, September 26, 2017 9:41 PM
To: tinycc-devel@nongnu.org
Subject: Re: [Tinycc-devel] Using tinycc for full source bootstrapping

On 9/27/2017 5:30 AM, u-j...@aetey.se wrote:

On Sun, Sep 24, 2017 at 07:40:32PM +0200, grischka wrote:

Also as source tcc is supposed to be C89, except maybe 'long long'
and maybe some minor things here or there which we could change
indeed if that is wanted (for example usage of compound initializers
in arm-gen.c)


[not a tinycc developer but using / depending on compiler
bootstrapping]

I would find it awesome if tinycc would restrict its source to C89.


2017 - 1989 = 28.

Twenty-Eight Years. It would be kinda nice to move forward. Will we stick to 
C89 simply because of certain platforms that may never move forward? It's kinda 
like tying stones to one's legs. Or a lowest common denominator scenario.


Compilers written in C89 and understanding C99 hardly exist. This
makes it hard to do a proper bootstrap from the ground with minimal
dependency on existing binaries.


Could you give an example/examples where the starting point for a bootstrap is 
C89 for the foreseeable future? (Not trying to be a nitpick pest, but actual 
data points are usually a good thing, and tcc supports only a few processors, 
so it would be nice to know which one and what platform, or is it some future 
thing.)

I like Larry's posting. Item 1 can also be done by text processing.

Or make a minimally functioning tcc C89 branch.

Or bootstrap it the Pascal P4 way.


(Offtopic, but tightly related to the full bootstrapping: if tcc would
also become relicensed to BSD-alike, this would not only make such
deep bootstrapping easier but also allow getting to C99 without
relying on GPL, which matters to some people and scenarios)

Thanks for your work on tcc,
Rune



--
Cheers,
Kein-Hong Man (esq.)
Selangor, Malaysia


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


Re: [Tinycc-devel] Using tinycc for full source bootstrapping

2017-09-26 Thread Michael B. Smith
You funny.

I've still got hundreds of thousands of lines of C in K C. In production. 
Supporting major applications.

You are obviously one of those people who thinks that COBOL is ancient and 
unused, aren't you?

Because I've got millions of production LOC in COBOL.

No offense, but I don't think you understand the real world.

-Original Message-
From: Tinycc-devel 
[mailto:tinycc-devel-bounces+michael=theessentialexchange@nongnu.org] On 
Behalf Of KHMan
Sent: Tuesday, September 26, 2017 9:41 PM
To: tinycc-devel@nongnu.org
Subject: Re: [Tinycc-devel] Using tinycc for full source bootstrapping

On 9/27/2017 5:30 AM, u-j...@aetey.se wrote:
> On Sun, Sep 24, 2017 at 07:40:32PM +0200, grischka wrote:
>> Also as source tcc is supposed to be C89, except maybe 'long long'
>> and maybe some minor things here or there which we could change 
>> indeed if that is wanted (for example usage of compound initializers 
>> in arm-gen.c)
>
> [not a tinycc developer but using / depending on compiler 
> bootstrapping]
>
> I would find it awesome if tinycc would restrict its source to C89.

2017 - 1989 = 28.

Twenty-Eight Years. It would be kinda nice to move forward. Will we stick to 
C89 simply because of certain platforms that may never move forward? It's kinda 
like tying stones to one's legs. Or a lowest common denominator scenario.

> Compilers written in C89 and understanding C99 hardly exist. This 
> makes it hard to do a proper bootstrap from the ground with minimal 
> dependency on existing binaries.

Could you give an example/examples where the starting point for a bootstrap is 
C89 for the foreseeable future? (Not trying to be a nitpick pest, but actual 
data points are usually a good thing, and tcc supports only a few processors, 
so it would be nice to know which one and what platform, or is it some future 
thing.)

I like Larry's posting. Item 1 can also be done by text processing.

Or make a minimally functioning tcc C89 branch.

Or bootstrap it the Pascal P4 way.

> (Offtopic, but tightly related to the full bootstrapping: if tcc would 
> also become relicensed to BSD-alike, this would not only make such 
> deep bootstrapping easier but also allow getting to C99 without 
> relying on GPL, which matters to some people and scenarios)
>
> Thanks for your work on tcc,
> Rune

--
Cheers,
Kein-Hong Man (esq.)
Selangor, Malaysia


___
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


Re: [Tinycc-devel] Using tinycc for full source bootstrapping

2017-09-26 Thread KHMan

On 9/27/2017 5:30 AM, u-j...@aetey.se wrote:

On Sun, Sep 24, 2017 at 07:40:32PM +0200, grischka wrote:

Also as source tcc is supposed to be C89, except maybe 'long long'
and maybe some minor things here or there which we could change
indeed if that is wanted (for example usage of compound initializers
in arm-gen.c)


[not a tinycc developer but using / depending on compiler bootstrapping]

I would find it awesome if tinycc would restrict its source to C89.


2017 - 1989 = 28.

Twenty-Eight Years. It would be kinda nice to move forward. Will 
we stick to C89 simply because of certain platforms that may never 
move forward? It's kinda like tying stones to one's legs. Or a 
lowest common denominator scenario.



Compilers written in C89 and understanding C99 hardly exist. This
makes it hard to do a proper bootstrap from the ground with minimal
dependency on existing binaries.


Could you give an example/examples where the starting point for a 
bootstrap is C89 for the foreseeable future? (Not trying to be a 
nitpick pest, but actual data points are usually a good thing, and 
tcc supports only a few processors, so it would be nice to know 
which one and what platform, or is it some future thing.)


I like Larry's posting. Item 1 can also be done by text processing.

Or make a minimally functioning tcc C89 branch.

Or bootstrap it the Pascal P4 way.


(Offtopic, but tightly related to the full bootstrapping: if tcc would
also become relicensed to BSD-alike, this would not only make such deep
bootstrapping easier but also allow getting to C99 without relying on GPL,
which matters to some people and scenarios)

Thanks for your work on tcc,
Rune


--
Cheers,
Kein-Hong Man (esq.)
Selangor, Malaysia


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


Re: [Tinycc-devel] Using tinycc for full source bootstrapping

2017-09-26 Thread u-jps5
On Sun, Sep 24, 2017 at 07:40:32PM +0200, grischka wrote:
> Also as source tcc is supposed to be C89, except maybe 'long long'
> and maybe some minor things here or there which we could change
> indeed if that is wanted (for example usage of compound initializers
> in arm-gen.c)

[not a tinycc developer but using / depending on compiler bootstrapping]

I would find it awesome if tinycc would restrict its source to C89. 

Compilers written in C89 and understanding C99 hardly exist. This
makes it hard to do a proper bootstrap from the ground with minimal
dependency on existing binaries.

(Offtopic, but tightly related to the full bootstrapping: if tcc would
also become relicensed to BSD-alike, this would not only make such deep
bootstrapping easier but also allow getting to C99 without relying on GPL,
which matters to some people and scenarios)

Thanks for your work on tcc,
Rune


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


Re: [Tinycc-devel] Using tinycc for full source bootstrapping

2017-09-26 Thread Christian Jullien
I second grischka,

Unless you prove it is buggy, the best thing to do with obscure code you
don't understand IS TO KEEP IT AS IS!
I apply this advice to my own code :o))
Doing otherwise is the fasted way to introduce new bugs that no one will
find until several months.



-Original Message-
From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange...@nongnu.org]
On Behalf Of grischka
Sent: mardi 26 septembre 2017 09:19
To: tinycc-devel@nongnu.org
Subject: Re: [Tinycc-devel] Using tinycc for full source bootstrapping

Larry Doolittle wrote:
> The comma operator example you posted, that confused me at first, is 
> an exception, and I just pushed a patch.

You override someone else's style decision with your own because you are
confused?

We're all confused, eventually.

-- gr


___
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


Re: [Tinycc-devel] Using tinycc for full source bootstrapping

2017-09-26 Thread grischka

Larry Doolittle wrote:

The comma operator example you posted, that confused me at first,
is an exception, and I just pushed a patch.  


You override someone else's style decision with your own because you
are confused?

We're all confused, eventually.

-- gr


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


Re: [Tinycc-devel] Using tinycc for full source bootstrapping

2017-09-25 Thread Larry Doolittle
On Sun, Sep 24, 2017 at 07:40:32PM +0200, grischka wrote:
> Jan Nieuwenhuizen wrote:
> >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:
> I wonder which would be the smaller patch:  The changes you propose
> for tcc or a patch to support these constructs as is in the bootstrap
> compiler.

I wonder that too.  I looked through a lot of the changes you made,
and 99% of them decrease the code quality of tcc.  IMHO the long-term
path forward would be to improve your bootstrap compiler.

The comma operator example you posted, that confused me at first,
is an exception, and I just pushed a patch.  Using semicolons here
is more of a "say what you mean" and "principle of least surprise"
approach to coding this function.  The _other_ comma operators you found
(and eliminated) in tcc's code base are used for all the right reasons,
to reduce code duplication and create a smooth flow of control.

I enthusiastically support boostrap projects in general, and wish you
the best of luck going forward!  Just don't expect mainline tcc to
regress its code quality for your benefit.

  - Larry

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


Re: [Tinycc-devel] Using tinycc for full source bootstrapping

2017-09-24 Thread Larry Doolittle
Friends -

On Sun, Sep 24, 2017 at 12:27:17PM -0700, Larry Doolittle wrote:
> On Sun, Sep 24, 2017 at 09:48:25AM +0200, Jan Nieuwenhuizen wrote:
> > -p[0] = x & 255, p[1] = x >> 8 & 255;
> The original line above, however, screams "I am a bug" to me.
> The return value of "x & 255" is ignored, and it has no side effects,
> so it can be discarded, leaving
>p[0] = p[1] = x >> 8 & 255;
> Is there any evidence it works?

I tested it, and it does in fact work.  Sorry, I got a little mixed up
on the order of operations.

Still, using comma there instead of semicolon seems needlessly confusing.
It suggests that these were once tricky macro expansions instead
of inline functions.  If it were me I would use semicolon there
(write32le()) and in write64le().

   - Larry

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


Re: [Tinycc-devel] Using tinycc for full source bootstrapping

2017-09-24 Thread Larry Doolittle
Friends -

On Sun, Sep 24, 2017 at 09:48:25AM +0200, Jan Nieuwenhuizen wrote:
> -p[0] = x & 255, p[1] = x >> 8 & 255;
> +p[0] = x & 255; p[1] = x >> 8 & 255;

I think the comma operator is an awesome part of the C standard,
and sometimes permits much more clear and concise expression of
process than would otherwise be possible.

The original line above, however, screams "I am a bug" to me.
The return value of "x & 255" is ignored, and it has no side effects,
so it can be discarded, leaving
   p[0] = p[1] = x >> 8 & 255;
Is there any evidence it works?

   - Larry

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


Re: [Tinycc-devel] Using tinycc for full source bootstrapping

2017-09-24 Thread grischka

I wonder which would be the smaller patch:  The changes you propose
for tcc or a patch to support these constructs as is in the bootstrap
compiler.

Otherwise if that is not your criterion what would be the arguments
for the semantics that you mention that they do not belong to
"simple enough C"?

Of course from our point of view tcc IS a simple C compiler almost by
definition, so, since it can compile itself, it must be written in
already sufficiently simple C ;)

Also as source tcc is supposed to be C89, except maybe 'long long'
and maybe some minor things here or there which we could change
indeed if that is wanted (for example usage of compound initializers
in arm-gen.c)

-- gr

Jan Nieuwenhuizen wrote:

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 (>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





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


Re: [Tinycc-devel] Using tinycc for full source bootstrapping

2017-09-24 Thread Christian Jullien
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 (>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  | 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


Re: [Tinycc-devel] Using tinycc for full source bootstrapping

2017-09-24 Thread Edmund Grimley Evans
I'm not an active contributor so my opinion doesn't count for much,
but here it is anyway.

Though I like the idea of implementing TCC in a smaller subset of C it
should be a clearly defined subset of C and preferably one that makes
sense generally rather than just for a particular bootstrap path. Why
not start with C89 rather than C99?

Some of the examples you gave don't make the language significantly
simpler, in my opinion. I don't think restricting C's expression
syntax makes the compiler writer's job any easier (though some code
style rules reject the comma operator anyway). If you want to simplify
things ban floating-point types, structs as arguments and most of the
standard header files and library functions. Also "switch" and "goto",
perhaps.

Edmund

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