diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-02-24 16:28:49 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-24 16:28:49 -0500 |
| commit | e5d4862e145c38ffc1111ee578ddcafc1e35ad57 (patch) | |
| tree | a74e9fcd5a0fb92cf34963cbb72c44430ef9c396 /src/main.cpp | |
| parent | 98869edb8b44f164bb46851cff88e2338fe6f399 (diff) | |
| parent | 8c2c6368f9645def45374c2fb9027bf72b15ab2e (diff) | |
| download | zig-e5d4862e145c38ffc1111ee578ddcafc1e35ad57.tar.gz zig-e5d4862e145c38ffc1111ee578ddcafc1e35ad57.zip | |
Merge pull request #2003 from ziglang/zig-cc
add `zig cc` command to act like a C compiler
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 35746319f8..14a885f08a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,6 +32,7 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) { " build-lib [source] create library from source or object files\n" " build-obj [source] create object from source or assembly\n" " builtin show the source code of that @import(\"builtin\")\n" + " cc C compiler\n" " fmt parse files and render in canonical zig format\n" " help show this usage information\n" " id print the base64-encoded compiler id\n" @@ -240,6 +241,8 @@ static bool get_cache_opt(CacheOpt opt, bool default_value) { zig_unreachable(); } +extern "C" int ZigClang_main(int argc, char **argv); + int main(int argc, char **argv) { char *arg0 = argv[0]; Error err; @@ -257,6 +260,12 @@ int main(int argc, char **argv) { return 0; } + if (argc >= 2 && (strcmp(argv[1], "cc") == 0 || + strcmp(argv[1], "-cc1") == 0 || strcmp(argv[1], "-cc1as") == 0)) + { + return ZigClang_main(argc, argv); + } + // Must be before all os.hpp function calls. os_init(); |
