libtool: Fix --no-warnings flag

Passing --no-warnings to libtool would not suppress warning messages.

* build-aux/ltmain.in: Add 'opt_warning' check before printing out
  warning messages.
* tests/libtool.at: Add simple test for '--no-warnings'.
* NEWS: Update.
This commit is contained in:
Ileana Dumitrescu 2024-11-18 20:19:57 +02:00
parent 270b7bb2db
commit e5dfb39aab
No known key found for this signature in database
GPG Key ID: 6570EA01146F7354
3 changed files with 34 additions and 12 deletions

2
NEWS
View File

@ -36,6 +36,8 @@ NEWS - list of user-visible changes between releases of GNU Libtool
- Fix '-Fe' usage with linking in MSVC.
- Fix '--no-warnings' flag.
** Changes in supported systems or compilers:
- Support additional flang-based compilers, 'f18' and 'f95'.

View File

@ -111,18 +111,6 @@ func_echo ()
}
# func_warning ARG...
# -------------------
# Libtool warnings are not categorized, so override funclib.sh
# func_warning with this simpler definition.
func_warning ()
{
$debug_cmd
$warning_func ${1+"$@"}
}
## ---------------- ##
## Options parsing. ##
## ---------------- ##
@ -383,6 +371,7 @@ libtool_options_prep ()
opt_preserve_dup_deps=false
opt_quiet=false
opt_finishing=true
opt_warning=
nonopt=
preserve_args=
@ -553,6 +542,18 @@ libtool_parse_options ()
func_add_hook func_parse_options libtool_parse_options
# func_warning ARG...
# -------------------
# Libtool warnings are not categorized, so override funclib.sh
# func_warning with this simpler definition.
func_warning ()
{
if $opt_warning; then
$debug_cmd
$warning_func ${1+"$@"}
fi
}
# libtool_validate_options [ARG]...
# ---------------------------------

View File

@ -239,3 +239,22 @@ AT_CHECK([$LIBTOOL -n --mode=link --tag=UnKnOwN compiler -o liba.la foo.lo],
AT_CHECK([$GREP 'ignoring unknown tag' stderr], [0], [ignore])
AT_CLEANUP
## -------------------- ##
## Silence LT warnings. ##
## -------------------- ##
AT_SETUP([test silencing warnings])
AT_DATA([x.cpp],
[[
void f(int *p) { *p = 21; }
]])
AT_CHECK([$LIBTOOL --mode=compile --tag=CXX g++ -c x.cpp], [0], [stdout], [stderr])
AT_CHECK([$LIBTOOL --no-warnings --mode=link --tag=CXX g++ -o libx.la -no-canonical-prefixes -R /usr/lib64/ -version-info x.lo], [0], [stdout], [stderr])
AT_CHECK([$GREP -- 'warning' stderr], [1], [ignore])
AT_CLEANUP