Skip to content

Use -- to separate flags and options from input filenames #513

Open
@ncalexan

Description

@ncalexan

I'm in the unusual position of trying to cross-compile from macOS to Windows with clang-cl (building Firefox, but that's not really relevant). I'm running into the [-Wslash-u-filename] warning, like so:

running: "/Users/nalexander/.mozbuild/clang/bin/clang-cl" "-Xclang" "-std=gnu99" "-nologo" "-MD" "-O1" "-Z7" "-Brepro" "-m64" "-Xclang" "-ftrivial-auto-var-init=pattern" "-guard:cf" "-DDEBUG=1" "-I/Users/nalexander/Mozilla/gecko/toolkit/library/rust" "-I/Users/nalexander/Mozilla/objdirs/objdir-windows-compile/toolkit/library/rust" "-I/Users/nalexander/Mozilla/objdirs/objdir-windows-compile/dist/include" "-I/Users/nalexander/Mozilla/objdirs/objdir-windows-compile/dist/include/nspr" "-I/Users/nalexander/Mozilla/objdirs/objdir-windows-compile/dist/include/nss" "-MD" "-FI" "/Users/nalexander/Mozilla/objdirs/objdir-windows-compile/mozilla-config.h" "-DMOZILLA_CLIENT" "-Qunused-arguments" "-D_HAS_EXCEPTIONS=0" "-W3" "-Gy" "-Zc:inline" "-Gw" "-Wno-unknown-pragmas" "-Wno-ignored-pragmas" "-Wno-deprecated-declarations" "-Wno-invalid-noreturn" "-Z7" "-O2" "-Oy-" "-DMOZILLA_CONFIG_H" "-DMDB_IDL_LOGN=9" "-Fo/Users/nalexander/Mozilla/objdirs/objdir-windows-compile/x86_64-pc-windows-msvc/debug/build/lmdb-rkv-sys-e159e1f997d95e72/out/mdb.o" "-c" "/Users/nalexander/Mozilla/gecko/third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mdb.c"
cargo:warning=clang-9: warning: '/Users/nalexander/Mozilla/gecko/third_party/rust/lmdb-rkv-sys/lmdb/libraries/liblmdb/mdb.c' treated as the '/U' option [-Wslash-u-filename]
cargo:warning=clang-9: note: Use '--' to treat subsequent arguments as filenames
cargo:warning=clang-9: error: no input files
exit code: 1

What's needed in these situations is to insert -- before the input filename. Given that cc-rs must already be normalizing its Builder outputs, this seems straight-forward enough, but it's technically possible that supported C/C++ compilers wouldn't accept --.

Would the project take a patch?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions