Commit Graph

232 Commits (eacdc426d76a88aa9b6efc698106d3f36a774905)

Author SHA1 Message Date
grischka eacdc426d7 libtcc: cleanup @listfile
Also:
- allow more than one item per line
- respect "quoted items" and escaped quotes \"
  (also for LIBTCCAPI tcc_setoptions)

- cleanup some copy & paste
2016-10-01 20:19:37 +02:00
grischka 09a487eb2b libtcc: cleanup -x<filetype> switch code
Abusing filename[0] as type is just too much of a hack.
-- From 0536407204
2016-10-01 20:04:58 +02:00
grischka e630113771 Revert "ability to compile multiple *.c files with -c switch"
copy & paste coding, twisted control flow
This reverts commit a13f183e4c.

Also, set linker args for DLLs also.
2016-10-01 20:04:33 +02:00
grischka 07e47b3dd6 tccpp: restore -D symbols for multiple sources
... 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
2016-10-01 19:58:13 +02:00
grischka cf32bb8812 Revert "--whole-archive support"
- would parse linker args in two different places
- would mess up "tcc -v ..." output:
  	tcc -v test.c
  	-> test.c
  	+> test.c
- would use function "tcc_load_alacarte()" to do the contrary of
  what its name suggests.

This reverts commit 19a169ceb8.
2016-10-01 19:56:25 +02:00
Jean-Claude Beaudoin d5a1e32ac3 Prevent tail spin crash when option -pthread is used. 2016-09-29 16:23:11 -04:00
Jean-Claude Beaudoin 889ee28ed5 Rein in unintended external functions on Windows. 2016-09-27 01:43:40 -04:00
Christian Jullien e037fd3364 pstrcpy looks to be needed by Windows win32/win64 builds. Reverted as PUB_FUNC to allow tcc.exe build again. 2016-09-26 07:02:42 +02:00
Christian Jullien 6db7a2157b Merge branch 'mob' of git://repo.or.cz/tinycc into mypatch
Add Visual Studio processor identification
2016-09-26 06:42:43 +02:00
Christian Jullien 30238b1ebd Add Microsoft processor identification 2016-09-26 06:41:31 +02:00
Jean-Claude Beaudoin ff158bffe6 Rein in unintended external functions. 2016-09-25 22:32:41 -04:00
Christian Jullien c1b101cbaf Improve __*LP*__ predefined macros 2016-09-25 12:03:23 +02:00
grischka 9e0e05eb4e Redo "fix line number in macro redefined message"
Smaller change to fix more cases

This reverts commit 0f36f60faa.
2016-05-25 18:51:36 +02:00
seyko 19a169ceb8 --whole-archive support
A patch is implemented as suggested in tinycc-devel mail list.

    From: Reuben Thomas
    Date: Thu, 31 Jul 2014 16:52:53 +0100
    Subject: [PATCH] Add --{no,}-whole-archive support

    I resurrected the patch supplied to the mailing list in 2009
    Since --whole-archive is a useful flag to get tcc working with
    autotools, and of course in its own right, I suggest you have a look
    at the patch and see if it is acceptable. I cannot see any suggestion
    that it was actively rejected last time round, just no evidence that
    it was ever added.
2016-05-20 15:12:32 +03:00
seyko 9d679e3916 memory model macros __{L,}LP64__
a patch from tcc bugzilla.
    From: Reuben Thomas
    Date: Thu, 31 Jul 2014 13:50:13 +0100
    Subject: [PATCH] libtcc.c: add memory model macros __{L,}LP64__
2016-05-15 21:07:05 +03:00
grischka fe845cf53d tccpp: cleanup options -dD -dM, remove -C
The lexer is for reading files, not for writing.

Also :
- macro_is_equal(): avoid crash if redefining __FILE__
2016-05-05 14:12:53 +02:00
grischka caebbc3ee1 tccgen: scope levels for local symbols
... for fast redeclaration checks

Also, check function parameters too:
    void foo(int a) { int a; ... }

Also, try to fix struct/union/enum's on different scopes:
    { struct xxx { int x; };
         { struct xxx { int y; }; ... }}
and some (probably not all) combination with incomplete
declarations "struct xxx;"

Replaces 2bfedb1867
and 07d896c8e5

Fixes cf95ac399c
2016-05-05 10:39:09 +02:00
seyko 2bfedb1867 -fno-type-redefinition-check
don't catch redefinition for local vars. With this option on
    tcc accepts the following code:
    int main()
    {
        int a = 0;
        long a = 0;
    }
    But if you shure there is no problem with your local variables,
    then a compilation speed can be improved if you have a lots of
    the local variables (50000+)
2016-05-04 17:17:51 +03:00
seyko edcb15c31f section alignment
Alignment of unknown sections changed from 32 to PTR_SIZE
    This is gcc/pcc default value. This helps to use
    tcc as linux kernel compiler.
2016-04-22 18:25:40 +03:00
Vlad Vissoultchev 224236f57c Improve hash performance
- 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)
2016-04-17 17:25:55 +03:00
seyko 5ee097fce9 allow to compile tcc by pcc
* pcc have only __linux__ macro (and no __linux)
    * pcc don't have __clear_cache proc
2016-04-15 17:41:49 +03:00
seyko c6dc756d4e preprocessor oprtion -C (keep comments)
This is done by impression of the pcc -C option.
    Usual execution path and speed are not changed.
