configure.ac                            |    4 ++--
 solenv/gbuild/platform/com_MSC_class.mk |    3 ++-
 solenv/gbuild/platform/com_MSC_defs.mk  |    4 ++--
 3 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit e74d0f01504c61917d8ff9e7538a0017b6212ff5
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Wed Oct 19 10:18:07 2022 +0200
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Wed Oct 19 13:07:38 2022 +0200

    Make MSVC -showIncludes processing more reliable
    
    With the Windows display language set to "Portuguès (Brasil)" (and the
    corresponding Visual Studio language pack installed), configure.ac detected
    SHOWINCLUDES_PREFIX to have the value "Observação: incluindo arquivo:" in 
UTF-8
    (i.e., with bytes ... C3 A7 C3 A3 ...).  However, for whatever reason
    filter-showIncludes.awk apparently didn't manage to match the input it 
receives
    against the value of that environment variable, and the Cygwin terminal
    contained output lines starting with either
    
    > Observa□ao: incluindo arquivo:
    
    (with toplevel plain `make`, plain `make` in a module, and `make -O` in a
    module) or
    
    > Observaçao: incluindo arquivo:
    
    (with toplevel `make -O`).  (Note how "ç" is either garbled as "□" or shown
    correctly, and "ã" is always shown as plain "a".)  It's not quite clear to 
me
    where exactly this garbling happens, and why the behavior is apparently
    different in configure.ac vs. make.
    
    The most reliable way to avoid these issues altogether is to force MSVC to 
emit
    English diagnostics, via VSLANG=1033, as explained at
    
<https://stackoverflow.com/questions/2286216/how-to-change-msbuild-error-message-language>.
    (I didn't find any official documentation of that environment variable on 
MSDN
    though.  Thanks to Mike Kaganski for providing that Stack Overflow link.)
    
    dfbce2a556972f552d194d2358c170077915d776 "gbuild: try to run
    filter-showIncludes.awk in C locale" had started to call that AWK script 
with
    LC_ALL=C (and subsequent commits had copied that LC_ALL=C in calls to 
similar
    AWK scripts).  But that appears to neither be sufficient (see above) nor
    necessary now, so I removed all those LC_ALL=C settings.  (There is a gawk
    --characters-as-bytes option, but trying that out didn't make a difference 
for
    this issue.)
    
    clang-cl doesn't support VSLANG, nor does it generate localized diagnostics 
in
    the first place, but lets consistently add VSLANG=1033 when determining
    LO_CLANG_SHOWINCLUDES_PREFIX in configure.ac, too.  (The way VSLANG=1033 is 
set
    in gb_CObject__compiler in com_MSC_class.mk, it affects all kinds of MSVC 
and
    clang-cl invocations, whether or not they actually honour that environment
    variable.)
    
    Change-Id: I52d0e842d200ed256a44d6cc5de1b3868c0acc71
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141524
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/configure.ac b/configure.ac
index ad617bee1221..259001e70b65 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4469,7 +4469,7 @@ if test "$_os" = WINNT; then
     dnl localized
     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
     echo "#include <stdlib.h>" > conftest.c
-    SHOWINCLUDES_PREFIX=`$CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | 
\
+    SHOWINCLUDES_PREFIX=`VSLANG=1033 $CC $CFLAGS -c -showIncludes conftest.c 
2>/dev/null | \
         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
     rm -f conftest.c conftest.obj
     if test -z "$SHOWINCLUDES_PREFIX"; then
@@ -12240,7 +12240,7 @@ if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != 
TRUE; then
 
             AC_MSG_CHECKING([the dependency generation prefix (clang.exe 
-showIncludes)])
             echo "#include <stdlib.h>" > conftest.c
-            LO_CLANG_SHOWINCLUDES_PREFIX=`$LO_CLANG_CC $CFLAGS -c 
-showIncludes conftest.c 2>/dev/null | \
+            LO_CLANG_SHOWINCLUDES_PREFIX=`VSLANG=1033 $LO_CLANG_CC $CFLAGS -c 
-showIncludes conftest.c 2>/dev/null | \
                 grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
             rm -f conftest.c conftest.obj
             if test -z "$LO_CLANG_SHOWINCLUDES_PREFIX"; then
