Commit Graph

165 Commits

Author SHA1 Message Date
Andrew Kelley 1c0223899c translate-c: progress on self-hosted function prototypes
See #1964
2019-05-10 01:24:00 -04:00
Andrew Kelley eea2de108d translate-c: progress on self-hosted function prototypes
See #1964
2019-05-09 16:52:30 -04:00
Andrew Kelley 214625587c translate-c: use C API for builtin types
See #1964
2019-05-09 15:46:48 -04:00
Andrew Kelley eb65410b62 translate-c: enough C tokenization/parsing to handle shifting in macros
See #2451
2019-05-09 12:48:38 -04:00
Andrew Kelley 62065a9aea translate-c: handle int to ptr and ptr to int casting
See #2451
2019-05-09 12:17:23 -04:00
Andrew Kelley 46e1c34fcf self-hosted translate-c progress on function decls
See #1964
2019-05-08 22:05:59 -04:00
Andrew Kelley e3542196c0 translate-c: NULL pointers translate to null
See #1967
2019-05-08 19:21:54 -04:00
Andrew Kelley a7f99c8ee9 self-hosted translate-c: iterate over top level decls
See #1964
2019-04-30 00:21:45 -04:00
LemonBoy 77383f968d translate-c: Emit @ptrCast + @alignPtr sequence
Avoid producing Zig code that doesn't compile due to mismatched
alignments between pointers.

Always emit a @alignOf instead of hardcoding the alignment value
returned by LLVM for portability sake of the generated code.
2019-04-29 21:30:19 -04:00
Andrew Kelley e1bf74fca3 translate-c: put -x c back in there, it's necessary 2019-04-25 00:06:58 -04:00
Andrew Kelley 712274997e translate-c: unify API for self-hosted and C++ translate-c
See #1964
2019-04-25 00:06:57 -04:00
Andrew Kelley 976080462c translate-c: a little closer to self-hosted implementation 2019-04-25 00:06:54 -04:00
LemonBoy 70c2e86da3 Add translation from pointer to boolean 2019-04-22 22:23:41 +02:00
LemonBoy 8d05330cf7 More precise translation of char literals 2019-04-22 22:23:41 +02:00
LemonBoy 69bc5fd04d translate-c: Pointer to/from integral conversion 2019-04-22 22:16:30 +02:00
LemonBoy d3dd49c403 translate-c: Support for integer to boolean conversions 2019-04-22 22:16:29 +02:00
LemonBoy 19b8278f91 translate-c: Convert char literals 2019-04-19 11:50:30 +02:00
LemonBoy 6d95c5d15c translate-c: Parse float/double literals 2019-04-19 11:50:30 +02:00
LemonBoy 1fda44cbc8 translate-c: support conversion to/from fp types 2019-04-19 11:50:30 +02:00
Andrew Kelley 4e2f6ebf39 freestanding target adds -ffrestanding to cc parameters
closes #2287
2019-04-16 12:06:14 -04:00
Andrew Kelley 3226b5315e translate-c: move some code to the C API
See #1964
2019-04-16 04:32:48 -04:00
Andrew Kelley 5cb18e9c6f translate-c: move some code to the C API
See #1964
2019-04-15 00:32:27 -04:00
Andrew Kelley 9d229791c6 translate-c: move some code to the C API
See #1964
2019-04-12 14:39:12 -04:00
Andrew Kelley 6284a4c534 translate-c: move some code to the C API
See #1964
2019-04-12 03:56:38 -04:00
Andrew Kelley f860493f23 translate-c: move some code to the C API
See #1964
2019-04-12 03:12:22 -04:00
Andrew Kelley 6f34d08aed translate-c: move some code to the C API
See #1964
2019-04-11 23:38:41 -04:00
Andrew Kelley b960f1d922 translate-c: move some code to the C API
See #1964
2019-04-11 15:33:26 -04:00
Andrew Kelley dff201540f translate-c: move some code to the C API
See #1964
2019-04-11 03:59:12 -04:00
Andrew Kelley 85256521ba fix translate-c regression 2019-03-18 20:09:27 -04:00
Andrew Kelley a581f4f0e2 Merge remote-tracking branch 'origin/master' into llvm8 2019-03-18 20:03:23 -04:00
Andrew Kelley a17bf219c6 Merge pull request #2069 from ziglang/glibc-assert-translation
Implemented enough of translate-c to translate assert
2019-03-18 14:43:17 -04:00
Jimmi Holst Christensen 9171e7a7c1 More work on ignoring values correctly 2019-03-18 14:55:57 +01:00
Jimmi HC 5ae400fb39 fixed void cast and added the last tests 2019-03-15 19:11:46 +01:00
Jimmi Holst Christensen a77b2a0810 Implemented enough of translate-c to translate assert
This required the following
* __extention__
* ({})
* Fixing if (0) ; else ;
2019-03-15 16:12:41 +01:00
Jimmi Holst Christensen 3ef9b899e4 workaround for #2043 2019-03-15 11:17:21 +01:00
Andrew Kelley 3cdd2c0bdd Merge remote-tracking branch 'origin/master' into llvm8 2019-03-10 13:48:06 -04:00
Andrew Kelley 91955dee58 breaking changes to zig build API and improved caching
* in Zig build scripts, getOutputPath() is no longer a valid function
   to call, unless setOutputDir() was used, or within a custom make()
   function. Instead there is more convenient API to use which takes
   advantage of the caching system. Search this commit diff for
   `exe.run()` for an example.
 * Zig build by default enables caching. All build artifacts will go
   into zig-cache. If you want to access build artifacts in a convenient
   location, it is recommended to add an `install` step. Otherwise
   you can use the `run()` API mentioned above to execute programs
   directly from their location in the cache. Closes #330.
   `addSystemCommand` is available for programs not built with Zig
   build.
 * Please note that Zig does no cache evicting yet. You may have to
   manually delete zig-cache directories periodically to keep disk
   usage down. It's planned for this to be a simple Least Recently
   Used eviction system eventually.
 * `--output`, `--output-lib`, and `--output-h` are removed. Instead,
   use `--output-dir` which defaults to the current working directory.
   Or take advantage of `--cache on`, which will print the main output
   path to stdout, and the other artifacts will be in the same directory
   with predictable file names. `--disable-gen-h` is available when
   one wants to prevent .h file generation.
 * `@cImport` is always independently cached now. Closes #2015.
   It always writes the generated Zig code to disk which makes debug
   info and compile errors better. No more "TODO: remember C source
   location to display here"
 * Fix .d file parsing. (Fixes the MacOS CI failure)
 * Zig no longer creates "temporary files" other than inside a
   zig-cache directory.

