[Tinycc-devel] macro expansion bug

2014-04-02 Thread Jay Foad
Hi,

With tcc I get:

$ cat cat.c
#define CAT2(a,b) a##b
#define CAT(a,b) CAT2(a,b)
#define AB(x) CAT(x,y)
CAT(A,B)(x)
$ ./tcc -E cat.c
# 2 cat.c


CAT(x,y)

But I think this is wrong, because gcc -E and clang -E both expand the
last line further to give just:

xy

The test case is massively reduced from some real code!

Jay.

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


Re: [Tinycc-devel] macro expansion bug

2014-04-02 Thread Vincent Lefevre
On 2014-04-02 14:46:36 +0100, Jay Foad wrote:
 With tcc I get:
 
 $ cat cat.c
 #define CAT2(a,b) a##b
 #define CAT(a,b) CAT2(a,b)
 #define AB(x) CAT(x,y)
 CAT(A,B)(x)
 $ ./tcc -E cat.c
 # 2 cat.c
 
 
 CAT(x,y)
 
 But I think this is wrong, because gcc -E and clang -E both expand the
 last line further to give just:
 
 xy

For future testcases, this means that this wouldn't be equivalent to:

#define CAT2(a,b) a##b(x)
#define CAT(a,b) CAT2(a,b)
#define AB(x) CAT(x,y)
CAT(A,B)

and

#define CAT2(a,b) a##b
#define CAT(a,b) CAT2(a,b)(x)
#define AB(x) CAT(x,y)
CAT(A,B)

which both give:

CAT(x,y)

for the last line.

FYI, icc (ICC) 13.1.0 20130121 behaves like gcc.

-- 
Vincent Lefèvre vinc...@vinc17.net - Web: https://www.vinc17.net/
100% accessible validated (X)HTML - Blog: https://www.vinc17.net/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] macro expansion bug

2014-04-02 Thread mobi phil
I can confirm that during my experiments I tried to pre-compile some macro
hell and tcc failed to do it correctly. These macros are similar to boost
macros. This makes me guessing that boost macros would also fail (I assume
there are no C++ dependencies in there).

If there is intention to fix the precompiler, I could also give more input,
with other words could investigate again what was failing.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] x86_64: shared libs

2014-04-02 Thread Michael Matz

Hi,

On Mon, 31 Mar 2014, Aharon Robbins wrote:


Testing appreciated (hi Arnold :) ).


This has certainly improved things; two tests that used to fail now
pass, although two more continue to fail.  If you want to test yourself,
here's the recipe:

git clone git://git.savannah.gnu.org/gawk.git
cd gawk
git checkout gawk-4.1-stable
./bootstrap.sh  # due after clone or pull
./configure CC=tcc  make
make -k check   # filefuncs and functab4 tests should fail

This is really great progress, thanks!


Thanks for the report.  The cause is that libtcc1.a needs to contain 
position independend code as well (so that it may be linked into shared 
libraries).  I've simply added -fPIC for compiling all components of it, 
which should be fine no matter if it's compiled by gcc or tcc.


In any case the default config from tcc (mob branch as of ea2805f0) can 
now build gawk-4.1-stable without shared lib regressions (i.e. filefuncs 
and functab4 now work).  I do see other tests fail as well: backbigs1, 
backsmalls1, mbfw1, mbprintf1 and mbprintf4; which seem to be locale 
dependend, but they work when compiling with gcc on my system.  But seems 
unrelated to shared libs issues.



Ciao,
Michael.

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