diff --git a/solenv/gbuild/platform/com_MSC_class.mk 
b/solenv/gbuild/platform/com_MSC_class.mk
index 06d21ecd474a..f1affe79e905 100644
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -36,6 +36,7 @@ endef
 
 # $(call gb_CObject__compiler,flags,source,compiler)
 define gb_CObject__compiler
+       VSLANG=1033 \
        $(if $(filter YES,$(LIBRARY_X64)), $(CXX_X64_BINARY), \
                $(if $(filter YES,$(PE_X86)), $(CXX_X86_BINARY), \
                        $(if $(filter %.c,$(2)), \
@@ -291,7 +292,7 @@ $(call gb_Helper_abbreviate_dirs,\
                        -manifestfile:$(WORKDIR)/LinkTarget/$(2).manifest \
                        -pdb:$(call 
gb_LinkTarget__get_pdb_filename,$(WORKDIR)/LinkTarget/$(2))) \
                $(if $(ILIBTARGET),-out:$(1) -implib:$(ILIBTARGET),-out:$(1)) \
-               | LC_ALL=C $(GBUILDDIR)/platform/filter-creatingLibrary.awk; 
RC=$${PIPESTATUS[0]}; rm $${RESPONSEFILE} \
+               | $(GBUILDDIR)/platform/filter-creatingLibrary.awk; 
RC=$${PIPESTATUS[0]}; rm $${RESPONSEFILE} \
        $(if $(filter Library,$(TARGETTYPE)),; if [ ! -f $(ILIBTARGET) ]; then 
rm -f $(1); exit 42; fi) \
        $(if $(filter Library,$(TARGETTYPE)),&& if [ -f 
$(WORKDIR)/LinkTarget/$(2).manifest ]; then mt.exe $(MTFLAGS) -nologo -manifest 
$(WORKDIR)/LinkTarget/$(2).manifest 
$(SRCDIR)/solenv/gbuild/platform/win_compatibility.manifest 
-outputresource:$(1)\;2 && touch -r $(1) $(WORKDIR)/LinkTarget/$(2).manifest 
$(ILIBTARGET); fi) \
        $(if $(filter Executable,$(TARGETTYPE)),&& if [ -f 
$(WORKDIR)/LinkTarget/$(2).manifest ]; then mt.exe $(MTFLAGS) -nologo -manifest 
$(WORKDIR)/LinkTarget/$(2).manifest 
$(SRCDIR)/solenv/gbuild/platform/win_compatibility.manifest 
-outputresource:$(1)\;1 && touch -r $(1) $(WORKDIR)/LinkTarget/$(2).manifest; 
fi) \
diff --git a/solenv/gbuild/platform/com_MSC_defs.mk 
b/solenv/gbuild/platform/com_MSC_defs.mk
index 364c0011f38a..5b6094b560cf 100644
--- a/solenv/gbuild/platform/com_MSC_defs.mk
+++ b/solenv/gbuild/platform/com_MSC_defs.mk
@@ -251,12 +251,12 @@ gb_COMPILERDEBUGOPTFLAGS :=
 ifeq ($(gb_FULLDEPS),$(true))
 gb_COMPILERDEPFLAGS := -showIncludes
 define gb_create_deps
-| LC_ALL=C $(GBUILDDIR)/platform/filter-showIncludes.awk -vdepfile=$(1) 
-vobjectfile=$(2) -vsourcefile=$(3); exit $${PIPESTATUS[0]}
+| $(GBUILDDIR)/platform/filter-showIncludes.awk -vdepfile=$(1) 
-vobjectfile=$(2) -vsourcefile=$(3); exit $${PIPESTATUS[0]}
 endef
 else
 gb_COMPILERDEPFLAGS :=
 define gb_create_deps
-| LC_ALL=C $(GBUILDDIR)/platform/filter-sourceName.awk; exit $${PIPESTATUS[0]}
+| $(GBUILDDIR)/platform/filter-sourceName.awk; exit $${PIPESTATUS[0]}
 endef
 endif
 

Reply via email to