Files
libreoffice/compilerplugins/clang/test/cppunitassertequals.hxx
Stephan Bergmann a528392e71 Fixed/improved loplugin:cppunitassertequals
* 994e38e336 "loplugin: use TypeCheck instead of
  getQualifiedNameAsString" had effectively disabled this plugin (Asserter is a
  struct, not a namespace).  Fixed that.

* Also improved the checks, for one removing the---expensive---use of
  Plugin::parentStmt, for another making the plugin look into (...), !..., and
  ...&&... expressions.

* However, as the plugin had effectively already been disabled (see above) when
  it was switched on generally with 839e53b933
  "compilerplugins: enable loplugin:cppunitassertequals by default", it now hit
  way more places than I had initially anticipated.  To keep the amount of work
  manageable, midway-through I disabled looking into ...&&... expressions for
  now.  That will be enabled (and resulting warnings fixed) in follow-up
  commits.

* Checks like

    CPPUNIT_ASSERT(a == b)

  that actually want to check a specific overloaded operator == implementation,
  rather than using such an operator == to actually check that a and b are
  equal, can be rewritten as

    CPPUNIT_ASSERT(operator ==(a, b))

  to avoid false warnings from this plugin.

Change-Id: If3501020e2d150ad0f2454a65a39081e31470c0f
2017-04-28 14:23:35 +02:00

24 lines
761 B
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_COMPILERPLUGINS_CLANG_TEST_CPPUNITASSERTEQUALS_HXX
#define INCLUDED_COMPILERPLUGINS_CLANG_TEST_CPPUNITASSERTEQUALS_HXX
#include "sal/config.h"
#include "rtl/ustring.hxx"
struct T { bool operator ==(T); };
void test(bool b1, bool b2, OUString const & s1, OUString const & s2, T t);
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */