From 30035fe1a7c759c89ee62eb46efce6b3790fcc08 Mon Sep 17 00:00:00 2001 From: Renato Golin Date: Tue, 10 Mar 2015 13:58:33 +0000 Subject: [PATCH] Allow -target= and --target options Using clang as a cross-compiler with the 'target' option could be confusing for those inexperienced in the realm of cross compiling. This patch would allow the use of all these four variants of the target option: -target --target -target= --target= Patch by Gabor Ballabas. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231787 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Driver/Options.td | 4 ++-- test/Driver/target.c | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index bcb6ec0a7d..977e925117 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -1540,7 +1540,7 @@ def no_system_header_prefix : Joined<["--"], "no-system-header-prefix=">, "system header.">; def : Separate<["--"], "no-system-header-prefix">, Alias; def s : Flag<["-"], "s">; -def target : Joined<["--"], "target=">, Flags<[DriverOption, CoreOption]>, +def target : Joined<["-", "--"], "target=">, Flags<[DriverOption, CoreOption]>, HelpText<"Generate code for the given target">; def gcc_toolchain : Joined<["--"], "gcc-toolchain=">, Flags<[DriverOption]>, HelpText<"Use the gcc toolchain at the given directory">; @@ -1713,7 +1713,7 @@ def mv5 : Flag<["-"], "mv5">, Group, Alias, // aliases for options that are spelled using the more common Unix / GNU flag // style of double-dash and equals-joined flags. def gcc_toolchain_legacy_spelling : Separate<["-"], "gcc-toolchain">, Alias; -def target_legacy_spelling : Separate<["-"], "target">, Alias; +def target_legacy_spelling : Separate<["-", "--"], "target">, Alias; // Special internal option to handle -Xlinker --no-demangle. def Z_Xlinker__no_demangle : Flag<["-"], "Z-Xlinker-no-demangle">, diff --git a/test/Driver/target.c b/test/Driver/target.c index a46ba16296..c7652ff62c 100644 --- a/test/Driver/target.c +++ b/test/Driver/target.c @@ -7,3 +7,9 @@ // Also check that the legacy spelling works. // RUN: %clang -no-canonical-prefixes -target unknown-unknown-unknown -c %s \ // RUN: -o %t.o -### 2>&1 | FileCheck %s +// +// RUN: %clang -no-canonical-prefixes -target=unknown-unknown-unknown -c %s \ +// RUN: -o %t.o -### 2>&1 | FileCheck %s +// +// RUN: %clang -no-canonical-prefixes --target unknown-unknown-unknown -c %s \ +// RUN: -o %t.o -### 2>&1 | FileCheck %s -- 2.40.0