Commit Graph

99 Commits (meesbs)

Author SHA1 Message Date
Edmund Grimley Evans ba99a70cd8 Trivial changes to avoid some compiler warnings. 2015-11-19 18:26:47 +00: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
grischka 30df3189b1 tccpp: fix issues, add tests
* 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
    a3fc543459
    a715d7143d
    (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)
2015-05-09 14:29:39 +02:00
seyko bbcb54a1f4 replace PARSE_FLAG_ASM_COMMENTS with PARSE_FLAG_ASM_FILE
after "assign PARSE_FLAG_ASM_COMMENTS only for asm files"
    functions of this flags are identical
2015-04-27 16:36:58 +03:00
grischka 7c27186a83 Revert "* and #pragma pop_macro("macro_name")"
- pop_macro incorrect with initially undefined macro
- horrible implementation (tcc_open_bf)
- crashes eventually (abuse of Sym->prev_tok)

- the (unrelated) asm_label part is the opposite of a fix
  (Despite of its name this variable has nothing to do with
  the built-in assembler)

This reverts commit 0c8447db79.
2015-04-23 23:26:46 +02:00
seyko 0c8447db79 * and #pragma pop_macro("macro_name")
* give warning if pragma is unknown for tcc
    * don't free asm_label in sym_free(),
      it's a job of the asm_free_labels().

    The above pragmas are used in the mingw headers.
    Thise pragmas are implemented in gcc-4.5+ and current
    clang.
2015-04-21 06:34:35 +03:00
seyko 5ce2154c74 -fdollar-in-identifiers addon
* disable a -fdollar-in-identifiers option in assembler files
    * a test is added

    This is a patch addon from Daniel Holden.
2015-04-20 03:44:08 +03:00
Reimar Döffinger ff783b94c7 Add support for .p2align asm directive.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2015-01-20 08:49:49 +01:00
Michael Matz a9fda392a0 Parse assembler .hidden directive
This makes TCCs assembler understand the '.hidden symbol' directive
(and emits a STV_HIDDEN ELF symbol then).
2014-04-14 03:33:50 +02:00
Vincent Lefevre 3e9a7e9d69 Corrected spelling mistakes in comments and strings 2014-04-07 13:31:00 +02:00
grischka 944627c479 configure: cleanup
- add quotes: eval opt=\"$opt\"
- use $source_path/conftest.c for OOT build
- add fn_makelink() for OOT build
- do not check lddir etc. on Windows/MSYS
- formatting

config-print.c
- rename to conftest.c (for consistency)
- change option e to b
- change output from that from "yes" to "no"
- remove inttypes.h dependency
- simpify version output

Makefile:
- improve GCC warning flag checks

tcc.h:
- add back default CONFIG_LDDIR
- add default CONFIG_TCCDIR also (just for fun)

tccpp.c:
- fix Christian's last warning
  tccpp.c: In function ‘macro_subst’:
  tccpp.c:2803:12: warning: ‘*((void *)&cval+4)’ is used uninitialized
     in this function [-Wuninitialized]
  That the change fixes the warning doesn't make sense but anyway.

libtcc.c:
- tcc_error/warning: print correct source filename/line for
  token :paste: (also inline :asm:)

lddir and multiarch logic still needs fixing.
2013-02-14 06:53:07 +01:00
Thomas Preud'homme 519a9040a1 Compile tccasm.c conditionally (TCC_CONFIG_ASM)
Only compile the content of tccasm.c if inline assembly is supported for
this architecture by testing the presence of macro TCC_CONFIG_ASM.
2012-01-06 18:34:21 +01:00
grischka bf374a5f23 rename error/warning -> tcc_(error/warning) 2011-08-11 17:07:56 +02:00
Thomas Preud'homme ee06ef9dd3 Remove unused variables
Remove unused local variables and declare them conditionally when they
are used only on some architectures.
2011-05-16 14:15:32 +02:00
Joe Soroka bec84fa00a tccasm: support alternate .type syntaxes 2011-02-24 09:24:02 -08:00
Joe Soroka c59d3426b8 tccasm: support .weak labels 2011-02-01 08:43:54 -08:00
Joe Soroka f43fafc680 accept multiple comma separated symbols for .globl/.global directives, like gas does 2011-01-20 02:00:50 -08:00
grischka e97bf88bad libtcc: new function tcc_open_bf to create BufferedFile
Use it in:
- tcc_open
- tcc_compile_string
- tcc_define_symbol
- tcc_assemble_inline
2010-11-25 13:29:15 +01:00
Thomas Preud'homme b8adf0090e Move asm label functions from tccasm.c to tccgen.c
* Move functions parse_asm_str and asm_label_instr from tccasm.c to
  tccgen.c
