tcc_normalize_inc_dirs: normally no problem to be absolutly
gcc compatible as long as it can be done the tiny way.
This reverts to the state before recent related commits and
reimplements a (small) part of it to fix the reported problem.
Also: Revert "parsing "..." sequence"
c3975cf27c
&& p[1] == '.'
is not a reliable way to lookahead
- avoid memory allocation by using its (int) token number
- avoid additional function parameter by using Attribute
Also: fix some strange looking error messages
In a case like
typedef int T[1];
const T x;
we must make a copy of the typedef type so that we can add the type
qualifiers to it.
The following code used to give
error: incompatible types for redefinition of 'f'
typedef int T[1];
void f(const int [1]);
void f(const T);
round and fmin/fmax are relatively commonly used functions but were not
implemented anywhere in the tcc Windows distribution package. Newer mingw(64)
math.h stil doesn't include these implementations.
Add C implementations for these functions and place it as inline functions at
win32/include/tcc/tcc_libm.h - which is already included from math.h .
The code is mostly taken from musl-libc rs-1.0 (MIT) [*],
musl-libc: http://git.musl-libc.org/cgit/musl/tree/src/math?h=rs-1.0
license: http://git.musl-libc.org/cgit/musl/tree/COPYRIGHT?h=rs-1.0
Potential enhancements:
- Check how many useful libm implementations are still missing and consider
adding them (some of them already work via the MS runtime).
- Consider putting libm implementations in an actual libm.a file, or add a dummy
one such that build processes which try to link with libm will not fail.
The asm code cannot currently be used with tcc since tcc doesn't support 't'
constraint.
Use inline C implementation instead, place it win32/include/tcc/tcc_libm.h, and
include it from win32/include/math.h.
Since fpclassify now works, it also fixes few other macros which depend on it.
Implicitly fixed: isfinite, isinf, isnan, isnormal.
The implementations were taken from musl-libc rs-1.0 (MIT license).
musl-libc: http://git.musl-libc.org/cgit/musl/tree/src/math?h=rs-1.0
license: http://git.musl-libc.org/cgit/musl/tree/COPYRIGHT?h=rs-1.0
It was broken due to tcc not able to compile asm with 't' constraint, and it's
still broken because fpclassify on which it now depends has the same issue. Next
commit will fix this.
./configure --enable-cross
make
tcc -o i386-tcc tcc.c
tcc -o x86_64-tcc tcc.c
tcc -o i386-win-tcc tcc.c
In file included from tcc.c:22:
In file included from libtcc.c:39:
tccgen.c:2580: error: 'TOK_memmove' undeclared
include dirs are prepared as in gcc
- for each duplicate path keep just the first one
- remove each include_path that exists in sysinclude_paths
include_next streamlined by introducing inc_path_index
in the BufferedFile
gcc-3.4.6 don't give such error by default
example file1
char __version_303_xxxxxxxx;
void func1() {}
example file2
char __version_303_xxxxxxxx;
void func2() {}
int main() { return 0; }
This version looks rigth. Comparing to the original
algorithm:
1) Loop breaking. We remember a start point after wich
we can try next path. Do not search include stack after
this.
2) But compare next file patch with the start point.
Skip if it the same. Remove "./" before comparing.
PS: a problems with compaling a coreutils-8.24.51-8802e
remain. There are errors messages like:
src/chgrp
src/chown-core.c:42: multiple definition of `make_timespec'
src/chgrp.c:42: first defined here
A problem is in the lib/config.h
#define _GL_INLINE_ extern inline // gcc
#define _GL_INLINE_ inline // tcc
A long description from the lib/config.h
* suppress extern inline with HP-UX cc, as it appears to be broken
* suppress extern inline with Sun C in standards-conformance mode
* suppress extern inline on configurations that mistakenly use
'static inline' to implement functions or macros in standard
C headers like <ctype.h>.
GCC and Clang are excluded from this list. Why not tcc?