Compilation: Mark .c++ files as having C++ extension

Some projects, such as Cap'n Proto, use .c++ as their filenames. Without
this, compiling them fails because zig c++ will fall back to using the
linker.
This commit is contained in:
sin-ack 2024-08-07 13:30:39 +00:00 committed by Andrew Kelley
parent a9b65b6fd4
commit 2cfad20204
2 changed files with 22 additions and 21 deletions

View File

@ -6095,6 +6095,7 @@ pub fn hasCppExt(filename: []const u8) bool {
mem.endsWith(u8, filename, ".cc") or
mem.endsWith(u8, filename, ".cpp") or
mem.endsWith(u8, filename, ".cxx") or
mem.endsWith(u8, filename, ".c++") or
mem.endsWith(u8, filename, ".stub");
}

View File

@ -387,27 +387,27 @@ const usage_build_generic =
\\ zig translate-c [options] [file]
\\
\\Supported file types:
\\ .zig Zig source code
\\ .o ELF object file
\\ .o Mach-O (macOS) object file
\\ .o WebAssembly object file
\\ .obj COFF (Windows) object file
\\ .lib COFF (Windows) static library
\\ .a ELF static library
\\ .a Mach-O (macOS) static library
\\ .a WebAssembly static library
\\ .so ELF shared object (dynamic link)
\\ .dll Windows Dynamic Link Library
\\ .dylib Mach-O (macOS) dynamic library
\\ .tbd (macOS) text-based dylib definition
\\ .s Target-specific assembly source code
\\ .S Assembly with C preprocessor (requires LLVM extensions)
\\ .c C source code (requires LLVM extensions)
\\ .cxx .cc .C .cpp .stub C++ source code (requires LLVM extensions)
\\ .m Objective-C source code (requires LLVM extensions)
\\ .mm Objective-C++ source code (requires LLVM extensions)
\\ .bc LLVM IR Module (requires LLVM extensions)
\\ .cu Cuda source code (requires LLVM extensions)
\\ .zig Zig source code
\\ .o ELF object file
\\ .o Mach-O (macOS) object file
\\ .o WebAssembly object file
\\ .obj COFF (Windows) object file
\\ .lib COFF (Windows) static library
\\ .a ELF static library
\\ .a Mach-O (macOS) static library
\\ .a WebAssembly static library
\\ .so ELF shared object (dynamic link)
\\ .dll Windows Dynamic Link Library
\\ .dylib Mach-O (macOS) dynamic library
\\ .tbd (macOS) text-based dylib definition
\\ .s Target-specific assembly source code
\\ .S Assembly with C preprocessor (requires LLVM extensions)
\\ .c C source code (requires LLVM extensions)
\\ .cxx .cc .C .cpp .c++ .stub C++ source code (requires LLVM extensions)
\\ .m Objective-C source code (requires LLVM extensions)
\\ .mm Objective-C++ source code (requires LLVM extensions)
\\ .bc LLVM IR Module (requires LLVM extensions)
\\ .cu Cuda source code (requires LLVM extensions)
\\
\\General Options:
\\ -h, --help Print this help and exit