From 80269c1f5384d6f11cd5bab981d23297b6b8cf0b Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 22 Jul 2024 17:54:30 -0700 Subject: [PATCH] remove deprecated --mod CLI now that a zig1.wasm update happened --- CMakeLists.txt | 10 +++++----- bootstrap.c | 10 +++++----- ci/x86_64-windows-debug.ps1 | 4 ++-- ci/x86_64-windows-release.ps1 | 4 ++-- src/main.zig | 26 +++++--------------------- 5 files changed, 19 insertions(+), 35 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f9436d7c2a..cc5ada18b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -865,9 +865,9 @@ set(BUILD_ZIG2_ARGS -target "${ZIG_HOST_TARGET_TRIPLE}" --dep "build_options" --dep "aro" - --mod "root" "src/main.zig" - --mod "build_options" "${ZIG_CONFIG_ZIG_OUT}" - --mod "aro" "lib/compiler/aro/aro.zig" + "-Mroot=src/main.zig" + "-Mbuild_options=${ZIG_CONFIG_ZIG_OUT}" + "-Maro=lib/compiler/aro/aro.zig" ) add_custom_command( @@ -885,8 +885,8 @@ set(BUILD_COMPILER_RT_ARGS -femit-bin="${ZIG_COMPILER_RT_C_SOURCE}" -target "${ZIG_HOST_TARGET_TRIPLE}" --dep "build_options" - --mod "root" "lib/compiler_rt.zig" - --mod "build_options" "${ZIG_CONFIG_ZIG_OUT}" + "-Mroot=lib/compiler_rt.zig" + "-Mbuild_options=${ZIG_CONFIG_ZIG_OUT}" ) add_custom_command( diff --git a/bootstrap.c b/bootstrap.c index 9cc67aaac2..fca6ce1081 100644 --- a/bootstrap.c +++ b/bootstrap.c @@ -156,9 +156,9 @@ int main(int argc, char **argv) { "-target", host_triple, "--dep", "build_options", "--dep", "aro", - "--mod", "root", "src/main.zig", - "--mod", "build_options", "config.zig", - "--mod", "aro", "lib/compiler/aro/aro.zig", + "-Mroot=src/main.zig", + "-Mbuild_options=config.zig", + "-Maro=lib/compiler/aro/aro.zig", NULL, }; print_and_run(child_argv); @@ -171,8 +171,8 @@ int main(int argc, char **argv) { "--name", "compiler_rt", "-femit-bin=compiler_rt.c", "-target", host_triple, "--dep", "build_options", - "--mod", "root", "lib/compiler_rt.zig", - "--mod", "build_options", "config.zig", + "-Mroot=lib/compiler_rt.zig", + "-Mbuild_options=config.zig", NULL, }; print_and_run(child_argv); diff --git a/ci/x86_64-windows-debug.ps1 b/ci/x86_64-windows-debug.ps1 index 057f85c331..db8be82d89 100644 --- a/ci/x86_64-windows-debug.ps1 +++ b/ci/x86_64-windows-debug.ps1 @@ -90,8 +90,8 @@ CheckLastExitCode -femit-bin="compiler_rt-x86_64-windows-msvc.c" ` --dep build_options ` -target x86_64-windows-msvc ` - --mod root ..\lib\compiler_rt.zig ` - --mod build_options config.zig + -Mroot="..\lib\compiler_rt.zig" ` + -Mbuild_options="config.zig" CheckLastExitCode Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" diff --git a/ci/x86_64-windows-release.ps1 b/ci/x86_64-windows-release.ps1 index 1bb2057530..d2826f242d 100644 --- a/ci/x86_64-windows-release.ps1 +++ b/ci/x86_64-windows-release.ps1 @@ -89,8 +89,8 @@ CheckLastExitCode -femit-bin="compiler_rt-x86_64-windows-msvc.c" ` --dep build_options ` -target x86_64-windows-msvc ` - --mod root ..\lib\compiler_rt.zig ` - --mod build_options config.zig + -Mroot="..\lib\compiler_rt.zig" ` + -Mbuild_options="config.zig" CheckLastExitCode Import-Module "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll" diff --git a/src/main.zig b/src/main.zig index 9db3a693bf..dabd5d894f 100644 --- a/src/main.zig +++ b/src/main.zig @@ -945,17 +945,17 @@ fn buildOutputType( // null means replace with the test executable binary var test_exec_args: std.ArrayListUnmanaged(?[]const u8) = .{}; - // These get set by CLI flags and then snapshotted when a `--mod` flag is + // These get set by CLI flags and then snapshotted when a `-M` flag is // encountered. var mod_opts: Package.Module.CreateOptions.Inherited = .{}; - // These get appended to by CLI flags and then slurped when a `--mod` flag + // These get appended to by CLI flags and then slurped when a `-M` flag // is encountered. var cssan: ClangSearchSanitizer = .{}; var cc_argv: std.ArrayListUnmanaged([]const u8) = .{}; var deps: std.ArrayListUnmanaged(CliModule.Dep) = .{}; - // Contains every module specified via --mod. The dependencies are added + // Contains every module specified via -M. The dependencies are added // after argument parsing is completed. We use a StringArrayHashMap to make // error output consistent. "root" is special. var create_module: CreateModule = .{ @@ -1081,22 +1081,6 @@ fn buildOutputType( .key = key, .value = value, }); - } else if (mem.eql(u8, arg, "--mod")) { - // deprecated, kept around until the next zig1.wasm update - try handleModArg( - arena, - args_iter.nextOrFatal(), - args_iter.nextOrFatal(), - &create_module, - &mod_opts, - &cc_argv, - &target_arch_os_abi, - &target_mcpu, - &deps, - &c_source_files_owner_index, - &rc_source_files_owner_index, - &cssan, - ); } else if (mem.startsWith(u8, arg, "-M")) { var it = mem.splitScalar(u8, arg["-M".len..], '='); const mod_name = it.next().?; @@ -2649,7 +2633,7 @@ fn buildOutputType( const unresolved_src_path = b: { if (root_src_file) |src_path| { if (create_module.modules.count() != 0) { - fatal("main module provided both by '--mod {s} {}{s}' and by positional argument '{s}'", .{ + fatal("main module provided both by '-M{s}={}{s}' and by positional argument '{s}'", .{ create_module.modules.keys()[0], create_module.modules.values()[0].paths.root, create_module.modules.values()[0].paths.root_src_path, @@ -3409,7 +3393,7 @@ fn buildOutputType( .native_system_include_paths = create_module.native_system_include_paths, // Any leftover C compilation args (such as -I) apply globally rather // than to any particular module. This feature can greatly reduce CLI - // noise when --search-prefix and --mod are combined. + // noise when --search-prefix and -M are combined. .global_cc_argv = try cc_argv.toOwnedSlice(arena), .file_system_inputs = &file_system_inputs, .debug_compiler_runtime_libs = debug_compiler_runtime_libs,