[PATCH] D106037: [llvm-readobj] Remove one-dash long options

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 14 21:50:44 PDT 2021


MaskRay created this revision.
MaskRay added a reviewer: jhenderson.
Herald added a subscriber: rupprecht.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

llvm-readelf is a user-facing tool which emulates GNU readelf. Remove one-dash
long options which are not recognized by GNU style `getopt_long`. This ensures
long options cannot collide with grouped short options.

Note: the help messages have recommended the double-dash forms since LLVM 9.0.0.
llvm-readobj is intended as an internal tool which has some flexibility.
llvm-readelf/llvm-readobj use the same option parsing code and llvm-readobj's
one-dash long options aren't used.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106037

Files:
  llvm/tools/llvm-readobj/Opts.td


Index: llvm/tools/llvm-readobj/Opts.td
===================================================================
--- llvm/tools/llvm-readobj/Opts.td
+++ llvm/tools/llvm-readobj/Opts.td
@@ -4,14 +4,14 @@
 class FF<string name, string help> : Flag<["--", "-"], name>, HelpText<help>;
 
 multiclass BB<string name, string help1, string help2> {
-  def NAME: Flag<["--", "-"], name>, HelpText<help1>;
-  def no_ # NAME: Flag<["--", "-"], "no-" # name>, HelpText<help2>;
+  def NAME: Flag<["--"], name>, HelpText<help1>;
+  def no_ # NAME: Flag<["--"], "no-" # name>, HelpText<help2>;
 }
 
 multiclass Eq<string name, string help> {
-  def NAME #_EQ : Joined<["--", "-"], name #"=">,
+  def NAME #_EQ : Joined<["--"], name #"=">,
                   HelpText<help>;
-  def : Separate<["--", "-"], name>, Alias<!cast<Joined>(NAME #_EQ)>;
+  def : Separate<["--"], name>, Alias<!cast<Joined>(NAME #_EQ)>;
 }
 
 def addrsig : FF<"addrsig", "Display address-significance table">;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106037.358840.patch
Type: text/x-patch
Size: 964 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210715/2b2689d1/attachment.bin>


More information about the llvm-commits mailing list