[Tinycc-devel] patch for #pragma comment(lib,...)

2015-04-12 Thread Steven G. Messervey
Hello all, Attached is patch for files tcctok.h and tccpp.c which implements '#pragma comment(lib,...)'. Example: #pragma comment(lib,foo) will link the library 'foo' as if specified by -lfoo Note that -fms-extensions must be included on the command line, or the #pragma will be ignored. I

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

2015-04-12 Thread Christian Jullien
Good luck for nested function implementers that (as is Lisp :o) will want to make this code working! typedef int (*fp) (uint32_t i); int callback(fp fn, uint32_t i) fn(i);{ } uint32_t isEven(uint32_t i) { uint32_t odd(uint32_t i) { if (i == 0) return 0;

[Tinycc-devel] #pragma comment(lib,...) patch

2015-04-12 Thread Steven G. Messervey
Oops, forgot the patch. pragma_lib.patch Description: Binary data ___ 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-12 Thread Sergey Korshunoff
Hi! There is patch partialy related with the previous one. It adds the ability to compile a multiple source files with the -c switch like tcc -c ex2.c ex5.c -xc ex7.cgi -xn ex8.c ex9.cgi PS: I used it to test the previous patch Both patches work nicely, but there is wrinkle with multiple

Re: [Tinycc-devel] #pragma comment(lib,...) patch

2015-04-12 Thread Sergey Korshunoff
Hi! As sugested Tomas Preud'homme: Turn on a fill tabs with spaces option in your editor. Be also careful that some files are indented with 2 spaces (when they have large indentation) while most are indented with 4 spaces There are a tabs in your patch :-( Otherwise it looks nice. I will try

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

2015-04-12 Thread Sergey Korshunoff
Recursion is a more nasty thing than a nested function. But with a few levels of the recursion a stack unwinding in the nested function (to search a parent BP) can be acceptable (I think) ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org

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

2015-04-12 Thread Sergey Korshunoff
Is this method can be accepted for C? I going to understand why trampolines are used in gcc: this strub gives a stack pointer of the parent to the real nested function (hardcoded as constant) and calls this nested function. Address of the nested function is the address of the stub for the outer

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

2015-04-12 Thread Sergey Korshunoff
Hi! Is a nested function needs to unwind a stack or there must be a last parm (hidden) which points to the parent stack? About nested functions in FreePascal: http://www.freepascal.org/docs-html/prog/progse23.html Is this method can be accepted for C?

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

2015-04-12 Thread Christian Jullien
No need to search for a parent BP if you don't support recursive functions and function pointer return as with my example. In this case you 'only' have to implement currying on your local functions. It's a big change for the compiler. C. -Original Message- From:

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

2015-04-12 Thread Thomas Preud'homme
Le samedi 11 avril 2015, 17:43:05 Sergey Korshunoff a écrit : 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

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

2015-04-12 Thread Sergey Korshunoff
Hi! There is a rigth patch attached. This one must work like in gcc. PS: it is strange that tcc can not compile multiple files like gcc -c ex1.c ex3.c 020-x-option.patch Description: Binary data ___ Tinycc-devel mailing list Tinycc-devel@nongnu.org

Re: [Tinycc-devel] Fix for Microsoft compilers

2015-04-12 Thread oldfaber
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 Yes, you are right, the patch is wrong. What about removing char buf[32] and replacing

Re: [Tinycc-devel] [PATCH] TCC arm64 back end

2015-04-12 Thread Thomas Preud'homme
Hi Michael, Le mercredi 11 mars 2015, 23:10:45 Thomas Preud'homme a écrit : Le dimanche 22 février 2015, 06:13:21 Michael Matz a écrit : And I pulled my hair out again when tracing the different paths the linker can go through in different modes, and how the relocs and symbol values

Re: [Tinycc-devel] Fix for Microsoft compilers

2015-04-12 Thread Thomas Preud'homme
Le dimanche 12 avril 2015, 15:10:14 oldfaber a écrit : 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 Yes, you are right, the patch is wrong.

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

2015-04-12 Thread Sergey Korshunoff
Hi! There is patch partialy related with the previous one. It adds the ability to compile a multiple source files with the -c switch like tcc -c ex2.c ex5.c -xc ex7.cgi -xn ex8.c ex9.cgi PS: I used it to test the previous patch 021-multiple-o-files.patch Description: Binary data

Re: [Tinycc-devel] [PATCH] TCC arm64 back end

2015-04-12 Thread Thomas Preud'homme
On April 12, 2015 7:02:22 PM GMT+08:00, Sergey Korshunoff sey...@gmail.com wrote: Hi, Tomas! the name resolution put the program last in the global order rather than first. Is this hard to change? It should be ok for me because I'm already familiar with the code. I will fix it this week.

Re: [Tinycc-devel] Fix for Microsoft compilers

2015-04-12 Thread Sergey Korshunoff
Hi! Oh my, get_tok_str returns a pointer to a local variable. So the proper fix would be to make get_tok_str take a CString as parameter and have the caller allocate the buffer associated with the CString. And then it's just a matter of allocating buf to STRING_MAX_SIZE. But there is a

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

2015-04-12 Thread Steven G. Messervey
Hi! There is patch partialy related with the previous one. It adds the ability to compile a multiple source files with the -c switch like tcc -c ex2.c ex5.c -xc ex7.cgi -xn ex8.c ex9.cgi PS: I used it to test the previous patch Both patches work nicely, but there is wrinkle with multiple

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

2015-04-12 Thread Jared Maddox
Date: Sat, 11 Apr 2015 17:31:30 +0300 From: Sergey Korshunoff sey...@gmail.com To: tinycc-devel@nongnu.org Subject: Re: [Tinycc-devel] Dollar Sign in Identifiers Extension Message-ID: CAKG6wnZ9Re=wyyzukplozzod5nvjm5gq7d95q3fbxix7nkh...@mail.gmail.com Content-Type: text/plain;