summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-02-22 14:05:24 +0600
committerMike Kaganski <mike.kaganski@collabora.com>2024-02-23 11:23:12 +0100
commitb889b33d928e49ba568ee1277c70d653083a2453 (patch)
tree5c2ae01894b5117abb7dcde49e70d2649f2380c2
parent9ba68c769d41d1075152a22bf37e78fb9320317b (diff)
Do not suppress newer compiler warnings on Windows
This partially reverts commit 133610669b8707a278d9b3b0af025779044fd8c5 (windows: silence new warning for now, 2016-02-21). That commit had disabled warnings introduced after VS 2013 (compiler major version 18). For now, it was impossible to remove the -Wv:18 from CLR flags. Also, some warnings in Boost were suppressed in vcl/source/window/layout.cxx: C:\lo\build\workdir\UnpackedTarball\boost\boost/multi_array/multi_array_ref.hpp(615): error C2220: the following warning is treated as an error C:\lo\build\workdir\UnpackedTarball\boost\boost/multi_array/multi_array_ref.hpp(615): warning C4459: declaration of 'extents' hides global declaration C:\lo\build\workdir\UnpackedTarball\boost\boost/multi_array/base.hpp(69): note: see declaration of 'boost::`anonymous-namespace'::extents' C:\lo\build\workdir\UnpackedTarball\boost\boost/multi_array/multi_array_ref.hpp(612): note: while compiling class template member function 'boost::multi_array_ref<T,2>::multi_array_ref(T *,const boost::general_storage_order<2> &,const __int64 *,const unsigned __int64 *)' with [ T=`anonymous-namespace'::GridEntry ] C:\lo\build\workdir\UnpackedTarball\boost\boost/multi_array.hpp(153): note: see reference to function template instantiation 'boost::multi_array_ref<T,2>::multi_array_ref(T *,const boost::general_storage_order<2> &,const __int64 *,const unsigned __int64 *)' being compiled with [ T=`anonymous-namespace'::GridEntry ] C:\lo\build\workdir\UnpackedTarball\boost\boost/multi_array.hpp(122): note: see reference to class template instantiation 'boost::multi_array_ref<T,2>' being compiled with [ T=`anonymous-namespace'::GridEntry ] C:/lo/core/vcl/source/window/layout.cxx(905): note: see reference to class template instantiation 'boost::multi_array<`anonymous-namespace'::GridEntry,2,std::allocator<T>>' being compiled with [ T=`anonymous-namespace'::GridEntry ] Change-Id: Ibf89e3d3e5a2f6a747bb7fbd214a9b27d8068901 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163717 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--solenv/gbuild/platform/com_MSC_defs.mk18
-rw-r--r--vcl/source/window/layout.cxx32
2 files changed, 31 insertions, 19 deletions
diff --git a/solenv/gbuild/platform/com_MSC_defs.mk b/solenv/gbuild/platform/com_MSC_defs.mk
index 3bf1a9d0a041..65918fc3da9b 100644
--- a/solenv/gbuild/platform/com_MSC_defs.mk
+++ b/solenv/gbuild/platform/com_MSC_defs.mk
@@ -122,14 +122,6 @@ gb_CFLAGS := \
gb_CXXFLAGS_DISABLE_WARNINGS = -w
-ifneq ($(COM_IS_CLANG),TRUE)
-
-# clang-cl doesn't support -Wv:18 for now
-gb_CFLAGS += \
- -Wv:18 \
-
-endif
-
gb_CXXFLAGS := \
-utf-8 \
$(CXXFLAGS_CXX11) \
@@ -179,12 +171,10 @@ endif
ifneq ($(COM_IS_CLANG),TRUE)
-# clang-cl doesn't support -Wv:18 for now
# Work around MSVC 2017 C4702 compiler bug with release builds
# http://document-foundation-mail-archive.969070.n3.nabble.com/Windows-32-bit-build-failure-unreachable-code-tp4243848.html
# http://document-foundation-mail-archive.969070.n3.nabble.com/64-bit-Windows-build-failure-after-MSVC-Update-tp4246816.html
gb_CXXFLAGS += \
- -Wv:18 \
$(if $(filter 0,$(gb_DEBUGLEVEL)),-wd4702) \
endif
@@ -267,8 +257,10 @@ endif
gb_LTOFLAGS := $(if $(filter TRUE,$(ENABLE_LTO)),-GL)
-# When compiling for CLR, disable "warning C4339: use of undefined type detected
-# in CLR meta-data - use of this type may lead to a runtime exception":
+# VS2019 produces a warning C4857, that it doesn't support -std:c++20; it can't
+# be suppressed by -wd4857, only by -Wv:18. The warning seems incorrect, because
+# using -std:c++17 produces errors about undeclated 'char8_t'. VS2022 doesn't
+# have the problem, so drop -Wv:18 when bumping baseline.
gb_CXXCLRFLAGS := \
$(if $(COM_IS_CLANG), \
$(patsubst -std=%,-std:c++20 -Zc:__cplusplus,$(gb_CXXFLAGS)), \
@@ -277,9 +269,7 @@ gb_CXXCLRFLAGS := \
-AI $(INSTDIR)/$(LIBO_URE_LIB_FOLDER) \
-EHa \
-clr \
- -wd4339 \
-Wv:18 \
- -wd4267 \
-Zc:twoPhase- \
ifeq ($(COM_IS_CLANG),TRUE)
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 5639d8e62d57..9e47d6d8f347 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -897,12 +897,15 @@ struct GridEntry
typedef boost::multi_array<GridEntry, 2> array_type;
-static array_type assembleGrid(const VclGrid &rGrid);
-static bool isNullGrid(const array_type& A);
-static void calcMaxs(const array_type &A, std::vector<VclGrid::Value> &rWidths, std::vector<VclGrid::Value> &rHeights);
-
-array_type assembleGrid(const VclGrid &rGrid)
+#if defined _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4459)
+#endif
+static array_type assembleGrid(const VclGrid &rGrid)
{
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
array_type A;
for (vcl::Window* pChild = rGrid.GetWindow(GetWindowType::FirstChild); pChild;
@@ -925,7 +928,14 @@ array_type assembleGrid(const VclGrid &rGrid)
A.resize(boost::extents[nCurrentMaxXPos+1][nCurrentMaxYPos+1]);
}
+#if defined _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4459)
+#endif
GridEntry &rEntry = A[nLeftAttach][nTopAttach];
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
rEntry.pChild = pChild;
rEntry.nSpanWidth = nWidth;
rEntry.nSpanHeight = nHeight;
@@ -1045,7 +1055,14 @@ array_type assembleGrid(const VclGrid &rGrid)
sal_Int32 nNonEmptyRows = std::count(aNonEmptyRows.begin(), aNonEmptyRows.end(), true);
//make new grid without empty rows and columns
+#if defined _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4459)
+#endif
array_type B(boost::extents[nNonEmptyCols][nNonEmptyRows]);
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
for (sal_Int32 x = 0, x2 = 0; x < nMaxX; ++x)
{
if (!aNonEmptyCols[x])
@@ -1087,10 +1104,15 @@ static void calcMaxs(const array_type &A, std::vector<VclGrid::Value> &rWidths,
#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdangling-reference"
+#elif defined _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4459)
#endif
const GridEntry &rEntry = A[x][y];
#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 13
#pragma GCC diagnostic pop
+#elif defined _MSC_VER
+#pragma warning(pop)
#endif
const vcl::Window *pChild = rEntry.pChild;
if (!pChild || !pChild->IsVisible())