authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-28 22:40:53-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-28 22:41:29-08:00
log79a51511555e88c05efb2e695fc41910b8fdc88d
treee24edbeeb43f2c0732d499c1a37e801a1a260f4f
parent8ab870cf56e499258e19b23062f1830c73dbe6a3

Revert "stage2: fix compilation of self-hosted compiler with -Denable-llvm"

This broke compiling with -Dstage1 on Windows, because it added the cpp_source_files to the compilation multiple times. This reverts commit c81ae52ee0b2e952f8ed9c5c6517af8182bb09c1.

2 files changed, 14 insertions(+), 39 deletions(-)

build.zig+13-20
......@@ -91,20 +91,6 @@ pub fn build(b: *Builder) !void {
9191 exe.addBuildOption(bool, "have_llvm", enable_llvm);
9292 if (enable_llvm) {
9393 const cmake_cfg = if (static_llvm) null else findAndParseConfigH(b, config_h_path_option);
94
95 const exe_cflags = [_][]const u8{
96 "-std=c++14",
97 "-D__STDC_CONSTANT_MACROS",
98 "-D__STDC_FORMAT_MACROS",
99 "-D__STDC_LIMIT_MACROS",
100 "-D_GNU_SOURCE",
101 "-fvisibility-inlines-hidden",
102 "-fno-exceptions",
103 "-fno-rtti",
104 "-Werror=type-limits",
105 "-Wno-missing-braces",
106 "-Wno-comment",
107 };
10894 if (is_stage1) {
10995 exe.addIncludeDir("src");
11096 exe.addIncludeDir("deps/SoftFloat-3e/source/include");
......@@ -123,6 +109,19 @@ pub fn build(b: *Builder) !void {
123109 softfloat.addCSourceFiles(&softfloat_sources, &[_][]const u8{ "-std=c99", "-O3" });
124110 exe.linkLibrary(softfloat);
125111
112 const exe_cflags = [_][]const u8{
113 "-std=c++14",
114 "-D__STDC_CONSTANT_MACROS",
115 "-D__STDC_FORMAT_MACROS",
116 "-D__STDC_LIMIT_MACROS",
117 "-D_GNU_SOURCE",
118 "-fvisibility-inlines-hidden",
119 "-fno-exceptions",
120 "-fno-rtti",
121 "-Werror=type-limits",
122 "-Wno-missing-braces",
123 "-Wno-comment",
124 };
126125 exe.addCSourceFiles(&stage1_sources, &exe_cflags);
127126 exe.addCSourceFiles(&optimized_c_sources, &[_][]const u8{ "-std=c99", "-O3" });
128127 if (cmake_cfg == null) {
......@@ -206,12 +205,6 @@ pub fn build(b: *Builder) !void {
206205 exe.linkSystemLibrary(lib_name);
207206 }
208207
209 // We need this because otherwise zig_clang_cc1_main.cpp ends up pulling
210 // in a dependency on llvm::cfg::Update<llvm::BasicBlock*>::dump() which is
211 // unavailable when LLVM is compiled in Release mode.
212 const zig_cpp_cflags = exe_cflags ++ [_][]const u8{"-DNDEBUG=1"};
213 exe.addCSourceFiles(&zig_cpp_sources, &zig_cpp_cflags);
214
215208 // This means we rely on clang-or-zig-built LLVM, Clang, LLD libraries.
216209 exe.linkSystemLibrary("c++");
217210
src/zig_clang.h+1-19
......@@ -8,32 +8,14 @@
88#ifndef ZIG_ZIG_CLANG_H
99#define ZIG_ZIG_CLANG_H
1010
11#include "stage1/stage2.h"
1112#include <inttypes.h>
1213#include <stdbool.h>
13#include <stddef.h>
14
15#ifdef __cplusplus
16#define ZIG_EXTERN_C extern "C"
17#else
18#define ZIG_EXTERN_C
19#endif
2014
2115// ATTENTION: If you modify this file, be sure to update the corresponding
2216// extern function declarations in the self-hosted compiler file
2317// src/clang.zig.
2418
25// ABI warning
26struct Stage2ErrorMsg {
27 const char *filename_ptr; // can be null
28 size_t filename_len;
29 const char *msg_ptr;
30 size_t msg_len;
31 const char *source; // valid until the ASTUnit is freed. can be null
32 unsigned line; // 0 based
33 unsigned column; // 0 based
34 unsigned offset; // byte offset into source
35};
36
3719struct ZigClangSourceLocation {
3820 unsigned ID;
3921};