2016-04-15 17:15:11 +03:00
Vlad Vissoultchev cb5f6b063b Simplify @listfiles parsing
This moves listfiles parsing inline in `tcc_parse_args1`
2016-04-13 11:35:24 +03:00
seyko 989b5ee8ae Allow tcc arguments to be read from @listfiles
From: Vlad Vissoultchev
    Date: Tue, 12 Apr 2016 20:43:15 +0300
    Subject: Allow tcc arguments to be read from @listfiles

    This allows all @ prefixed arguments to be treated as listfiles
    containing list of source files or tcc options where each one is on a
    separate line. Can be used to benchmark compilation speed with
    non-trivial amount of source files.

    The impl of `tcc_parse_args` had to be moved to a new function that is
    able to be called recursively w/ the original one remaining as a driver
    of the new one. Listfiles parsing happens in a new
    `args_parser_add_listfile` function that uses `tcc_open`/`tcc_close/inp`
    for buffered file input.
2016-04-13 07:05:38 +03:00
Vlad Vissoultchev e946eb2a41 Implement -dM preprocessor option as in gcc
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.
2016-04-06 18:57:11 +03:00
seyko 41785a0bf9 -fnormalize-inc-dirs
remove non-existent or duplicate directories from include paths
    if -fnormalize-inc-dirs is specified. This will help
    to compile current coreutils package
2016-04-03 11:42:15 +03:00
grischka 0b3612631f tccpp: cleanup #include_next
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
2015-11-20 12:05:55 +01:00
grischka 54cf57ab1a tccgen: asm_label cleanup
- avoid memory allocation by using its (int) token number
- avoid additional function parameter by using Attribute

Also: fix some strange looking error messages
2015-11-20 11:22:56 +01:00
Edmund Grimley Evans ba99a70cd8 Trivial changes to avoid some compiler warnings. 2015-11-19 18:26:47 +00:00
Edmund Grimley Evans c39bc9caa7 libtcc.c: Completely replace tcc_normalize_inc_dirs. 2015-11-11 21:18:01 +00:00
Avi Halachmi (:avih) 951c23f257 win: include dirs: add some docs, minor refactor 2015-11-08 16:28:00 +02:00
seyko 763dd22b35 fix tcc_mormalize_inc_dirs naming 2015-11-08 11:42:56 +03:00
Avi Halachmi (:avih) ec67dc482f win: fix incorrect directory detection
Allow other flags too...
2015-11-08 04:33:30 +02:00
Avi Halachmi (:avih) acbab220c8 win: fix dir comparison during include dirs processing
Use native Windows API via wrapper with stat-like API.
2015-11-08 03:56:25 +02:00
seyko a6276b7a78 normalize inc dirs, symplify include_next
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
2015-11-05 19:52:49 +03:00
Kamil Rytarowski 6cb74ecacf Define __WINT_TYPE__ as int in NetBSD 2015-10-11 11:59:20 +02:00
Kamil Rytarowski 5860b639c6 Add support for -D__NetBSD__ 2015-10-11 03:12:35 +02:00
gus knight 89ad24e7d6 Revert all of my changes to directories & codingstyle. 2015-07-29 16:57:12 -04:00
gus knight 47e06c6d4e Reorganize the source tree.
* Documentation is now in "docs".
 * Source code is now in "src".
 * Misc. fixes here and there so that everything still works.

I think I got everything in this commit, but I only tested this
on Linux (Make) and Windows (CMake), so I might've messed
something up on other platforms...
2015-07-27 16:03:25 -04:00
gus knight d6b64e2574 Clean up lots of rogue tabs.
Still some more tabs to be taken care of. arm-gen.c and tcccoff.c
have so many style issues that I'm just going to throw clang-format
at them.
2015-07-27 14:14:41 -04:00
gus knight 41031221c8 Trim trailing spaces everywhere. 2015-07-27 12:43:40 -04:00
seyko 80322adaa0 redo of the -dD option
functionality was broken some time ago and was removed
    by the "tccpp: fix issues, add tests"

    fix: LINE_MACRO_OUTPUT_FORMAT_NONE in pp_line()
    means: output '\n' and not "don't output at all"
2015-05-13 12:16:00 +03:00
seyko cf92f7aacb some -bench fixes
print stats to stderr, not to stdout
2015-05-12 22:02:51 +03:00
seyko 06e0753fce minor pp optimizations
* remove free_defines() from tcc_preprocess()
        all cleanup will be done in tcc_delete
    * move a preprocessor file closing to tcc_delete too
2015-05-12 21:32:32 +03:00
seyko 1234beccb8 restore a max memory usage printing for a new MEM_DEBUG when -bench 2015-05-12 16:07:09 +03:00
seyko 121e95d115 a new version of the MEM_DEBUG 2015-05-12 11:56:39 +03:00
seyko ae09051c81 allow to use MEM_DEBUG with libtcc 2015-05-11 18:05:31 +03:00
seyko cb7e820eae tcc_add_dll is not used if TCC_TARGET_PE
after "tccpp: fix issues, add tests"
2015-05-10 11:37:36 +03:00
seyko ff06d4258e define __OPTIMIZE__ if -ON (N != 0)
this is gcc behaviour
2015-05-10 10:21:37 +03:00
seyko c497f9c82c warn if multile -o option is given 2015-05-10 10:13:35 +03:00