-Werror,-Wunused-macros (clang-cl)
...which started to hit me now either due to building against a recent Visual Studio 2022 Preview 17.4 (which would presumably no longer define those macros in some system headers, so that the #ifndef's started to kick in now), or due to building against a more recent Windows SDK (see below), no idea which. But just dropping the seemingly unused macro definitions from the various .cxx caused builds against old Windows SDK versions like Jenkins <https://ci.libreoffice.org/job/gerrit_windows/139228/> to fail like > C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\GdiplusTypes.h(479): error C3861: 'min': identifier not found > C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\GdiplusTypes.h(480): error C3861: 'min': identifier not found > C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\GdiplusTypes.h(481): error C3861: 'max': identifier not found > C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\GdiplusTypes.h(482): error C3861: 'max': identifier not found > C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\GdiplusTypes.h(503): error C3861: 'max': identifier not found > C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\GdiplusTypes.h(504): error C3861: 'max': identifier not found > C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\GdiplusTypes.h(505): error C3861: 'min': identifier not found > C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\GdiplusTypes.h(506): error C3861: 'min': identifier not found > C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\GdiplusTypes.h(667): error C3861: 'min': identifier not found > C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\GdiplusTypes.h(668): error C3861: 'min': identifier not found > C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\GdiplusTypes.h(669): error C3861: 'max': identifier not found > C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\GdiplusTypes.h(670): error C3861: 'max': identifier not found > C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\GdiplusTypes.h(691): error C3861: 'max': identifier not found > C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\GdiplusTypes.h(692): error C3861: 'max': identifier not found > C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\GdiplusTypes.h(693): error C3861: 'min': identifier not found > C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\GdiplusTypes.h(694): error C3861: 'min': identifier not found [...] > make[1]: *** [C:/cygwin/home/tdf/jenkins/workspace/gerrit_windows/solenv/gbuild/LinkTarget.mk:334: C:/cygwin/home/tdf/jenkins/workspace/gerrit_windows/workdir/CxxObject/vcl/win/app/salinst.o] Error 2 so move those macro definitions to prewin.h (where they don't trigger clang-cl's -Werror,-Wunused-macros from within an include file, even if they happen to be unused in a translation unit). (For simplicity, see whether it works in practice to drop those #ifndef wrappers. If they turn out to be relevant for some build scenarios after all, they can be added back.) Change-Id: I76d8794ae2de310bdca420e5488db2bc19de23ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142090 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
parent
e27d4016f0
commit
c8fd1fb553
5 changed files with 13 additions and 27 deletions
|
@ -51,6 +51,8 @@
|
||||||
#undef WB_LEFT
|
#undef WB_LEFT
|
||||||
#undef WB_RIGHT
|
#undef WB_RIGHT
|
||||||
#undef Yield
|
#undef Yield
|
||||||
|
#undef max
|
||||||
#undef mciSetCommand
|
#undef mciSetCommand
|
||||||
|
#undef min
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
|
|
@ -44,6 +44,17 @@
|
||||||
|
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
|
|
||||||
|
// For some old versions of the Windows SDK, at least GidplusTypes.h (as indirectly included from
|
||||||
|
// gdiplus.h, which in turn we often include from between these prewin.h/postwin.h wrappers) expects
|
||||||
|
// pre-existing min and max. That is true for e.g.
|
||||||
|
// C:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0/um/GdiplusTypes.h, but not for e.g.
|
||||||
|
// C:/Program Files (x86)/Windows Kits/10/Include/10.0.22000.0/um/GdiplusTypes.h which explicitly
|
||||||
|
// defines its own GDIPLUS_MIN/MAX macros. The easiest fix appears to be to define min/max here and
|
||||||
|
// to undefin them again in postwin.h, until no supported version of the Windows SDK requires this
|
||||||
|
// hack any longer:
|
||||||
|
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||||
|
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
|
|
@ -64,15 +64,6 @@
|
||||||
|
|
||||||
#include <desktop/crashreport.hxx>
|
#include <desktop/crashreport.hxx>
|
||||||
|
|
||||||
#if defined _MSC_VER
|
|
||||||
#ifndef min
|
|
||||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
|
||||||
#endif
|
|
||||||
#ifndef max
|
|
||||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <prewin.h>
|
#include <prewin.h>
|
||||||
|
|
||||||
#include <gdiplus.h>
|
#include <gdiplus.h>
|
||||||
|
|
|
@ -49,15 +49,6 @@
|
||||||
#include <win/salids.hrc>
|
#include <win/salids.hrc>
|
||||||
#include <ControlCacheKey.hxx>
|
#include <ControlCacheKey.hxx>
|
||||||
|
|
||||||
#if defined _MSC_VER
|
|
||||||
#ifndef min
|
|
||||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
|
||||||
#endif
|
|
||||||
#ifndef max
|
|
||||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <prewin.h>
|
#include <prewin.h>
|
||||||
|
|
||||||
#include <gdiplus.h>
|
#include <gdiplus.h>
|
||||||
|
|
|
@ -35,15 +35,6 @@
|
||||||
#include <tools/helpers.hxx>
|
#include <tools/helpers.hxx>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#if defined _MSC_VER
|
|
||||||
#ifndef min
|
|
||||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
|
||||||
#endif
|
|
||||||
#ifndef max
|
|
||||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <prewin.h>
|
#include <prewin.h>
|
||||||
#include <gdiplus.h>
|
#include <gdiplus.h>
|
||||||
#include <postwin.h>
|
#include <postwin.h>
|
||||||
|
|
Loading…
Reference in a new issue