This breaks the CLI API that Godbolt uses. The suggested new invocation
can be found in this commit diff, in the changes to `test/cli.zig`.
2019-03-08 23:23:11 -05:00
Andrew Kelley 2caf39c961 fix .d file processing and use -MV to quote spaces 2019-03-07 14:30:50 -05:00
Andrew Kelley ce76de35f1 multi-arch glibc headers 2019-03-07 12:16:10 -05:00
Andrew Kelley e06da10838 fix translate-c 2019-03-05 16:12:19 -05:00
Andrew Kelley aeb16010f3 initial glibc support 2019-03-04 22:15:53 -05:00
Andrew Kelley 0714e19598 Merge remote-tracking branch 'origin/master' into llvm8 2019-03-04 08:24:56 -05:00
Andrew Kelley 5424b4320d remove namespace type; files are empty structs
closes #1047
2019-02-28 10:11:32 -05:00
Andrew Kelley 6bc19b437c updates to build with llvm 8.0.0rc3 2019-02-28 09:55:27 -05:00
Andrew Kelley 2dcf1a2392 Merge remote-tracking branch 'origin/master' into llvm8 2019-02-28 09:19:18 -05:00
Andrew Kelley 6365f5a9f3 introduce sys_include_dir for when sys/* files are not with stdlib.h 2019-02-26 17:26:34 -05:00
Andrew Kelley 33174f11ef fix regressions on Windows 2019-02-26 16:24:32 -05:00
Andrew Kelley 1ec1097bd3 use -nostdinc and sometimes -nolibc when compiling C code 2019-02-26 14:59:36 -05:00
Andrew Kelley 6fd2816431 use -nostdinc++ when compiling C code 2019-02-26 10:15:48 -05:00
Andrew Kelley 3932b6474e use -nobuiltininc when compiling c code 2019-02-26 08:16:03 -05:00