Re: [Tinycc-devel] errno clearing with tcc -run

2015-04-11 Thread Sergey Korshunoff
Hi, Thomas! I'm using as editor a mcedit program (a Midnight Commander
editor). .viminfo don't help with this editor. But there is option
"fill tabs with spaces". Is this that what expected?


2015-04-11 11:29 GMT+03:00, Thomas Preud'homme :
> Le mercredi 25 mars 2015, 13:31:54 Sergey Korshunoff a écrit :
>> Hi! A fix is commited to the mob.
>
> Hi Sergey,
>
> Not worth doing a patch for this but please note that tcc is using space as
>
> its indentation method. I'd welcome a patch adding .viminfo to tcc's source
>
> (make sure it don't end up in the tarball created by make tar) to avoid this
>
> kind of mistakes in the future.
>
> Best regards,
>
> Thomas

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


Re: [Tinycc-devel] Fix for Microsoft compilers

2015-04-11 Thread Thomas Preud'homme
Le mardi 24 mars 2015, 22:55:49 oldfaber a écrit :
> Hi,
> 
> Miccrosoft Visual Sudio (Express) 2008 and 2010 do not accept variable
> definitions C99 style.
> Please apply this patch to mob
> 
> libtcc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libtcc.c b/libtcc.c
> index 5a9681f..660c935 100644
> --- a/libtcc.c
> +++ b/libtcc.c
> @@ -462,8 +462,8 @@ ST_FUNC void put_extern_sym2(Sym *sym, Section *section,
> if (!sym->c) {
>  name = get_tok_str(sym->v, NULL);
>  #ifdef CONFIG_TCC_BCHECK
> -char buf[32];
>  if (tcc_state->do_bounds_check) {
> +   char buf[32];
>  /* XXX: avoid doing that for statics ? */
>  /* if bound checking is activated, we change some function
> names by adding the "__bound" prefix */

Except that later there is "name = buf;" with name staying live out of this if 
scope. So this change is not correct. It would be better to move it out up a 
bit.

Best regards,

Thomas

signature.asc
Description: This is a digitally signed message part.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] [TIPS] empty test program will crash if compiled with -b option

2015-04-11 Thread Thomas Preud'homme
Le mercredi 25 mars 2015, 19:55:46 Sergey Korshunoff a écrit :
> Hi! Is there a way to add a file from a library like:
>tcc_add_support(s1, "libtcc1.a(bcheck.o)");
> 
> There was a code in the old tccelf.c (0.9.22) which then removed:
> snprintf(buf, sizeof(buf), "%s/%s", tcc_lib_path, "bcheck.o");
> tcc_add_file(s1, buf);
> 
> Currently we install only a libtcc1.a. There is no bcheck.o
> Question: how to force a bcheck.o linking?

bcheck.o is part of libtcc1.a. See lib/Makefile:

BCHECK_O = bcheck.o
(…)
I386_O = libtcc1.o alloca86.o alloca86-bt.o $(BCHECK_O)
X86_64_O = libtcc1.o alloca86_64.o alloca86_64-bt.o $(BCHECK_O)
(…)
ifeq "$(TARGET)" "i386"
 OBJ = $(addprefix $(DIR)/,$(I386_O))
(…)
ifeq "$(TARGET)" "x86_64"
 OBJ = $(addprefix $(DIR)/,$(X86_64_O))
(…)
$(DIR)/libtcc1.a ../libtcc1.a : $(OBJ) $(XAR)
$(XAR) rcs $@ $(OBJ)

Best regards,

Thomas

signature.asc
Description: This is a digitally signed message part.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Dollar Sign in Identifiers Extension

2015-04-11 Thread Thomas Preud'homme
Le samedi 11 avril 2015, 06:14:04 Sergey Korshunoff a écrit :
> Hi! A modified version of the patch is attached.

Looks good at quick look. I'm not sure about the switch, we already accept 
some gnu extension without any switch for that. Or maybe introduce a more 
general switch for all C extensions. You could enable it by default en disable 
it if std=c99 for instance?

Best regards,

Thomas

signature.asc
Description: This is a digitally signed message part.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Any interest in #pragma(lib) and CGI extensions?

2015-04-11 Thread Thomas Preud'homme
Le samedi 11 avril 2015, 07:59:44 Sergey Korshunoff a écrit :
> A preliminary patch for the -xc and -xa options is attached.

I often swear at software that refuse to perform an action because the 
extension is not the one they expect. Usually it's with media player though 
but I'm still very much in favor of such a patch.

As for the content of the patch, I'd remove all warnings except the 
unsupported language one. Also, since you introduce the concept of kind of file 
(assembly code, C code, etc…) it seems better to set the kind according to the 
extension if -x is not specify and use only the kind after rather than keep 
checking both the kind and the extension.

I'm also not sure about the indentation but maybe it's because I spent more 
time coding on GCC than TinyCC these days. Is it usual in TinyCC to have the 
second line of a if not aligned with the first character inside the 
parenthesis? Ie:

If (foo || bar
|| baz)

I was also surprised to have the || at the end of the line but that might be 
normal in TinyCC's code, I'm not sure anymore.

Best regards,

Thomas

signature.asc
Description: This is a digitally signed message part.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] Partial revert of nocode_wanted patch

2015-04-11 Thread Thomas Preud'homme
Hi Sergey,

I noticed your commit 78c076a70f562fc88bcd6e467bfe61b856f91fbd that partially 
revert a patch of mine. I don't mind people reverting my patch but this seems 
like the wrong solution here.

save_regs(int reg) can generate code generation (and is actually very likely 
to do so, especially if reg = 0) so it seems perfectly appropriate to error 
out if nocode_wanted is defined.

This suggest that the problem is rather that nocode_wanted is defined somewhere 
when it shouldn't. I'd be happy to look into this if you can provide me a 
reduced testcase. Please replace -c by -E on the command line and then use 
creduce to make the test as small as possible.

Best regards,

Thomas

signature.asc
Description: This is a digitally signed message part.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] [TIPS] empty test program will crash if compiled with -b option

2015-04-11 Thread Thomas Preud'homme
Le mercredi 25 mars 2015, 20:59:23 Sergey Korshunoff a écrit :
> Hi! There is a patch attached. This patch:
>  1) installs bcheck.o along with the libtcc1.a
>  2) enforces bcheck.o linking