* Remove CONFIG_TCC_ASM_LABEL macro as asm label are available on all
  archs.
See:
http://lists.nongnu.org/archive/html/tinycc-devel/2010-09/msg00026.html
for the rationale.
2010-09-14 23:21:15 +02:00
Thomas Preud'homme 9b09fc376e Add support of asm label for functions.
Add support for asm labels for functions, that is the ability to rename
a function at assembly level with __asm__ ("newname") appended in
function declaration.
2010-09-10 20:15:03 +02:00
Daniel Glöckner 6eac6b7254 Revert "tccpp: Allow local labels to start with a dot"
This reverts commit f740485a5a.

It breaks access to structure elements starting with L
2010-05-06 21:42:37 +02:00
Detlef Riekenberg a135dd50c6 tccasm: Detect (but ignore) .ident directive
tcc is now able to compile many asm files generated by gcc

--
By by ... Detlef
2010-04-05 12:45:52 +02:00
Detlef Riekenberg 558258a301 tccasm: Detect (but ignore) .size directive
--
By by ... Detlef
2010-04-05 12:43:51 +02:00
Detlef Riekenberg 6825c5db72 tccasm: Support .type directive (only name,@function)
--
By by ... Detlef
2010-04-05 12:31:45 +02:00
Detlef Riekenberg f740485a5a tccpp: Allow local labels to start with a dot
--
By by ... Detlef
2010-04-05 12:28:27 +02:00
Detlef Riekenberg 9ff7a0bc98 tccasm: Detect (but ignore) the .file directive
Some patches, to allow tcc to compile asm sources generated by gcc
and help tcc with the autoconf stuff used in Wine
( http://source.winehq.org/git/wine.git/ )

--
By by ... Detlef
2010-04-05 12:19:49 +02:00
grischka 4e5170d4a5 tccpp: convert TOK_GET macro into function 2010-01-14 20:59:44 +01:00
grischka 88a3ccab9f allow tcc be build from separate objects
If you want that, run: make NOTALLINONE=1
2009-12-20 01:53:49 +01:00
grischka b5e2238483 tccasm: make VT_VOID symbols ST_NOTYPE, elf-wise
This was confusing objdump such that it did not print
disassembly with -d.

Also, put filename as with C compilation
2009-12-19 22:16:18 +01:00
Frederic Feret 526c464504 first support of x86_64 assembly 2009-11-13 18:08:59 +01:00
Frederic Feret 0d768b9713 added 16-bit x86 assembly support 2009-11-13 18:08:58 +01:00
grischka f88350b611 fix some warning 2009-07-18 22:07:51 +02:00
grischka d778bde7f9 Import more changesets from Rob Landley's fork (part 2) 2007-11-21 17:16:31 +00:00
bellard 7b8e283980 support for empty input register section in asm (Filip Navara) 2005-09-03 22:23:59 +00:00
bellard 0c7f0ed312 added -f[no-]leading-underscore 2005-06-15 22:32:10 +00:00
bellard be5e9cb962 pool for symbol allocation 2004-11-07 15:45:40 +00:00
bellard c9c05ca5f0 copyright update 2004-10-27 21:38:03 +00:00
bellard e657dfb491 added .quad asm directive 2004-10-25 18:54:29 +00:00
bellard eb79471184 added .ascii and .asciz directives 2004-10-23 22:52:42 +00:00
bellard 0bd402d2eb absolute symbols support - .org, .fill and .previous directives 2004-10-18 00:19:51 +00:00
bellard 8da6027e73 both .globl and .global directives are accepted by as 2004-10-02 14:01:26 +00:00
bellard 8f5e44a439 changed license to LGPL 2003-05-24 14:11:17 +00:00
bellard 71f119fe25 various asm directives - char support (Dave Long) 2003-04-28 21:23:53 +00:00
bellard 0eef235475 asm number parsing (thanks to Dave Long) 2003-04-21 15:21:19 +00:00
bellard 6e197e3d5d fixed inline asm without operand case 2003-04-14 22:22:34 +00:00
bellard 7893a9ecdf asm support 2003-01-06 20:21:42 +00:00