[PATCH] D93375: [clang][driver] Add -ansi option to CompileOnly group

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 8 05:22:11 PST 2021


aaron.ballman added a comment.

In D93375#2486165 <https://reviews.llvm.org/D93375#2486165>, @tbaeder wrote:

> That sounds good but it's different to what this patch is trying to accomplish, isn't it? -ansi already doesn't get passed to the linker.
> E.g. with clang 10.0.1 without this patch:
>
>   ~ ❯ clang test.o -o test -ansi -###
>   clang version 10.0.1 (Fedora 10.0.1-3.fc32)
>   Target: x86_64-unknown-linux-gnu
>   Thread model: posix
>   InstalledDir: /usr/bin
>   clang-10: warning: argument unused during compilation: '-ansi' [-Wunused-command-line-argument]
>    "/usr/bin/ld" "--hash-style=gnu" "--build-id" "--eh-frame-hdr" "-m" "elf_x86_64" "-dynamic-linker" "/lib64/ld-linux-x86-64.so.2" "-o" "test" "/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crt1.o" "/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crti.o" "/usr/bin/../lib/gcc/x86_64-redhat-linux/10/crtbegin.o" "-L/usr/bin/../lib/gcc/x86_64-redhat-linux/10" "-L/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../lib64" "-L/usr/bin/../lib64" "-L/lib/../lib64" "-L/usr/lib/../lib64" "-L/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../.." "-L/usr/bin/../lib" "-L/lib" "-L/usr/lib" "test.o" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "/usr/bin/../lib/gcc/x86_64-redhat-linux/10/crtend.o" "/usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crtn.o"

Hmm, I think I misunderstood what you had originally written then with:

> -ansi is documented as being the "same as -std=c89", but there are differences when passing it to a link:

Regardless, the request is whether we can add test coverage to ensure we don't regress this behavior in the future.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93375/new/

https://reviews.llvm.org/D93375



More information about the cfe-commits mailing list