I just tested your patch without the tcc_add_support(s1, "bcheck.o"); and it 
works fine for me. This is not really surprising since as I said earlier 
bcheck.o is part of libtcc1.a which is linked.

So can you revert this commit (except the if (!sym_index) part) and the 
following commit 548a55eda53a0dcf2eabd617115c4e46330d7e23 ? If you did observe 
an issue without this, please tell me how to reproduce it and I'll look what 
is the actual issue.

Note that I do appreciate all your efforts to improve TinyCC, I don't want you 
to think the contrary. ;-)

Thanks in advance.

Best regards,

Thomas

signature.asc
Description: This is a digitally signed message part.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Any interest in #pragma(lib) and CGI extensions?

2015-04-11 Thread Sergey Korshunoff
Hi! A worked version of the patch is attached. But it is not tested
well. And it is not a rigth one. A -xc or -xa option (only one) and a
source files must follow all libraries and object files. Currently I
consider to make a rigth patch which behavior will be like in gcc:
 * introduce a files type array in TCCState
 * tcc_parse_args: add a file type when adding a new file
 * use this type in tcc_add_file_internal

The best case if a files[] array can contain a struct and not a string


019-x-option.patch
Description: Binary data
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] [TIPS] empty test program will crash if compiled with -b option

2015-04-11 Thread Sergey Korshunoff
Hi! This commits are changed and improved by the following commits:
bcheck for windows  and bcheck support for ARCH=x86_64. But there is a
trick to force a bcheck.o linking: compiling a dummy program with the
local array. Otherwise bcheck.o may be not linked. I don't know a way
to force linking bcheck.o if a main program is a dummy one (do not
contain a local array):

int main(void)
{
  // int v[10];  // when this is present then bcheck.o is linked from a library
 // otherwise not
  return 0;
}

PS: a __bcheck_init function is not called from ".init" section on
windows for unknown reason.


2015-04-11 14:13 GMT+03:00, Thomas Preud'homme :
> Le mercredi 25 mars 2015, 20:59:23 Sergey Korshunoff a écrit :
>> Hi! There is a patch attached. This patch:
>>  1) installs bcheck.o along with the libtcc1.a
>>  2) enforces bcheck.o linking
>
> I just tested your patch without the tcc_add_support(s1, "bcheck.o"); and it
>
> works fine for me. This is not really surprising since as I said earlier
> bcheck.o is part of libtcc1.a which is linked.
>
> So can you revert this commit (except the if (!sym_index) part) and the
> following commit 548a55eda53a0dcf2eabd617115c4e46330d7e23 ? If you did
> observe
> an issue without this, please tell me how to reproduce it and I'll look what
>
> is the actual issue.
>
> Note that I do appreciate all your efforts to improve TinyCC, I don't want
> you
> to think the contrary. ;-)
>
> Thanks in advance.
>
> Best regards,
>
> Thomas

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


