summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2021-02-02 18:29:41 +0100
committerStephan Bergmann <sbergman@redhat.com>2021-02-02 20:45:24 +0100
commitdec14c4a074b4e4b156b932155e73647d6ebd519 (patch)
treee3587b3c16d85716979ed9970387f1d92fc3b1ae /compilerplugins
parent947277146e4c1ff7544371095fcc6bd5842b2d98 (diff)
Avoid --disable-assert-always-abort loplugin:stringviewparam false positives
...like > l10ntools/source/helper.cxx:19:69: error: replace function parameter of type 'const rtl::OString &' with 'std::string_view' [loplugin:stringviewparam] > const OString& rText, const OString& rUnEscaped, const OString& rEscaped ) > ~~~~~~~~~~~~~~~^~~~~~~~ where the call to rEscaped.getLength(), which would otherwise suppress the warning, is hidden inside an assert. (Similar to aab0322580c87864a4f0c0af1fed07282c8dccbb "Disable loplugin:casttovoid when --disable-assert-always-abort".) Change-Id: Ie054f75317707757b1c6243c593f539d445a9fee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110331 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/stringviewparam.cxx4
-rw-r--r--compilerplugins/clang/test/stringviewparam.cxx2
2 files changed, 6 insertions, 0 deletions
diff --git a/compilerplugins/clang/stringviewparam.cxx b/compilerplugins/clang/stringviewparam.cxx
index 9182bf449bbe..862e9f331133 100644
--- a/compilerplugins/clang/stringviewparam.cxx
+++ b/compilerplugins/clang/stringviewparam.cxx
@@ -504,6 +504,10 @@ private:
{
return;
}
+ if (compiler.getPreprocessor().getIdentifierInfo("NDEBUG")->hasMacroDefinition())
+ {
+ return;
+ }
StringRef fn(handler.getMainFileName());
// leave the string QA tests alone
if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sal/qa/"))
diff --git a/compilerplugins/clang/test/stringviewparam.cxx b/compilerplugins/clang/test/stringviewparam.cxx
index a9fcab3ac3a0..db57c8ac415f 100644
--- a/compilerplugins/clang/test/stringviewparam.cxx
+++ b/compilerplugins/clang/test/stringviewparam.cxx
@@ -7,6 +7,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#undef NDEBUG
+
#include "sal/config.h"
#include <string_view>