mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-26 13:01:34 +03:00
Merge pull request 'compiler: disable warnings in all vendored code' (#31868) from alexrp/zig:disable-vendor-warnings into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31868
This commit is contained in:
+13
-7
@@ -189,11 +189,11 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
|
||||
var args = std.array_list.Managed([]const u8).init(arena);
|
||||
try add_include_dirs(comp, arena, &args);
|
||||
try args.appendSlice(&[_][]const u8{
|
||||
"-w", // Disable all warnings.
|
||||
"-D_LIBC_REENTRANT",
|
||||
"-include",
|
||||
try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-modules.h"),
|
||||
"-DMODULE_NAME=libc",
|
||||
"-Wno-nonportable-include-path",
|
||||
"-include",
|
||||
try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-symbols.h"),
|
||||
"-DPIC",
|
||||
@@ -217,6 +217,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
|
||||
});
|
||||
try add_include_dirs(comp, arena, &args);
|
||||
try args.appendSlice(&[_][]const u8{
|
||||
"-w", // Disable all warnings.
|
||||
"-D_LIBC_REENTRANT",
|
||||
"-DMODULE_NAME=libc",
|
||||
"-DTOP_NAMESPACE=glibc",
|
||||
@@ -229,9 +230,16 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
|
||||
.owner = undefined,
|
||||
};
|
||||
};
|
||||
const init_o: Compilation.CSourceFile = .{
|
||||
.src_path = try lib_path(comp, arena, lib_libc_glibc ++ "csu" ++ path.sep_str ++ "init.c"),
|
||||
.owner = undefined,
|
||||
const init_o: Compilation.CSourceFile = blk: {
|
||||
var args = std.array_list.Managed([]const u8).init(arena);
|
||||
try args.appendSlice(&[_][]const u8{
|
||||
"-w", // Disable all warnings.
|
||||
});
|
||||
break :blk .{
|
||||
.src_path = try lib_path(comp, arena, lib_libc_glibc ++ "csu" ++ path.sep_str ++ "init.c"),
|
||||
.cache_exempt_flags = args.items,
|
||||
.owner = undefined,
|
||||
};
|
||||
};
|
||||
var files = [_]Compilation.CSourceFile{ start_o, abi_note_o, init_o };
|
||||
const basename = if (comp.config.output_mode == .Exe and !comp.config.pie) "crt1" else "Scrt1";
|
||||
@@ -308,15 +316,14 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
|
||||
|
||||
var args = std.array_list.Managed([]const u8).init(arena);
|
||||
try args.appendSlice(&[_][]const u8{
|
||||
"-w", // Disable all warnings.
|
||||
"-std=gnu11",
|
||||
"-fgnu89-inline",
|
||||
"-fmerge-all-constants",
|
||||
"-frounding-math",
|
||||
"-Wno-unsupported-floating-point-opt", // For targets that don't support -frounding-math.
|
||||
"-fno-common",
|
||||
"-fmath-errno",
|
||||
"-ftls-model=initial-exec",
|
||||
"-Wno-ignored-attributes",
|
||||
"-Qunused-arguments",
|
||||
});
|
||||
try add_include_dirs(comp, arena, &args);
|
||||
@@ -335,7 +342,6 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
|
||||
"-include",
|
||||
try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-modules.h"),
|
||||
"-DMODULE_NAME=libc",
|
||||
"-Wno-nonportable-include-path",
|
||||
"-include",
|
||||
try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-symbols.h"),
|
||||
"-DPIC",
|
||||
|
||||
+2
-6
@@ -206,6 +206,7 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError!
|
||||
|
||||
try addCxxArgs(comp, arena, &cflags);
|
||||
|
||||
try cflags.append("-w"); // Disable all warnings.
|
||||
try cflags.append("-DNDEBUG");
|
||||
try cflags.append("-DLIBC_NAMESPACE=__llvm_libc_common_utils");
|
||||
try cflags.append("-D_LIBCPP_BUILDING_LIBRARY");
|
||||
@@ -223,9 +224,6 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError!
|
||||
|
||||
try cflags.append("-nostdinc++");
|
||||
try cflags.append("-std=c++23");
|
||||
try cflags.append("-Wno-user-defined-literals");
|
||||
try cflags.append("-Wno-covered-switch-default");
|
||||
try cflags.append("-Wno-suggest-override");
|
||||
|
||||
// These depend on only the zig lib directory file path, which is
|
||||
// purposefully either in the cache or not in the cache. The decision
|
||||
@@ -401,6 +399,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
|
||||
|
||||
try addCxxArgs(comp, arena, &cflags);
|
||||
|
||||
try cflags.append("-w"); // Disable all warnings.
|
||||
try cflags.append("-DNDEBUG");
|
||||
try cflags.append("-D_LIBCPP_BUILDING_LIBRARY");
|
||||
try cflags.append("-D_LIBCXXABI_BUILDING_LIBRARY");
|
||||
@@ -422,9 +421,6 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
|
||||
try cflags.append("-nostdinc++");
|
||||
try cflags.append("-fstrict-aliasing");
|
||||
try cflags.append("-std=c++23");
|
||||
try cflags.append("-Wno-user-defined-literals");
|
||||
try cflags.append("-Wno-covered-switch-default");
|
||||
try cflags.append("-Wno-suggest-override");
|
||||
|
||||
// These depend on only the zig lib directory file path, which is
|
||||
// purposefully either in the cache or not in the cache. The decision
|
||||
|
||||
@@ -104,6 +104,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
|
||||
.assembly_with_cpp => {},
|
||||
else => unreachable, // See `unwind_src_list`.
|
||||
}
|
||||
try cflags.append("-w"); // Disable all warnings.
|
||||
try cflags.append("-I");
|
||||
try cflags.append(try comp.dirs.zig_lib.join(arena, &.{ "libunwind", "include" }));
|
||||
try cflags.append("-D_LIBUNWIND_HIDE_SYMBOLS");
|
||||
@@ -126,13 +127,6 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
|
||||
if (target.cpu.arch.isArm() and target.abi.float() == .hard) {
|
||||
try cflags.append("-DCOMPILER_RT_ARMHF_TARGET");
|
||||
}
|
||||
try cflags.append("-Wno-bitwise-conditional-parentheses");
|
||||
try cflags.append("-Wno-visibility");
|
||||
try cflags.append("-Wno-incompatible-pointer-types");
|
||||
|
||||
if (target.os.tag == .windows) {
|
||||
try cflags.append("-Wno-dll-attribute-on-redeclaration");
|
||||
}
|
||||
|
||||
c_source_files[i] = .{
|
||||
.src_path = try comp.dirs.zig_lib.join(arena, &.{unwind_src}),
|
||||
|
||||
+1
-2
@@ -135,8 +135,6 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
|
||||
try addCcArgs(comp, arena, &winpthreads_args);
|
||||
try winpthreads_args.appendSlice(&[_][]const u8{
|
||||
"-DIN_WINPTHREAD",
|
||||
// winpthreads incorrectly assumes that Clang has `-Wprio-ctor-dtor`.
|
||||
"-Wno-unknown-warning-option",
|
||||
});
|
||||
|
||||
switch (comp.compilerRtOptMode()) {
|
||||
@@ -170,6 +168,7 @@ fn addCcArgs(
|
||||
args: *std.array_list.Managed([]const u8),
|
||||
) error{OutOfMemory}!void {
|
||||
try args.appendSlice(&[_][]const u8{
|
||||
"-w", // Disable all warnings.
|
||||
"-std=gnu11",
|
||||
"-D__USE_MINGW_ANSI_STDIO=0",
|
||||
|
||||
|
||||
Reference in New Issue
Block a user