Re: [Tinycc-devel] Dollar Sign in Identifiers Extension

2015-04-11 Thread Daniel Holden

Hi,

I like the idea of using std=c99 to disable. I believe this is how 
gcc/clang handle it. But ultimately I don't mind too much. gcc/clang use 
the switch "-fdollars-in-identifiers" (I've attached a modified patch) 
although in almost all cases it is enabled by default so they also 
provide "-fno-dollars-in-identifiers".


https://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_3.html

I'm mainly interested in this change because I'm working on a new 
version of my library Cello: http://libcello.org/ which uses `$` and 
several variations of as macros. There is also RayLanguage which also 
uses it as a macro for a kind of ObjC style message passing: 
https://github.com/kojiba/RayLanguage . But I can also put together some 
test cases using it in the various ways (variable, function, macro, 
define, etc) so make sure it is completely covered.


Thanks,

Dan

On 11/04/2015 10:00, Thomas Preud'homme wrote:

Le samedi 11 avril 2015, 06:14:04 Sergey Korshunoff a écrit :

Hi! A modified version of the patch is attached.

Looks good at quick look. I'm not sure about the switch, we already accept
some gnu extension without any switch for that. Or maybe introduce a more
general switch for all C extensions. You could enable it by default en disable
it if std=c99 for instance?

Best regards,

Thomas


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


diff -urN tinycc.old/libtcc.c tinycc/libtcc.c
--- tinycc.old/libtcc.c 2015-04-10 23:43:55.0 +0300
+++ tinycc/libtcc.c 2015-04-11 06:08:03.0 +0300
@@ -1479,6 +1479,7 @@
 { offsetof(TCCState, leading_underscore), 0, "leading-underscore" },
 { offsetof(TCCState, ms_extensions), 0, "ms-extensions" },
 { offsetof(TCCState, old_struct_init_code), 0, "old-struct-init-code" },
+{ offsetof(TCCState, dollars_in_identifiers), 0, "dollars-in-identifiers" 
},
 };
 
 /* set/reset a flag */
diff -urN tinycc.old/tcc-doc.texi tinycc/tcc-doc.texi
--- tinycc.old/tcc-doc.texi 2015-04-10 06:30:35.0 +0300
+++ tinycc/tcc-doc.texi 2015-04-11 06:10:22.0 +0300
@@ -241,6 +241,9 @@
 assume a nested named structure declaration without identifier behave
 like an unnamed one.
 
+@item -fdollars-in-identifiers
+Allow a dollars in identifiers
+
 @end table
 
 Warning options:
diff -urN tinycc.old/tcc.h tinycc/tcc.h
--- tinycc.old/tcc.h2015-04-10 23:43:55.0 +0300
+++ tinycc/tcc.h2015-04-11 06:09:01.0 +0300
@@ -605,6 +605,7 @@
 int ms_extensions; /* allow nested named struct w/o identifier 
behave like unnamed */
 int old_struct_init_code;  /* use old algorithm to init array in struct 
when there is no '{' used.
   Liuux 2.4.26 can't find initrd when compiled 
with a new algorithm */
+int dollars_in_identifiers;/* allows '$' char in indentifiers */
 
 /* warning switches */
 int warn_write_strings;
diff -urN tinycc.old/tccpp.c tinycc/tccpp.c
--- tinycc.old/tccpp.c  2015-04-10 16:53:03.0 +0300
+++ tinycc/tccpp.c  2015-04-11 06:06:42.0 +0300
@@ -2286,7 +2286,10 @@
 }
 }
 break;
-
+
+/* treat $ as allowed char in indentifier  */
+case '$': if (!tcc_state->dollars_in_identifiers) goto parse_simple;
+
 case 'a': case 'b': case 'c': case 'd':
 case 'e': case 'f': case 'g': case 'h':
 case 'i': case 'j': case 'k': case 'l':
@@ -2589,8 +2592,8 @@
 case ':':
 case '?':
 case '~':
-case '$': /* only used in assembler */
-case '@': /* dito */
+case '@': /* only used in assembler */
+parse_simple:
 tok = c;
 p++;
 break;
@@ -3174,7 +3177,8 @@
 
 /* init isid table */
 for(i=CH_EOF;i<256;i++)
-isidnum_table[i-CH_EOF] = isid(i) || isnum(i);
+isidnum_table[i-CH_EOF] = (isid(i) || isnum(i) ||
+(tcc_state->dollars_in_identifiers ? i == '$' : 0));
 
 /* add all tokens */
 if (table_ident) {
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Partial revert of nocode_wanted patch

2015-04-11 Thread Sergey Korshunoff
Hi!
> I don't mind people reverting my patch but this seems
like the wrong solution here

Sorry :-) I think I can introduce an option like -flinux-kernel-2426
and then use this option to exclude/change code which breaks
compilation of this code w/o affecting other usage cases.

