Skip to content

[llvm-ranlib] Change -v (alias for --version) to -V #87661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions llvm/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ Changes to the LLVM tools
* llvm-ar now allows specifying COFF archive format with ``--format`` argument
and uses it by default for COFF targets.

* llvm-ranlib now supports ``-V`` as an alias for ``--version``.
``-v`` (``--verbose`` in llvm-ar) has been removed.
(`#87661 <https://github.com/llvm/llvm-project/pull/87661>`_)

* llvm-objcopy now supports ``--set-symbol-visibility`` and
``--set-symbols-visibility`` options for ELF input to change the
visibility of symbols.
Expand Down
17 changes: 13 additions & 4 deletions llvm/test/tools/llvm-ranlib/help-message.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@
# RUN: llvm-ranlib -help | FileCheck %s --check-prefix=HELP
# RUN: llvm-ranlib --help | FileCheck %s --check-prefix=HELP
# RUN: llvm-ranlib --version | FileCheck %s --check-prefix=VERSION
# RUN: llvm-ranlib -version | FileCheck %s --check-prefix=VERSION
# RUN: llvm-ranlib -v | FileCheck %s --check-prefix=VERSION
# RUN: llvm-ranlib -V | FileCheck %s --check-prefix=VERSION

## Also check combined options (first -h/-v flag wins)
# RUN: llvm-ranlib -Dh | FileCheck %s --check-prefix=HELP
# RUN: llvm-ranlib -Dvh | FileCheck %s --check-prefix=VERSION
# RUN: llvm-ranlib -Dhv | FileCheck %s --check-prefix=HELP
# RUN: llvm-ranlib -DVh | FileCheck %s --check-prefix=VERSION
# RUN: llvm-ranlib -DhV | FileCheck %s --check-prefix=HELP

# HELP: USAGE: llvm-ranlib
# VERSION: version

## -v enables verbose output in BSD ranlib and GNU ar but is another alias
## for --version in GNU ranlib. Reject -v.
# RUN: not llvm-ranlib -v 2>&1 | FileCheck %s --check-prefix=ERR1
# RUN: not llvm-ranlib -version 2>&1 | FileCheck %s --check-prefix=ERR2
# RUN: not llvm-ranlib -Dvh 2>&1 | FileCheck %s --check-prefix=ERR3

# ERR1: error: Invalid option: '-v'
# ERR2: error: Invalid option: '-version'
# ERR3: error: Invalid option: '-vh'
4 changes: 2 additions & 2 deletions llvm/tools/llvm-ar/llvm-ar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static void printRanLibHelp(StringRef ToolName) {
<< "USAGE: " + ToolName + " archive...\n\n"
<< "OPTIONS:\n"
<< " -h --help - Display available options\n"
<< " -v --version - Display the version of this program\n"
<< " -V --version - Display the version of this program\n"
<< " -D - Use zero for timestamps and uids/gids "
"(default)\n"
<< " -U - Use actual timestamps and uids/gids\n"
Expand Down Expand Up @@ -1439,7 +1439,7 @@ static int ranlib_main(int argc, char **argv) {
} else if (arg.front() == 'h') {
printHelpMessage();
return 0;
} else if (arg.front() == 'v') {
} else if (arg.front() == 'V') {
cl::PrintVersionMessage();
return 0;
} else if (arg.front() == 'X') {
Expand Down