| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
| |
after several "fixes" and "improvements"
b3782c3cf5e66f74207303c381a305daabccdb12
5fb57bead41cd3a84f0aa3f98d00b5fe5de25a08
feature did not work at all
- Use 'once' flag, not 'ifndef_macro'
- Ignore filename letter case on _WIN32
- Increment global pp_once for each compilation
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
... also for built-in defines
The case:
$ tcc -D FOO a.c b.c
with
// a.c
#undef FOO
// b.c
#ifndef FOO
# error -D FOO has been lost
#endif
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
fixes 5c35ba66c5ade4713bbd9c005e66889f6d7db293
Implementation was consistent within tcc but incompatible
with the ABI (for example library functions vprintf etc)
Also:
- tccpp.c/get_tok_str() : avoid "unknown format "%llu" warning
- x86_64_gen.c/gen_vla_alloc() : fix vstack leak
|
| |
|
|
|
|
| |
Smaller change to fix more cases
This reverts commit 0f36f60faa05da7e250a4b4eebd4b534e8a2b537.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This may be used to preprocess Fabrice Bellards initial revision
in this repository to demonstrate its capability to compile and
run itself (on i386 32-bit linux or windows).
Initial revision: 27f6e16bae9d0f73acec07f61aea696ab5adc680
Also needed:
* an empty stdio.h
* a wrapper named tc.c with
void expr(void);
void decl(int);
void next(void);
#include "tcc.c"
* an hello.c such as
int main()
{
printf("Hello World\n");
return 0;
}
All files with unix LF only lines. Then ...
* preprocess the source
$ tcc -E -P10 -I. tcc.c -o tc1.c
* compile the compiler
$ tcc -w -I. tc.c -o tc -ldl
* run it to compile and
run itself to compile and
run itself to compile and
run itself to compile and
run hello.c
$ ./tc tc1.c tc1.c tc1.c hello.c
--> Hello World!
------------------------------------------------------
* On i386 windows this may be added to the tc.c wrapper
#ifdef _WIN32
#include <windows.h>
void *dlsym(int x, const char *func)
{
if (0 == strcmp(func, "dlsym"))
return &dlsym;
return GetProcAddress(LoadLibrary("msvcrt"), func);
}
#endif
|
| |
|
|
|
|
| |
Insert a space when it is required to prevent mistokenisation of
the output, and also in a few cases where it is not strictly
required, imitating GCC's behaviour.
|
| | |
|
| |
|
|
|
|
|
| |
The lexer is for reading files, not for writing.
Also :
- macro_is_equal(): avoid crash if redefining __FILE__
|
| | |
|
| | |
|
| |
|
|
|
|
| |
oxe+1 is parsed as 0xe +1 if (parse_flags & PARSE_FLAG_ASM_FILE)
Helps to compile a code:
__asm__("mov $0xe" "+1", "%eax\n")
|
| | |
|
| |
|
|
|
|
| |
* correct -E output for the case ++ + ++ concatenation
do this only for expanded from macro string
and only when tcc_state->output_type == TCC_OUTPUT_PREPROCESS
|
| |
|
|
|
|
|
|
|
| |
#define Y(x) Z(x)
#define X Y
return X(X(1));
was : return Z(Y(1));
now : return Z(Z(1));
|
| |
|
|
| |
Now no trap when compiling tccboot
|
| |
|
|
|
| |
and '.' alone is a token now in *.S (not an identifier)
representing a current position in the code (PC).
|
| |
|
|
| |
This code is from "Improve hash performance"
|
| |
|
|
|
|
|
|
|
| |
- uses new `TinyAlloc`-ators for small `TokenSym`, `CString` and
`TokenString` instances
- conditional `TAL_DEBUG` for mem leaks and double frees detection
- on `TAL_DEBUG` collects allocation origin (file + line)
- conditional `TAL_INFO` for allocators stats (in release mode too)
- chain a new allocator twice current capacity on buffer exhaustion
|
| |
|
|
|
|
|
|
|
|
|
|
| |
- better `TOK_HASH_FUNC`
- increases `hash_ident` initial size to 16k (from 8k)
- `cstr_cat` uses single `realloc` + `memcpy`
- `cstr_cat` can append terminating zero
- `tok_str_realloc` initial size to 16 (from 8)
- `parse_define` uses static `tokstr_buf`
- `next` uses static `tokstr_buf`
- fixes two latent bugs (wrong deallocations in libtcc.c:482 and
tccpp.c:2987)
|
| |
|
|
|
|
|
|
|
|
| |
parse_print_line_comment() and parse_print_comment() are
combined and made more simply:
* don't worry about speed with -E option
* don't handle straya in comments
Do we need to handle strays in regular
parse_line_comment() and
parse_comment() ?
|
| |
|
|
|
| |
This is done by impression of the pcc -C option.
Usual execution path and speed are not changed.
|
| |
|
|
|
| |
with a test program. Problem detected when trying to
compile linux-2.4.37.9 with tcc.
|
| |
|
|
|
| |
gcc 3.4.6 don't understand "#if PATHCMP==stricmp"
where "#define PATHCMP stricmp"
|
| |
|
|
| |
These are used in `libtcc.c` now and cannot remain in `tccpe.c`
|
| |
|
|
| |
This takes care of case-insensitive filenames (like on win32)
|
| |
|
|
| |
Missed these in e946eb2a4109e0de5f8514457f851897a4824c3e
|
| |
|
|
|
|
|
| |
A problem was in TOK_ASMDIR_text:
- sprintf(sname, ".%s", get_tok_str(tok1, NULL));
+ sprintf(sname, "%s", get_tok_str(tok1, NULL));
When tok1 is '.text', then sname is '..text'
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
From: Vlad Vissoultchev
Date: Mon, 11 Apr 2016 01:26:32 +0300
Subject: Fix pragma once guard when compiling multiple source files
When compiling multiple source files directly to executable cached
include files guard was incorrectly checked for TOK_once in ifndef_macro
member.
If two source files included the same header guarded by pragma once, then
the second one erroneously skipped it as `cached_includes` is not cleared
on second `tcc_compile`
|
| |
|
|
|
|
|
|
| |
When tccboot kernels compiles with
'Identifiers can start and/or', this kernel don't start.
It is hard to find what is wrong.
PS: there was no test for identifiers in *.S with '.'
|
| |
|
|
|
|
| |
There was already support for -dD option but in contrast -dM dumps only `#define` directives w/o actual preprocessor output.
The original -dD output differs from gcc output by additional comment in front of `#define`s so this quirk is left for -dM as well.
|
| |
|
|
| |
more logical algorithm of the isidnum_table[] changing
|
| |
|
|
|
|
|
| |
we use gnu extension "case 0x80 ... 0xFF" for tcc & gcc
and perform test
if(c & 0x80)
for other compilers
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
made like in pcc
(pcc.ludd.ltu.se/ftp/pub/pcc-docs/pcc-utf8-ver3.pdf)
We treat all chars with high bit set as alphabetic.
This allow code like
#include <stdio.h>
int Lefèvre=2;
int main() {
printf("Lefèvre=%d\n",Lefèvre);
return 0;
}
|
| |
|
|
|
| |
compilation speed of the tccboot restored
(patch remove testing of the parse_flags in loop)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
modified version of the old one which don't allow '.'
in #define Identifiers. This allow correctly preprocess
the following code in *.S
#define SRC(y...) \
9999: y; \
.section __ex_table, "a"; \
.long 9999b, 6001f ; \
// .previous
SRC(1: movw (%esi), %bx)
6001:
A test included.
|
| |
|
|
|
|
| |
remove non-existent or duplicate directories from include paths
if -fnormalize-inc-dirs is specified. This will help
to compile current coreutils package
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Identifiers can start and/or contain '.' in PARSE_FLAG_ASM_FILE
- Move all GAS directives under TOK_ASMDIR prefix
This patches breaks compilation of the tccboot (linux 2.4.26
kernel). A test.S which fails with this patches:
#define SRC(y...) \
9999: y; \
.section __ex_table, "a"; \
.long 9999b, 6001f<---->; \
.previous
SRC(1:<>movw (%esi), %bx<------>)
// 029-test.S:7: error: macro 'SRC' used with too many args
|
| |
|
|
|
| |
We really need to use PEEKC during tokenization so as to
skip line continuations automatically.
|
| |
|
|
| |
Including labels, directives and section names
|
| |
|
|
| |
`macro_arg_subst`
|
| |
|
|
| |
expansion
|
| |
|
|
|
|
|
|
|
| |
A CString used to be copied into a token string, which is an int array.
On a 64-bit architecture the pointers were misaligned, so ASan gave
lots of warnings. On a 64-bit architecture that required memory
accesses to be correctly aligned it would not work at all.
The CString is now included in CValue instead.
|
| |
|
|
|
|
|
|
|
|
| |
for gas comments lonely on a line such as
# .. more stuff
where tcc would try to parse .. as a preprocessor directive
See also: 0b3612631f49ba0c008635aaa46ecf8be2eefcf7
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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"
c3975cf27c792d493e76a2058a1eaf588324053e
&& 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
|
| | |
|
| |
|
|
| |
A case for the absolute path: prevent an error after openening
|