<div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div>Many llvm utilities use cl::ParseCommandLineOptions() (include/Support/CommandLine.h) to parse command line options. The cl library accepts both -long-option and --long-option forms, with the single dash form (-long-option) being more popular.</div><div><br></div><div>We also have many binary utilities (llvm-objcopy llvm-objdump llvm-readobj llvm-size ...) whose names reflect what they imitate. For compatibility with GNU binutils (and some Unix utilities transitively), these utilities accept many short options. People who use llvm utilities as replacement of GNU binutils may use the grouped option syntax (POSIX Utility Conventions), e.g. -Sx => -S -x, -Wd => -W -d, -sj.text => -s -j.text</div><div><br></div><div>The problem is, grouped short options don't play well with -long-option. Sometimes there can be ambiguity. The issue is more prominent if the short option accepts an argument.</div><div><br></div><div>An approach to prevent the ambiguity is to just disallow -long-option.</div><div>In D60439, I plan to make llvm-objcopy accept --long-option but not -long-option.</div><div>It will make its command line option parsing behave more like GNU objcopy and less like a regular llvm utility. What do people think of the divergence?</div><div><br></div><div>Further, can we make similar changes to other llvm binary utilities (their names give people the expectation), especially those with many short options such as llvm-objdump and llvm-readobj? llvm-readobj behaves like GNU readelf if you name it "llvm-readelf". (I don't suggest disallowing -long-option for utilities other than binutils)</div><div><br></div><div>(Note, llvm-objcopy is a new member of the family and it uses tablegen based include/llvm/Option/Opton.h, instead of cl:: as other utilities do.)</div></div><div><br></div><div><br></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">宋方睿</div></div></div></div></div>