branch: master commit e5dfb39aab2f36357402db0bddfbdd6310efe25b Author: Ileana Dumitrescu <ileanadumitresc...@gmail.com> AuthorDate: Mon Nov 18 20:19:57 2024 +0200
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. --- NEWS | 2 ++ build-aux/ltmain.in | 25 +++++++++++++------------ tests/libtool.at | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/NEWS b/NEWS index b61b4024..355a5ad0 100644 --- a/NEWS +++ b/NEWS @@ -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'. diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in index 4d7fc293..8cef9e8d 100644 --- a/build-aux/ltmain.in +++ b/build-aux/ltmain.in @@ -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]... # --------------------------------- diff --git a/tests/libtool.at b/tests/libtool.at index b41c3cde..7143a508 100755 --- a/tests/libtool.at +++ b/tests/libtool.at @@ -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