tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] what are tcc's limitations?


From: Bernhard Fischer
Subject: Re: [Tinycc-devel] what are tcc's limitations?
Date: Mon, 16 Oct 2006 12:58:58 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

On Mon, Oct 16, 2006 at 11:40:41AM +0200, Bernhard Fischer wrote:

>Consider this invalid code:
>$ cat no.c
>int main(void) {}
>$ tcc -o no no.c && ./no ; echo $? ; ./no ; echo $?
>228
>212

>>and a half now, so the -run mode is a viable scripting language.

For scripting mode it would be handy to be able to compile from stdin,
btw. Something like this, but perhaps without using /dev/stdin but 0
would seem to be appropriate.

$ echo -e "#include <stdio.h>\nint main(void) {printf(\"%s\", \"Hello,
world.\\\n\");return 0;}" | tcc -o no -  && ./no
Hello, world.

diff -u ../tinycc.stdin.oorig/tcc.c ./tcc.c
--- ../tinycc.stdin.oorig/tcc.c 2005-09-04 00:51:34.000000000 +0200
+++ ./tcc.c     2006-10-16 12:50:07.000000000 +0200
@@ -10427,7 +10427,10 @@
                 break;
         }
         r = argv[optind++];
-        if (r[0] != '-') {
+        if (r[0] == '-' && r[1] == '\0') {
+            /* add stdin */
+            dynarray_add((void ***)&files, &nb_files, "/dev/stdin");
+        } else if (r[0] != '-') {
             /* add a new file */
             dynarray_add((void ***)&files, &nb_files, r);
             if (!multiple_files) {

Sounds useful?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]