> I'd be happy to look into this if you can provide me a
> reduced testcase. Please replace -c by -E on the command line and then use
> creduce to make the test as small as possible.

It is possible to reduce a test like a linux 2.4.26 kernel? I can
replace -c by -E and then compile a big preprocessed source. But I
don't know how to use creduce with this file.

PS: this version of the kernel is not a good one. 2.4.37 is better.
But currently 2.4.26 is the only one which can be compiled by tcc.

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


Re: [Tinycc-devel] Dollar Sign in Identifiers Extension

2015-04-11 Thread Sergey Korshunoff
Hi!
> although in almost all cases it is enabled by default
This can be done by using FD_INVERT insteed of 0 in the patch. But
keeping an old behavior of the tcc is safer (I think).

> so they also provide "-fno-dollars-in-identifiers"
this works in tcc too.  Try to test.


2015-04-11 14:49 GMT+03:00, Daniel Holden :
> Hi,
>
> I like the idea of using std=c99 to disable. I believe this is how
> gcc/clang handle it. But ultimately I don't mind too much. gcc/clang use
> the switch "-fdollars-in-identifiers" (I've attached a modified patch)
> although in almost all cases it is enabled by default so they also
> provide "-fno-dollars-in-identifiers".
>
> https://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_3.html
>
> I'm mainly interested in this change because I'm working on a new
> version of my library Cello: http://libcello.org/ which uses `$` and
> several variations of as macros. There is also RayLanguage which also
> uses it as a macro for a kind of ObjC style message passing:
> https://github.com/kojiba/RayLanguage . But I can also put together some
> test cases using it in the various ways (variable, function, macro,
> define, etc) so make sure it is completely covered.
>
> Thanks,
>
> Dan
>
> On 11/04/2015 10:00, Thomas Preud'homme wrote:
>> Le samedi 11 avril 2015, 06:14:04 Sergey Korshunoff a écrit :
>>> Hi! A modified version of the patch is attached.
>> Looks good at quick look. I'm not sure about the switch, we already
>> accept
>> some gnu extension without any switch for that. Or maybe introduce a more
>> general switch for all C extensions. You could enable it by default en
>> disable
>> it if std=c99 for instance?
>>
>> Best regards,
>>
>> Thomas
>>
>>
>> ___
>> 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] Dollar Sign in Identifiers Extension

2015-04-11 Thread Thomas Preud'homme
Le samedi 11 avril 2015, 12:49:49 Daniel Holden a écrit :
> 
> I'm mainly interested in this change because I'm working on a new
> version of my library Cello: http://libcello.org/ which uses `$` and
> several variations of as macros. There is also RayLanguage which also
> uses it as a macro for a kind of ObjC style message passing:
> https://github.com/kojiba/RayLanguage . But I can also put together some
> test cases using it in the various ways (variable, function, macro,
> define, etc) so make sure it is completely covered.

Testcase are very much welcome for each new feature and bugfix. There should 
always be a testcase unless it's difficult to construct one.

Best regards,

Thomas

signature.asc
Description: This is a digitally signed message part.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Partial revert of nocode_wanted patch

2015-04-11 Thread Thomas Preud'homme
Le samedi 11 avril 2015, 15:54:45 Sergey Korshunoff a écrit :
> Hi!
> 
> > I don't mind people reverting my patch but this seems
> 
> like the wrong solution here
> 
> Sorry :-) I think I can introduce an option like -flinux-kernel-2426
> and then use this option to exclude/change code which breaks
> compilation of this code w/o affecting other usage cases.

It's not what I meant. I'm happy to see a fix to compile an old linux kernel. 
It's just that I think this is not the right place for a fix. nocode_wanted is 
there to indicate that we are out of a function and so generating code doesn't 
have any meaning. This suggest that nocode_wanted was set when it shouldn't 
have.

> 
> It is possible to reduce a test like a linux 2.4.26 kernel? I can
> replace -c by -E and then compile a big preprocessed source. But I
> don't know how to use creduce with this file.

The size of the file doesn't matter. creduce works by iteratively trying some 
valid transformation on the source and then running the script you specified it 
and see if it fails or not. Here the script would just look at the warning 
generated by tcc and return an exit code accordingly. If the file after 
reduction is still too big, try a few transformation yourself and try to 
reduce the result again. I've used it a few times and it works quite well.

