bug#56798: Inconsistent locale settings between LT and non-LT $CC invocation

Jan Engelhardt <[email protected]> Wed, 27 Jul 2022 18:07:44 +0200 (CEST)
Newsgroups gmane.comp.gnu.libtool.bugs
Message-ID <[email protected]>
Greetings.


This is a bug report primarily against libtool 2.4.7. automake is Cc'ed.

libtool seems to reset locales, causing compiler output to differ 
between libtool-based invocations and those without libtool. This 
becomes in particular visible when an automake project invokes both 
compile strategies.


Observed
========
$ make V=0
  CXX      foo.o
foo.cpp: In function ‘int main()’:
foo.cpp:1:36: warning: declaration of ‘foo’ shadows a previous local [-Wshadow]
    1 | int main() { auto foo = 42; { auto foo = 43; }}
  CXXLD    foo
  CXX      bar.lo
bar.cpp: In function 'int main()':
bar.cpp:1:36: warning: declaration of 'foo' shadows a previous local [-Wshadow]
    1 | int main() { auto foo = 42; { auto foo = 43; }}


Expected to see
===============
Do not mix '' and ‘’. Stick to one variant.

Either libtool should stop resetting the locale, or perhaps
automake should start resetting the locale.


Testcase
========
foo.cpp
-------
int main() { auto foo = 42; { auto foo = 43; }}

Makefile.am
-----------
BUILT_SOURCES = bar.cpp
bar.cpp: foo.cpp
        cp foo.cpp bar.cpp
AM_CXXFLAGS = -Wshadow
bin_PROGRAMS = foo
foo_SOURCES = foo.cpp
lib_LTLIBRARIES = libbar.la
libbar_la_SOURCES = bar.cpp

configure.ac
------------
AC_INIT([blah], [0])
AM_INIT_AUTOMAKE([1.10 foreign subdir-objects])
LT_INIT([disable-static])
AC_PROG_CXX
AC_CONFIG_FILES([Makefile])
AC_OUTPUT



_______________________________________________
Bug-libtool mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-libtool