From: Ileana Dumitrescu Date: Mon, 18 Nov 2024 18:19:57 +0000 (+0200) Subject: libtool: Fix --no-warnings flag X-Git-Tag: v2.5.4~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e5dfb39aab2f36357402db0bddfbdd6310efe25b;p=thirdparty%2Flibtool.git 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. --- diff --git a/NEWS b/NEWS index b61b40247..355a5ad03 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 4d7fc293d..8cef9e8df 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 b41c3cdef..7143a5082 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