aboutsummaryrefslogtreecommitdiff
path: root/tcc.c
Commit message (Collapse)AuthorAgeFilesLines
* Allow tcc arguments to be read from @listfilesseyko2016-04-131-0/+1
| | | | | | | | | | | | | | | | | 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.
* Fix pragma once guardseyko2016-04-131-1/+1
| | | | | | | | | | | | | | 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`
* fix for the -dM patchseyko2016-04-131-2/+7
| | | | assign fopen("/dev/null","w") to the s->ppfp insteed of NULL
* document -dM in "tcc -h" outputseyko2016-04-131-1/+1
|
* Skip math library if not found when -lm option is usedVlad Vissoultchev2016-04-081-2/+5
| | | | | | This only silences "cannot find library" error and allows Makefiles targeting gcc to not complain about missing libraries If there is custom libm then standard handling applies.
* Implement -dM preprocessor option as in gccVlad Vissoultchev2016-04-061-0/+3
| | | | | | 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.
* Revert spawnvp param cast and use `no-incompatible-pointer-types` in ↵Vlad Vissoultchev2016-03-141-1/+1
| | | | build-tcc.bat
* Silence FIXME and compiler warningVlad Vissoultchev2016-03-131-1/+1
|
* tcc help output for the -xc -xa - optionsseyko2015-10-241-0/+2
|
* Revert all of my changes to directories & codingstyle.gus knight2015-07-291-0/+365
|
* Reorganize the source tree.gus knight2015-07-271-365/+0
| | | | | | | | | | * 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...
* Trim trailing spaces everywhere.gus knight2015-07-271-1/+1
|
* redo of the -dD optionseyko2015-05-131-0/+1
| | | | | | | | 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"
* some -bench fixesseyko2015-05-121-8/+8
| | | | print stats to stderr, not to stdout
* minor pp optimizationsseyko2015-05-121-17/+9
| | | | | | * remove free_defines() from tcc_preprocess() all cleanup will be done in tcc_delete * move a preprocessor file closing to tcc_delete too
* a mem leak fix for "ability to compile multiple *.c files with -c switch"seyko2015-05-121-5/+4
| | | | | | A new version of the MEM_DEBUG will be submitted next. This version is not depend on the malloc_usable_size() presense in the libc and print a places where a leaked chunks of memory was allocated.
* allow to use MEM_DEBUG with libtccseyko2015-05-111-2/+0
|
* tccpp: fix issues, add testsgrischka2015-05-091-16/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fix some macro expansion issues * add some pp tests in tests/pp * improved tcc -E output for better diff'ability * remove -dD feature (quirky code, exotic feature, didn't work well) Based partially on ideas / researches from PipCet Some issues remain with VA_ARGS macros (if used in a rather tricky way). Also, to keep it simple, the pp doesn't automtically add any extra spaces to separate tokens which otherwise would form wrong tokens if re-read from tcc -E output (such as '+' '=') GCC does that, other compilers don't. * cleanups - #line 01 "file" / # 01 "file" processing - #pragma comment(lib,"foo") - tcc -E: forward some pragmas to output (pack, comment(lib)) - fix macro parameter list parsing mess from a3fc54345949535524d01319e1ca6378b7c2c201 a715d7143d9d17da17e67fec6af1c01409a71a31 (some coffee might help, next time ;) - introduce TOK_PPSTR - to have character constants as written in the file (similar to TOK_PPNUM) - allow '\' appear in macros - new functions begin/end_macro to: - fix switching macro levels during expansion - allow unget_tok to unget more than one tok - slight speedup by using bitflags in isidnum_table Also: - x86_64.c : fix decl after statements - i386-gen,c : fix a vstack leak with VLA on windows - configure/Makefile : build on windows (MSYS) was broken - tcc_warning: fflush stderr to keep output order (win32)
* fix "tcc test.c -Wl,,--oformat,binary"seyko2015-05-031-3/+0
| | | | | set linker options only when "s->output_type == TCC_OUTPUT_EXE" otherwise tcc will produce a wrong object file
* clarify error message when library not foundseyko2015-04-161-1/+1
| | | | | a prior error message: cannot find 'program_resolve_lib' after a patch: cannot find library 'libprogram_resolve_lib'
* implement #pragma comment(lib,...)Steven G. Messervey2015-04-151-1/+1
|
* Revert "implement #pragma comment(lib,...)"Steven G. Messervey2015-04-151-2/+2
| | | | | | This reverts commit 8615bb40fb39bf7435462ca54cbbc24aaecae502. Reverting as it breaks on MinGW targets
* implement #pragma comment(lib,...)Steven G. Messervey2015-04-151-2/+2
|
* ability to compile multiple *.c files with -c switchseyko2015-04-121-3/+26
| | | | Usage example: tcc -c -xc ex5.cgi -xn ex2.c ex7.c ex6.cgi
* ability to specify a type of the input file with the -x switchseyko2015-04-121-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Usage example: tcc -xc ex5.cgi From a gcc docs: You can specify the input language explicitly with the -x option: -x language Specify explicitly the language for the following input files (rather than letting the compiler choose a default based on the file name suffix). This option applies to all following input files until the next -x option. Possible values for language are: c c-header c-cpp-output c++ c++-header c++-cpp-output objective-c objective-c-header objective-c-cpp-output objective-c++ objective-c++-header objective-c++-cpp-output assembler assembler-with-cpp ada f77 f77-cpp-input f95 f95-cpp-input java -x none Turn off any specification of a language, so that subsequent files are handled according to their file name suffixes (as they are if -x has not been used at all)
* fix to allow build tcc by build-tcc.batseyko2015-03-191-2/+0
| | | | | move call to print_defines() from tcc.c to the libtcc.c define a print_defines() as a ST_FUNC
* Report a mingw as a execution environment instead of theseyko2015-03-031-16/+10
| | | | | | | | | | | Win32, Win64, WinCE when executing "tcc -v". Example $ ./i386-win-tcc -v tcc version 0.9.26 (i386, mingw) instead of the tcc version 0.9.26 (i386, Win32) There is a cpu info already about bits of the excution environment And display C67 for the TCC_TARGET_C67
* Don't add a slash to the install path of the tcc in display_info()seyko2015-03-031-1/+1
|
* Use a display_info() to output a header of the tcc help listingseyko2015-03-031-55/+62
| | | | | | | | | | | | | | | | | tcc version 0.9.26 (i386 Linux) Tiny C Compiler - Copyright (C) 2001-2006 Fabrice Bellard Usage: tcc [options...] [-o outfile] [-c] infile(s)... tcc [options...] -run infile [arguments...] ... instead of the tcc version 0.9.26 - Tiny C Compiler - Copyright (C) 2001-2006 Fabrice Bellard Usage: tcc [options...] [-o outfile] [-c] infile(s)... tcc [options...] -run infile [arguments...] ... Displaing a "Hard Float" info for the ARM arch is restored. It was broken by the AArm64 patch.
* A gcc preprocessor option -dD addedseyko2015-03-031-0/+3
| | | | | | | | | With this option on a defines are included into the output (inside comments). This will allow to debug a problems like: In file included from math.c:8: In file included from /usr/include/math.h:43: /usr/include/bits/nan.h:52: warning: NAN redefined
* Added a gcc preprocessor options -P, -P1seyko2015-03-031-0/+2
| | | | | | | | | | | tcc -E -P do not output a #line directive, a gcc compatible option tcc -E -P1 don't follow a gcc preprocessor style and do output a standard #line directive. In such case we don't lose a location info when we going to compile a resulting file wtith a compiler not understanding a gnu style line info.
* Add arm64 (AArch64) as a target architecture.Edmund Grimley Evans2015-02-231-0/+2
|
* Warn about a conflicting compile options spectified on the command line.seyko2015-01-061-1/+3
| | | | Try "tcc -E -c tccasm.c -o tccasm.o"
* tcc, libtcc: fix build on windows with latest mingw.minux2014-04-111-1/+1
|
* tests2: cleanupgrischka2014-04-071-1/+0
| | | | | | | | | - remove -norunsrc switch Meaning and usage (-run -norun...???) look sort of screwed. Also general usefulness is unclear, so it was actually to support exactly one (not even very interesting) test This partially reverts e31579b0769e1f9c0947d12e83316d1149307b1a
* Add support for runtime selection of float ABIThomas Preud'homme2014-01-081-1/+1
|
* Add the possibility to use noname functions by ordinalYX Hao2013-09-191-1/+1
| | | | | | | | | | | | | | | | | | | | | tcc.c: process.h:177:20: note: expected 'char * const*' but argument is of type 'char const*const*' tccpe.c: Add the possibility to use noname functions by ordinal. use def file: "AliasName @n" build-tcc.bat: 1. Enable 32 bits mode on 64 bits OS. 2. build doc. _parseLibs.bat: Convenient to use "*.def + *.c" instead of *.a, just use -l* _tcc.bat: a practice of _parseLibs.bat Signed-off-by: YX Hao <lifenjoiner@163.com>
* x86-64 ABI fixes.James Lyon2013-04-191-1/+1
| | | | | | | | | abitest now passes; however test1-3 fail in init_test. All other tests pass. I need to re-test Win32 and Linux-x86. I've added a dummy implementation of gfunc_sret to c67-gen.c so it should now compile, and I think it should behave as before I created gfunc_sret.
* Fixed tests on Windows (including out-of-tree problems)James Lyon2013-04-171-0/+1
| | | | | | | | | | | Modified tcctest.c so that it uses 'double' in place of 'long double' with MinGW since this is what TCC does, and what Visual C++ does. Added an option -norunsrc to tcc to allow argv[0] to be set independently of the compiled source when using tcc -run, which allows tests that rely on the value of argv[0] to work in out-of-tree builds. Also added Makefile rules to automatically update out-of-tree build Makefiles when in-tree Makefiles have changed.
* added CPATH, C_INCLUDE_PATH and LD_LIBRARY_PATHAndrew Aladjev2013-02-191-0/+1
|
* configure: pass CONFIG_xxxDIR/PATH options via commandlinegrischka2013-02-141-0/+1
| | | | | | | | | | | | | | | - except for CONFIG_SYSROOT and CONFIG_TCCDIR Strictly neccessary it is only for CONFIG_MULTIARCHDIR because otherwise if it's in config.h it is impossible to leave it undefined. But it is also nicer not to use these definitions for cross-compilers. - Also: lib/Makefile : include ../Makefile for CFLAGS lib/libtcc1.c : fix an issue compiling tcc with tcc on x64
* - make clang accept unportable code in libtcc1.cUrs Janssen2013-02-141-0/+1
| | | | - add -dumpversion cmd.line opt
* libtcc: new LIBTCCAPI tcc_set_options(TCCState*, const char*str)grischka2013-02-121-438/+160
| | | | | | | | | | | | | | | | | | | This replaces -> use instead: ----------------------------------- - tcc_set_linker -> tcc_set_options(s, "-Wl,..."); - tcc_set_warning -> tcc_set_options(s, "-W..."); - tcc_enable_debug -> tcc_set_options(s, "-g"); parse_args is moved to libtcc.c (now tcc_parse_args). Also some cleanups: - reorder TCCState members - add some comments here and there - do not use argv's directly, make string copies - use const char* in tcc_set_linker - tccpe: use fd instead of fp tested with -D MEM_DEBUG: 0 bytes left
* tcc --help: update option summarygrischka2013-02-101-6/+15
| | | | tcc-doc.texi: also
* tcc -vv/--print-search-dirs: print more infogrischka2013-02-101-4/+8
| | | | | | | | | | | | | | tests/Makefile: - print-search-dirs when 'hello' fails - split off hello-run win32/include/_mingw.h: - fix for compatibility with mingw headers (While our headers in win32 are from mingw-64 and don't have the problem) tiny_libmaker: - don't use "dangerous" mktemp
* c67: remove global #define's for TRUE/FALSE/BOOLgrischka2013-02-041-1/+1
| | | | Also use uppercase TRUE/FALSE instead of true/false
* Revert "Added what I call virtual io to tinycc this way we can make a ↵Thomas Preud'homme2013-01-141-97/+0
| | | | | | | | monolitic executable or library that contains all needed to compile programs, truly tinycc portable." This reverts commit 59e18aee0e509a3ca75dbe6f909e18c1d17893d1. tcc is being stabilized now in order to do a new release soon. Therefore, such a change is not appropriate now.
* Added what I call virtual io to tinycc this way we can make a monolitic ↵mingodad2013-01-111-0/+97
| | | | | | executable or library that contains all needed to compile programs, truly tinycc portable. Tested under linux exec the "mk-it" shell script and you'll end up with a portable tinycc executable that doesn't depend on anything else.
* tcc.c: fix argv index for parse_argsgrischka2012-06-121-3/+3
| | | | | | | | | I probably broke that myself earlier. In any case parse_args needs to start with index 0 because it is is used also recursively to expand the shebang command from scripts such as #!/usr/local/bin/tcc -run -L/usr/X11R6/lib -lX11 which arrives at tcc as only two argv's "tcc" "-run -L/usr/X11R6/lib -lX11"
* tcc.c: fix previous commit "Use CString to concat linker options"grischka2012-04-181-9/+7
| | | | | | | | | - remove redunant else branch - zero-terminate linker_arg - declare cstr_xxx as PUB_FUNC (which are functions used in tcc.c but not in the libtcc API. Useful for a tcc(.exe) that uses the libtcc.(so/dll)) - while at it, export PUB_FUNCs from dll