aboutsummaryrefslogtreecommitdiff
path: root/tests/pp
Commit message (Collapse)AuthorAgeFilesLines
* Spelling fixesLarry Doolittle2017-09-241-1/+1
| | | | Comments only, no change to functionality
* tccpp: allow "#define X defined Y ..."grischka2017-07-092-0/+44
| | | | | | | That means: we do not macro-expand the argument of 'defined' Also: store the last token position into the TokenString structure in order to get rid of the tok_last function.
* tccpp: Implement __COUNTER__Michael Matz2017-07-092-0/+42
| | | | | | | | | | | This requires one more change in how macro arguments are expanded: the standard requires that macro args are expanded before substituting into the replacement list. This implies expanding them only once even when they occur multiple times in the list. TCC expanded them repeatedly in that case. Without __COUNTER__ that's harmless. So, simply always expand arguments (when used without # and ##) once and store the resulting tokens.
* tccpp: Fix corner caseMichael Matz2017-07-095-4/+135
| | | | | | | | | | | | | See added testcase 19.c from a bug report. The problem is reading outside the arguments buffers, even though we aren't allowed to. The single can_read_stream variable is not enough, sometimes we need to be able to pop into outer contexts but not into arbitrarily outside contexts. The trick is to terminate argument tokens with a EOF (and not just with 0 that makes us pop contexts), and deal with that in the few places we have to, This enables some cleanups of the can_read_stream variable use.
* tccpp: Fix corner case of fnlike macro invocationMichael Matz2017-04-152-0/+18
| | | | | | | Arg substitution leaves placeholder marker in the stream for empty arguments. Those need to be skipped when searching for a fnlike macro invocation in the replacement list itself. See testcase.
* makefile: unify cross with native buildsgrischka2017-02-251-2/+1
| | | | | | | | | | | | | supports building cross compilers on the fly without need for configure --enable-cross $ make cross # all compilers $ make cross-TARGET # only TARGET-compiler & its libtcc1.a with TARGET one from i386 x86_64 i386-win32 x86_64-win32 arm arm64 arm-wince c67 Type 'make help' for more information
* update VERSION to 0.9.27grischka2017-02-081-4/+4
| | | | | | | | | Also: - in tests: generate .expect files only if not yet present, because 1) some files were adjusted manually 2) switching git branche might change timestamps and cause unwanted update
* tests: don't assume $(CC) is gccAvi Halachmi (:avih)2016-12-241-2/+2
| | | | This also allows self hosting + testing when $(CC) is tcc.
* tests: OOT build fixes etc.grischka2016-12-201-2/+5
| | | | | | | | | | | | | | | | | | | | | | tests/Makefile: fix out-of-tree build issues Also: - win64: align(16) MEM_DEBUG user memory on win64 the struct jmp_buf in the TCCState structure which we allocate by tcc_malloc needs alignment 16 because the msvcrt setjmp uses MMX instructions. - libtcc_test.c: win32/64 need __attribute__((dllimport)) for extern data objects - tcctest.c: exclude stuff that gcc does not compile except for relocation_test() the other issues are mostly ASM related. We should probably check GCC versions but I have no idea which mingw/gcc versions support what and which don't. - lib/Makefile: use tcc to compile libtcc1.a (except on arm which needs arm-asm
* tccpp: Fix token pastingMichael Matz2016-12-152-0/+20
| | | | | | | | | See testcase. We must always paste tokens (at least if not currently substing a normal argument, which is a speed optimization only now) but at the same time must not regard a ## token coming from argument expansion as the token-paste operator, nor if we constructed a ## token due to pasting itself (that was already checked by pp/01.c).
* tccpp: Fix macro_is_equalMichael Matz2016-12-152-0/+5
| | | | | | | When tokens in macro definitions need cstr_buf inside get_tok_str, the second might overwrite the first (happens when tokens are multi-character non-identifiers, see testcase) in macro_is_equal, failing to diagnose a difference. Use a real local buffer.
* OpenBSD does not support -v option in rm command.Christian Jullien2016-10-151-1/+1
|
* tccpp : "tcc -E -P" : suppress empty linesgrischka2016-10-095-8/+29
| | | | | | | | | Also: - regenerate all tests/pp/*.expect with gcc - test "insert one space" feature - test "0x1E-1" in asm mode case - PARSE_FLAG_SPACES: ignore \f\v\r better - tcc.h: move some things
* build: restore out-of-tree supportgrischka2016-10-011-3/+8
|
* build: revert Makefiles to 0.9.26 state (mostly)grischka2016-10-011-5/+4
| | | | | | | | | | | | Except - that libtcc1.a is now installed in subdirs i386/ etc. - the support for arm and arm64 - some of the "Darwin" fixes - tests are mosly unchanged Also - removed the "legacy links for cross compilers" (was total mess) - removed "out-of-tree" build support (was broken anyway)
* test/pp: cleanupgrischka2016-10-016-74/+20
|
* Insert spaces between certain tokens when tcc is invoked with -E.Edmund Grimley Evans2016-05-092-0/+25
| | | | | | 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.
* tccgen: scopes levels for local symbols (update 2)grischka2016-05-061-6/+6
| | | | | | | allow typedef int xxx; typedef int xxx; in the same scope as long as it is the same type
* output space after TOK_PPNUM which followed by '+' or '-'seyko2016-05-016-5/+52
| | | | | | * 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
* Revert "Fix tests Makefiles on Windows"Vlad Vissoultchev2016-04-171-8/+1
| | | | This reverts commit fa2472c17246206ce6947475782de17245eceeea.
* fix preprocessing *.S with ` ' chars in #commentsseyko2016-04-142-0/+12
| | | | | with a test program. Problem detected when trying to compile linux-2.4.37.9 with tcc.
* Identifiers can start and/or contain '.' in *.Sseyko2016-04-053-1/+21
| | | | | | | | | | | | | | | | | 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.
* Fix tests Makefiles on WindowsVlad Vissoultchev2016-03-141-1/+8
| | | | Compiled tcc.exe location is under $(top_srcdir)/win32
* Revert all of my changes to directories & codingstyle.gus knight2015-07-291-1/+1
|
* Reorganize the source tree.gus knight2015-07-271-1/+1
| | | | | | | | | | * 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...
* tccpp: fix issues, add testsgrischka2015-05-0923-0/+193
* 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)