authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-12-19 15:55:04-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-01 17:51:20-07:00
logfad35835aac7d6ac1a3654eba631febbf8d4e82b
treeba6c56b3bd72e1f053aa6769fbf224eb21f07225
parent76c47815789148eb6a95e5bd6b719fde52280e4a

CLI: better error messages for bad args


1 files changed, 26 insertions(+), 1 deletions(-)

src/main.zig+26-1
...@@ -3823,7 +3823,32 @@ fn createModule(...@@ -3823,7 +3823,32 @@ fn createModule(
3823 create_module.opts.any_dyn_libs = true;3823 create_module.opts.any_dyn_libs = true;
38243824
3825 create_module.resolved_options = Compilation.Config.resolve(create_module.opts) catch |err| switch (err) {3825 create_module.resolved_options = Compilation.Config.resolve(create_module.opts) catch |err| switch (err) {
3826 else => fatal("unable to resolve compilation options: {s}", .{@errorName(err)}),3826 error.WasiExecModelRequiresWasi => fatal("execution model only allowed for WASI OS targets", .{}),
3827 error.SharedMemoryIsWasmOnly => fatal("shared memory only allowed for WebAssembly CPU targets", .{}),
3828 error.ObjectFilesCannotShareMemory => fatal("object files cannot share memory", .{}),
3829 error.SharedMemoryRequiresAtomicsAndBulkMemory => fatal("shared memory requires atomics and bulk_memory CPU features", .{}),
3830 error.ThreadsRequireSharedMemory => fatal("threads require shared memory", .{}),
3831 error.UnknownTargetEntryPoint => fatal("unknown target entry point", .{}),
3832 error.NonExecutableEntryPoint => fatal("entry points only allowed for executables", .{}),
3833 error.EmittingLlvmModuleRequiresLlvmBackend => fatal("emitting an LLVM module requires using the LLVM backend", .{}),
3834 error.LlvmLacksTargetSupport => fatal("LLVM lacks support for the specified target", .{}),
3835 error.ZigLacksTargetSupport => fatal("compiler backend unavailable for the specified target", .{}),
3836 error.EmittingBinaryRequiresLlvmLibrary => fatal("producing machine code via LLVM requires using the LLVM library", .{}),
3837 error.LldIncompatibleObjectFormat => fatal("using LLD to link {s} files is unsupported", .{@tagName(target.ofmt)}),
3838 error.LtoRequiresLld => fatal("LTO requires using LLD", .{}),
3839 error.SanitizeThreadRequiresLibCpp => fatal("thread sanitization is (for now) implemented in C++, so it requires linking libc++", .{}),
3840 error.LibCppRequiresLibUnwind => fatal("libc++ requires linking libunwind", .{}),
3841 error.OsRequiresLibC => fatal("the target OS requires using libc as the stable syscall interface", .{}),
3842 error.LibCppRequiresLibC => fatal("libc++ requires linking libc", .{}),
3843 error.LibUnwindRequiresLibC => fatal("libunwind requires linking libc", .{}),
3844 error.TargetCannotDynamicLink => fatal("dynamic linking unavailable on the specified target", .{}),
3845 error.LibCRequiresDynamicLinking => fatal("libc of the specified target requires dynamic linking", .{}),
3846 error.SharedLibrariesRequireDynamicLinking => fatal("using shared libraries requires dynamic linking", .{}),
3847 error.ExportMemoryAndDynamicIncompatible => fatal("exporting memory is incompatible with dynamic linking", .{}),
3848 error.DynamicLibraryPrecludesPie => fatal("dynamic libraries cannot be position independent executables", .{}),
3849 error.TargetRequiresPie => fatal("the specified target requires position independent executables", .{}),
3850 error.SanitizeThreadRequiresPie => fatal("thread sanitization requires position independent executables", .{}),
3851 error.BackendLacksErrorTracing => fatal("the selected backend has not yet implemented error return tracing", .{}),
3827 };3852 };
3828 }3853 }
38293854