> 
> PS: this version of the kernel is not a good one. 2.4.37 is better.
> But currently 2.4.26 is the only one which can be compiled by tcc.

What do you mean by "is not a good one"? Is the code totally invalid C? It all 
boils down to whether we want tcc to be able to compile such code. If yes, 
then it doesn't matter if the code is ugly or what.

Best regards,

Thomas

signature.asc
Description: This is a digitally signed message part.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Dollar Sign in Identifiers Extension

2015-04-11 Thread Sergey Korshunoff
Hi, Daniel Holden.
> I'm mainly interested in this change because I'm working on a new
> version of my library Cello: http://libcello.org/ which uses `$` and
> several variations of as macros.

>From libCello docs: Lambda ... GNU99 C has a great feature that lets
you define functions inside functions

tcc currently don't have a nested functions implemented. This is a
nice feature. But it is not implemented :-(

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


Re: [Tinycc-devel] Partial revert of nocode_wanted patch

2015-04-11 Thread Sergey Korshunoff
Hi, Thomas!

> What do you mean by "is not a good one"? Is the code totally invalid C? It all
> boils down to whether we want tcc to be able to compile such code. If yes,
> then it doesn't matter if the code is ugly or what.

This version of the kernel can't be compiled by the gcc 3.4+  Only gcc
2.95  This is what I mean. The situation is different with the 2.4.37.
This version of the kernel can be compiled by newer versions of the
gcc (I tested gcc 3.4.6 and 4.1.2)

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


Re: [Tinycc-devel] Dollar Sign in Identifiers Extension

2015-04-11 Thread Daniel Holden

Hey,

That's okay - in the new version (I've not release publicly) I've 
removed that feature and tcc with the patch works perfectly on it. 
Compiles in lightning speed!


- Dan

On 11/04/2015 15:31, Sergey Korshunoff wrote:

Hi, Daniel Holden.

I'm mainly interested in this change because I'm working on a new
version of my library Cello: http://libcello.org/ which uses `$` and
several variations of as macros.

 From libCello docs: Lambda ... GNU99 C has a great feature that lets
you define functions inside functions

tcc currently don't have a nested functions implemented. This is a
nice feature. But it is not implemented :-(

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




--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


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


Re: [Tinycc-devel] Nested functions (was: Dollar Sign in Identifiers Extension)

2015-04-11 Thread u-tcc-uepj
Hi Sergey,

On Sat, Apr 11, 2015 at 05:31:30PM +0300, Sergey Korshunoff wrote:
> From libCello docs: Lambda ... GNU99 C has a great feature that lets
> you define functions inside functions
> 
> tcc currently don't have a nested functions implemented. This is a
> nice feature. But it is not implemented :-(

This is not standard C and it is not standard for a reason - the feature
opens a can of worms, it is pretty hard to support it without introducing
regressions and/or limitations.

See f.i. the recent descussion on the pcc list, it is long but here are
a couple of messages which make good points:

 https://marc.info/?l=pcc-list&m=142195333911806&w=2
 https://marc.info/?l=pcc-list&m=142199106621724&w=2
 https://marc.info/?l=pcc-list&m=142201611028645&w=2

IOW, C is probably not the right language for this feature.

I would say tcc is neither the right compiler to add features to :)
if we want it to be small and fast. Especially the intrusive features
like the nested functions should be kept out, IMVHO.

Rune


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


Re: [Tinycc-devel] Any interest in #pragma(lib) and CGI extensions?

2015-04-11 Thread Steven G. Messervey
>A preliminary patch for the -xc and -xa options is attached.

Fails. Output for a simple file (source included after output):
tcc -xc -run sgm/foo.cgi
-8<---
tcc: warning: file extension is C
sgm/foo.cgi:1: warning: We going to compile a C file

/usr/lib/i386-linux-gnu/libc.so:1: warning: We going to compile a C file

/usr/lib/i386-linux-gnu/libc.so:4: error: ',' expected (got "-")
/usr/lib/i386-linux-gnu/libc.a:1: warning: We going to compile a C file

/usr/lib/i386-linux-gnu/libc.a:1: error: declaration expected
/usr/local/lib/tcc/i386/libtcc1.a:1: warning: We going to compile a C file

/usr/local/lib/tcc/i386/libtcc1.a:1: error: declaration expected
>8-

Simple file (sgm/foo.cgi):
>8---
#include 
#include 
#include 

int main(int argc, char **argv) {
  char *foo;
  foo = malloc(128);
  strcpy(foo,"Hello,CGI\n");
  printf(foo);
  free(foo);
  exit(0);
}
--8<

Of course, if the extension is changed to '.c' it works as expected.

Thanks,
  Steven G.


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