[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Mon Feb 3 22:40:21 UTC 2020


 compilerplugins/clang/duplicate-defines.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit 93d836b6737d0653bf0a86e93bd711c0706c9d9b
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Feb 3 16:10:59 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Feb 3 23:39:47 2020 +0100

    Silence loplugin:duplicatedefines for WIN32_LEAN_AND_MEAN (clang-cl)
    
    ...as seen at
    
    > In file included from desktop/win32/source/QuickStart/QuickStart.cxx:29:
    > In file included from include\systools/win32/uwinapi.h:25:
    > include\prewin.h(38,9): error: duplicate defines [loplugin:duplicatedefines]
    > #define WIN32_LEAN_AND_MEAN
    >         ^
    > desktop/win32/source/QuickStart/QuickStart.cxx(24,9): note: previous define [loplugin:duplicatedefines]
    > #define WIN32_LEAN_AND_MEAN
    >         ^
    
    (An alternative fix could be to replace all those defines of WIN32_LEAN_AND_MEAN
    prior to including windows.h with includes of prewin.h and postwin.h?)
    
    Change-Id: I0271b5629af8f4ecfb3c90f1455bad399174f6ed
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87880
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/compilerplugins/clang/duplicate-defines.cxx b/compilerplugins/clang/duplicate-defines.cxx
index fc0c49655a22..74a95f2ccad7 100644
--- a/compilerplugins/clang/duplicate-defines.cxx
+++ b/compilerplugins/clang/duplicate-defines.cxx
@@ -77,6 +77,11 @@ void DuplicateDefines::MacroDefined(const Token& rMacroNameTok, const MacroDirec
     // we replicate these macros in all the .hrc files
     if (aMacroName == "NC_" || aMacroName == "NNC_")
         return;
+    // We define this prior to including <windows.h>:
+    if (aMacroName == "WIN32_LEAN_AND_MEAN")
+    {
+        return;
+    }
     // TODO no obvious fix for these
     if (aMacroName == "FID_SEARCH_NOW" || aMacroName == "FID_SVX_START" || aMacroName == "FN_PARAM")
         return;


More information about the Libreoffice-commits mailing list