[PATCH] D37825: Accept not only --foo but also -foo.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 13:22:47 PDT 2017


ruiu created this revision.

GNU ld manual says that multi-letter long option can be prefixed with
either -- or -. Therefore, we should accept not only --subsystem but
also -subsystem, for example.

There is one exception. If an option starts with "o", it should only be
prefixed with -- to avoid ambiguity with -o<filename> option.


https://reviews.llvm.org/D37825

Files:
  lld/MinGW/Options.td


Index: lld/MinGW/Options.td
===================================================================
--- lld/MinGW/Options.td
+++ lld/MinGW/Options.td
@@ -18,8 +18,8 @@
   HelpText<"Path to file to write output">;
 def out_implib: Separate<["--"], "out-implib">, HelpText<"Import library name">;
 def shared: F<"shared">, HelpText<"Build a shared object">;
-def subs: Separate<["--"], "subsystem">, HelpText<"Specify subsystem">;
-def stack: Separate<["--"], "stack">;
+def subs: S<"subsystem">, HelpText<"Specify subsystem">;
+def stack: S<"stack">;
 def whole_archive: F<"whole-archive">,
     HelpText<"Include all object files for following archives">;
 def verbose: F<"verbose">, HelpText<"Verbose mode">;
@@ -32,10 +32,10 @@
 def Bdynamic: F<"Bdynamic">, HelpText<"Link against shared libraries">;
 def Bstatic: F<"Bstatic">, HelpText<"Do not link against shared libraries">;
 def O: Joined<["-"], "O">, HelpText<"Optimize output file size">;
-def enable_auto_image_base: Flag<["--"], "enable-auto-image-base">;
+def enable_auto_image_base: F<"enable-auto-image-base">;
 def full_shutdown: Flag<["--"], "full-shutdown">;
-def major_image_version: Separate<["--"], "major-image-version">;
-def minor_image_version: Separate<["--"], "minor-image-version">;
+def major_image_version: S<"major-image-version">;
+def minor_image_version: S<"minor-image-version">;
 def sysroot: J<"sysroot">, HelpText<"Sysroot">;
 def v: Flag<["-"], "v">, HelpText<"Display the version number">;
 def version: F<"version">, HelpText<"Display the version number and exit">;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37825.115108.patch
Type: text/x-patch
Size: 1552 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170913/a305fc93/attachment.bin>


More information about the llvm-commits mailing list