[PATCH] D93375: [clang][driver] Add -ansi option to CompileOnly group
Timm Bäder via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 15 23:52:02 PST 2020
tbaeder created this revision.
tbaeder added a reviewer: dang.
tbaeder requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
-ansi is documented as being the "same as -std=c89", but there are differences when passing it to a link:
clang -c test.c -o test.o
clang test.o -o test -std=c89 # Works, no problem
clang test.o -o test -ansi # Warning about unused -ansi option
`-std=` is claimed in this case in `clang/lib/Driver/Driver.cpp` at the end of `handleArguments()` via `Args.ClaimAllArgs(options::OPT_CompileOnly_Group)`. This does not include `-ansi` right now however, since it does not belong to the `CompileOnly` group.
Adding `-ansi` to said group makes sense since it's supposed to be an alias for `-std=c89` and resolves this inconsistency.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D93375
Files:
clang/include/clang/Driver/Options.td
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -809,7 +809,7 @@
def Z_Joined : Joined<["-"], "Z">;
def all__load : Flag<["-"], "all_load">;
def allowable__client : Separate<["-"], "allowable_client">;
-def ansi : Flag<["-", "--"], "ansi">;
+def ansi : Flag<["-", "--"], "ansi">, Group<CompileOnly_Group>;
def arch__errors__fatal : Flag<["-"], "arch_errors_fatal">;
def arch : Separate<["-"], "arch">, Flags<[NoXarchOption]>;
def arch__only : Separate<["-"], "arch_only">;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93375.312127.patch
Type: text/x-patch
Size: 631 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201216/bcb315ca/attachment-0001.bin>
More information about the cfe-commits
mailing list