Re: [Tinycc-devel] c89

2017-09-27 Thread u-jps5
On Wed, Sep 27, 2017 at 06:42:45AM +0100, Edmund Grimley Evans wrote:
> > Does someone have a concrete example of a c89 compiler they hope to
> > boostrap from?  Preferably one that can be downloaded and run (maybe in
> > an emulator) without payment.  For bootstrapping purposes, there are many
> > workarounds that can be considered that might not fly for a production
> > compiler.
> 
> There may be an argument for bootstrapping being repeatable rather
> than something done just once in a hacky way in private. See Debian's
> "rebootstrap" (though it's a different kind of bootstrapping).

+1

Rune


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


Re: [Tinycc-devel] c89

2017-09-27 Thread u-jps5
On Tue, Sep 26, 2017 at 08:14:25PM -0700, Larry Doolittle wrote:
> Does someone have a concrete example of a c89 compiler they hope to
> boostrap from?  Preferably one that can be downloaded and run (maybe in

ACK, I bootstrap with/from it on ia32 under Linux (provides a complete
toolchain under a clean BSD license, even though the C library ported
from Minix is pretty ancient). It is also meant to be retargetable.

On Minix it can be downloaded and run, either on Minix-2 or early
Minix-3, the compiler is the same in both cases.

The newest compiler code is avaiable from either Sourceforge or Github
(maintained by David Given) but this does not include any complete
C-libraries.

On Linux the corresponding C library ported by yours truly is not yet
published (in use for quite some time but I do not have time to care
about releases). If you target ia32, you can get the code as-is, but
then you will have to figure out how to bootstrap and build it.

The availability of the Linux ABI covers also FreeBSD and NetBSD if you
mean to target those platforms, more porting/tweaks for different
OSs was also done by Robert Nordier
 http://www.nordier.com/software/ack.html

Regards,
Rune


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


Re: [Tinycc-devel] c89

2017-09-27 Thread Vincent Lefevre
On 2017-09-26 20:14:25 -0700, Larry Doolittle wrote:
> Friends -
> 
> On Tue, Sep 26, 2017 at 03:49:09PM -0700, Larry Doolittle wrote:
> > Someone asked about c89.  I made a simple experiment on mob.
> > 1.  Replace 67 //-style comments with /* */
> > 2.  #define inline __inline__ in tcc.h
> > 3.  Use --std=c89 under gcc-4.9.2 on x86_64
> > The result builds and passes self-tests.
> 
> I went through the tcc compile with --std=c89 -pedantic and
> --std=c99 -pedantic options.
[...]

Note that --std=c89 -pedantic(-errors) is not sufficient to detect all
use of non-C89 features (only those that require a diagnostic). In
particular, using  remains undetected by --std=c89 -pedantic
with the current GCC. And even in C99, the types int64_t and uint64_t
are optional (in case they are also used for bootstrapping).

BTW, in practice, compiler bugs may be more an issue than the
possible use of a C89 compiler.

So, about the use of old (and new) compilers, perhaps it could be
better to report issues when they are found.

You might want to try CompCert[*], which supports only a subset of C
(a very large subset of C89 + some C99 features, AFAIK).

[*] http://compcert.inria.fr/

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

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


Re: [Tinycc-devel] c89

2017-09-27 Thread Larry Doolittle
Edmund -

On Wed, Sep 27, 2017 at 06:42:45AM +0100, Edmund Grimley Evans wrote:
> > I went through the tcc compile with --std=c89 -pedantic and
> > --std=c99 -pedantic options.  That flagged the "long long" feature
> > mentioned already, plus a bunch more potential barriers to strict
> > c89 or even c99 compilers.
> I'd be interested to see a list.

Results of building tinycc (commit 8deb05c3e) with gcc-4.9.2 for x86_64
and adding --std=c89 -pedantic to CFLAGS.

Short form:
Output of $ grep warning makelog3.txt | sed -e 's/.*warning://' | sort -u
 invoking macro DEF_ASMTEST argument 2: empty macro arguments are undefined in 
ISO C90 and ISO C++98
 ISO C90 does not support ‘long long’ [-Wlong-long]
 ISO C90 does not support the ‘ll’ gnu_printf length modifier [-Wformat=]
 ISO C90 doesn’t support unnamed structs/unions [-Wpedantic]
 ISO C90 forbids variable length array ‘_onstack’ [-Wvla]
 ISO C forbids assignment between function pointer and ‘void *’ [-Wpedantic]
 string length ‘1846’ is greater than the length ‘509’ ISO C90 compilers are 
required to support [-Woverlength-strings]
 string length ‘2492’ is greater than the length ‘509’ ISO C90 compilers are 
required to support [-Woverlength-strings]
 string length ‘6259’ is greater than the length ‘509’ ISO C90 compilers are 
required to support [-Woverlength-strings]
 type of bit-field ‘aligned’ is a GCC extension [-Wpedantic]
 type of bit-field ‘dllexport’ is a GCC extension [-Wpedantic]
 type of bit-field ‘dllimport’ is a GCC extension [-Wpedantic]
 type of bit-field ‘packed’ is a GCC extension [-Wpedantic]
 type of bit-field ‘unused’ is a GCC extension [-Wpedantic]
 type of bit-field ‘visibility’ is a GCC extension [-Wpedantic]
 type of bit-field ‘weak’ is a GCC extension [-Wpedantic]
 use of C99 long long integer constant [-Wlong-long]

Long form, 1584 lines:
download from http://recycle.lbl.gov/~ldoolitt/makelog3.txt
d5c6874de25ee3c3db8b383c98374b18afa1d30529f9bcce163f26221a547477  makelog3.txt

  - Larry

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


Re: [Tinycc-devel] c89

2017-09-26 Thread Edmund Grimley Evans
> I went through the tcc compile with --std=c89 -pedantic and
> --std=c99 -pedantic options.  That flagged the "long long" feature
> mentioned already, plus a bunch more potential barriers to strict
> c89 or even c99 compilers.

I'd be interested to see a list.

> Does someone have a concrete example of a c89 compiler they hope to
> boostrap from?  Preferably one that can be downloaded and run (maybe in
> an emulator) without payment.  For bootstrapping purposes, there are many
> workarounds that can be considered that might not fly for a production
> compiler.

There may be an argument for bootstrapping being repeatable rather
than something done just once in a hacky way in private. See Debian's
"rebootstrap" (though it's a different kind of bootstrapping).

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


Re: [Tinycc-devel] c89

2017-09-26 Thread KHMan

On 9/27/2017 11:14 AM, Larry Doolittle wrote:

Friends -

On Tue, Sep 26, 2017 at 03:49:09PM -0700, Larry Doolittle wrote:

Someone asked about c89.  I made a simple experiment on mob.
1.  Replace 67 //-style comments with /* */
2.  #define inline __inline__ in tcc.h
3.  Use --std=c89 under gcc-4.9.2 on x86_64
The result builds and passes self-tests.


I went through the tcc compile with --std=c89 -pedantic and
--std=c99 -pedantic options.  That flagged the "long long" feature
mentioned already, plus a bunch more potential barriers to strict
c89 or even c99 compilers.

Does someone have a concrete example of a c89 compiler they hope to
boostrap from?  Preferably one that can be downloaded and run (maybe in
an emulator) without payment.  For bootstrapping purposes, there are many
workarounds that can be considered that might not fly for a production
compiler.


+1

--
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] c89

2017-09-26 Thread Larry Doolittle
Friends -

On Tue, Sep 26, 2017 at 03:49:09PM -0700, Larry Doolittle wrote:
> Someone asked about c89.  I made a simple experiment on mob.
> 1.  Replace 67 //-style comments with /* */
> 2.  #define inline __inline__ in tcc.h
> 3.  Use --std=c89 under gcc-4.9.2 on x86_64
> The result builds and passes self-tests.

I went through the tcc compile with --std=c89 -pedantic and
--std=c99 -pedantic options.  That flagged the "long long" feature
mentioned already, plus a bunch more potential barriers to strict
c89 or even c99 compilers.

Does someone have a concrete example of a c89 compiler they hope to
boostrap from?  Preferably one that can be downloaded and run (maybe in
an emulator) without payment.  For bootstrapping purposes, there are many
workarounds that can be considered that might not fly for a production
compiler.

  - Larry

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


[Tinycc-devel] c89

2017-09-26 Thread Larry Doolittle
Friends -

Someone asked about c89.  I made a simple experiment on mob.

1.  Replace 67 //-style comments with /* */
2.  #define inline __inline__ in tcc.h
3.  Use --std=c89 under gcc-4.9.2 on x86_64

The result builds and passes self-tests.
Note that by construction, this doesn't check tcc's non-x86_64 code generators.

As much as I like c99, I could see an argument for putting step (1) above
into mob.  I can supply the patch to anyone interested, but I'm clearly not
the right person to make that commit.

  - Larry

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


Re: [Tinycc-devel] c89 vs c99 inline functions

2014-01-21 Thread Thomas Preud'homme
Le vendredi 17 janvier 2014, 13:35:57 Андрей Аладьев a écrit :
> Hello. Do you plan to support -std=c99 switch?
> I can show an example why it is important.

It was discussed on this mailing list in december. See mails with "inline 
functions" in the subject.

Best regards,

Thomas

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


[Tinycc-devel] c89 vs c99 inline functions

2014-01-17 Thread Андрей Аладьев
Hello. Do you plan to support -std=c99 switch?
I can show an example why it is important.


file test.h

inline int func()
{
return 0;
}

file test.c

#include "test.h"
extern inline int func();

file main.c

#include "test.h"
int main ()
{
return func();
}

gcc test.c -c -o test.o
gcc main.c -c -o main.o
gcc test.o main.o -o main

>> multiple definition of `func'

gcc -std=c99 test.c -c -o test.o
gcc -std=c99 main.c -c -o main.o
gcc test.o main.o -o main

>> ok


I can show why it is important to add "extern inline" of function in c99
standart:

gcc -std=c99 -O2 main.c -o main

>> ok

gcc -std=c99 -O0 main.c -o main

>> undefined reference to `func'

gcc -std=c99 -O0 test.c -c -o test.o
gcc -std=c99 -O0 main.c -c -o main.o
gcc test.o main.o -o main

>> ok

In "-O0" mode compiler can't inline functions, so you should have "extern
inline" version of inline functions in object files.


Tcc works the same as gcc:

tcc test.c -c -o test.o
tcc main.c -c -o main.o
tcc test.o main.o -o main

>> main.o: error: 'func' defined twice

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