Commit 8e47c641 authored by Thomas Braun's avatar Thomas Braun
Browse files

clang-tidy: Fix readability-use-concise-preprocessor-directives

Done via

run-clang-tidy-21 -p build/clang-tidy -fix -header-filter='.*' -checks='-*,readability-use-concise-preprocessor-directives' 'src' 'log4tango/src' 'tests/catch2*'
parent 36d43051
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@

#include <tango/common/log4tango/config.h>

#if defined(_MSC_VER)
#ifdef _MSC_VER

  // We ensure that the header is included because we will redefine the ERROR and DEBUG
  // macros. Also includes winsock2 to prevent windows.h from including 'winsock.h'.
+2 −2
Original line number Diff line number Diff line
@@ -1480,7 +1480,7 @@ ClntIdent Connection::get_client_identification() const
        CppClntIdent_6 ci_v6;
        ci_v6.cpp_clnt = pid;
        auto trace_context{W3CTraceContextV0()};
#if defined(TANGO_USE_TELEMETRY)
#ifdef TANGO_USE_TELEMETRY
        // populate W3C headers of the IDLv6 data structure for trace context propagation
        std::string trace_parent;
        std::string trace_state;
@@ -2354,7 +2354,7 @@ DeviceProxy::DeviceProxy(const char *na, bool need_check_acc, CORBA::ORB_var orb

void DeviceProxy::real_constructor(const std::string &name, bool need_check_acc)
{
#if defined(TANGO_USE_TELEMETRY)
#ifdef TANGO_USE_TELEMETRY
    // start a 'client' span and create a scope so that the RPCs related to the construction of
    // the device proxy will traced under a specific scope and will enhance readability on backend
    // side - we use the current telemetry interface or the default one if none.
+15 −15
Original line number Diff line number Diff line
@@ -355,7 +355,7 @@ GroupElement *GroupElement::find_i(const std::string &n, TANGO_UNUSED(bool fwd))
//-----------------------------------------------------------------------------
TokenList GroupElement::tokenize_i(const std::string &p)
{
#if defined(_LOCAL_DEBUGGING)
#ifdef _LOCAL_DEBUGGING
    TANGO_LOG << "\t|- Group::tokenize::pattern [" << p << "]" << std::endl;
#endif
    int done = 0;
@@ -382,7 +382,7 @@ TokenList GroupElement::tokenize_i(const std::string &p)
        }
        last_pos = pos + 1;
    } while(done == 0);
#if defined(_LOCAL_DEBUGGING)
#ifdef _LOCAL_DEBUGGING
    TANGO_LOG << "\t\t|- tokens: [";
    for(int t = 0; t < tokens.size(); t++)
    {
@@ -400,7 +400,7 @@ bool GroupElement::match_i(const std::string &_p, const TokenList &tokens)
    unsigned int t;
    std::string p(_p);
    std::transform(p.begin(), p.end(), p.begin(), ::tolower);
#if defined(_LOCAL_DEBUGGING)
#ifdef _LOCAL_DEBUGGING
    TANGO_LOG << "\t|- Group::match::pattern " << _p << std::endl;
#endif
    bool result = false;
@@ -419,7 +419,7 @@ bool GroupElement::match_i(const std::string &_p, const TokenList &tokens)
    {
        result = true;
    }
#if defined(_LOCAL_DEBUGGING)
#ifdef _LOCAL_DEBUGGING
    if(result == true)
    {
        TANGO_LOG << "\t\t|- Group::match::pattern matches tokens" << std::endl;
@@ -583,12 +583,12 @@ void Group::add(Group *g, int tmo_ms)
#ifdef TANGO_GROUP_HAS_THREAD_SAFE_IMPL
    omni_mutex_lock guard(elements_mutex);
#endif
#if defined(_LOCAL_DEBUGGING)
#ifdef _LOCAL_DEBUGGING
    TANGO_LOG << "Group::add::adding sub-group " << (g ? g->get_name() : "NULL") << std::endl;
#endif
    if(g == nullptr || get_group_i(g->get_name()) == g || g->get_group_i(get_name()) == this)
    {
#if defined(_LOCAL_DEBUGGING)
#ifdef _LOCAL_DEBUGGING
        TANGO_LOG << "Group::add::failed to add group"
                  << (g ? (g->get_name() + " (self ref. or already in group)") : "NULL") << std::endl;
#endif
@@ -660,7 +660,7 @@ bool Group::add_i(GroupElement *e, bool fwd)
{
    if(e == nullptr || e == this)
    {
#if defined(_LOCAL_DEBUGGING)
#ifdef _LOCAL_DEBUGGING
        TANGO_LOG << "Group::add_i::failed to add " << (e ? (e->get_name() + " (null or self ref)") : "NULL")
                  << std::endl;
#endif
@@ -669,7 +669,7 @@ bool Group::add_i(GroupElement *e, bool fwd)
    GroupElement *te = find_i(e->get_name(), fwd);
    if(te != nullptr && te != this)
    {
#if defined(_LOCAL_DEBUGGING)
#ifdef _LOCAL_DEBUGGING
        TANGO_LOG << "Group::add_i::failed to add " << e->get_name() << " (already in group)" << std::endl;
#endif
        return false;
@@ -685,7 +685,7 @@ void Group::remove(const std::string &p, bool fwd)
#ifdef TANGO_GROUP_HAS_THREAD_SAFE_IMPL
    omni_mutex_lock guard(elements_mutex);
#endif
#if defined(_LOCAL_DEBUGGING)
#ifdef _LOCAL_DEBUGGING
    TANGO_LOG << "Group::remove::pattern [" << p << "]" << std::endl;
#endif
    remove_i(p, fwd);
@@ -697,7 +697,7 @@ void Group::remove(const std::vector<std::string> &pl, bool fwd)
#ifdef TANGO_GROUP_HAS_THREAD_SAFE_IMPL
    omni_mutex_lock guard(elements_mutex);
#endif
#if defined(_LOCAL_DEBUGGING)
#ifdef _LOCAL_DEBUGGING
    TANGO_LOG << "Group::remove::pattern list" << std::endl;
#endif
    for(unsigned int p = 0; p < pl.size(); p++)
@@ -709,12 +709,12 @@ void Group::remove(const std::vector<std::string> &pl, bool fwd)
//-----------------------------------------------------------------------------
void Group::remove_i(const std::string &p, bool fwd)
{
#if defined(_LOCAL_DEBUGGING)
#ifdef _LOCAL_DEBUGGING
    TANGO_LOG << "\t|- Group::remove_i" << std::endl;
#endif
    if(name_equals(p))
    {
#if defined(_LOCAL_DEBUGGING)
#ifdef _LOCAL_DEBUGGING
        TANGO_LOG << "Group::remove_i::failed to remove " << p << " (can't remove self)" << std::endl;
#endif
        return;
@@ -747,7 +747,7 @@ void Group::remove_i(const std::string &p, bool fwd)
            it = std::find(elements.begin(), elements.end(), remove_list[i]);
            if(it != elements.end())
            {
#if defined(_LOCAL_DEBUGGING)
#ifdef _LOCAL_DEBUGGING
                TANGO_LOG << "\t|- Group::remove_i::removing " << (*it)->get_name() << std::endl;
#endif // _LOCAL_DEBUGGING
                delete remove_list[i];
@@ -773,7 +773,7 @@ void Group::remove_all()
#ifdef TANGO_GROUP_HAS_THREAD_SAFE_IMPL
    omni_mutex_lock guard(elements_mutex);
#endif
#if defined(_LOCAL_DEBUGGING)
#ifdef _LOCAL_DEBUGGING
    TANGO_LOG << "Group::remove_all::" << get_name() << std::endl;
#endif
    auto it = elements.begin();
@@ -2285,7 +2285,7 @@ GroupReplyList GroupDeviceElement::write_attribute_reply_i(long id, long tmo)
//-----------------------------------------------------------------------------
void GroupDeviceElement::dump(TANGO_UNUSED(int indent_level))
{
#if defined(_LOCAL_DEBUGGING)
#ifdef _LOCAL_DEBUGGING
    for(int i = 0; i < indent_level; i++)
    {
        TANGO_LOG << "\t";
+2 −2
Original line number Diff line number Diff line
@@ -3905,7 +3905,7 @@ void Tango::ZmqDevPipeData::operator<<=(TangoCdrMemoryStream &_n)
//
//--------------------------------------------------------------------------------------------------------------------

#if defined(__clang__)
#ifdef __clang__
// UBSAN: downcast of address 0x55daeb87ca40 which does not point to an object of type
// 'Tango::ZmqDevVarPipeDataEltArray'
//        0x55daeb87ca40: note: object is of type 'Tango::DevVarPipeDataEltArray'
@@ -3962,7 +3962,7 @@ void Tango::ZmqDevVarPipeDataEltArray::operator<<=(TangoCdrMemoryStream &_n)
//
//--------------------------------------------------------------------------------------------------------------------

#if defined(__clang__)
#ifdef __clang__
// Same problem as in: void Tango::ZmqDevPipeBlob::operator<<= (TangoCdrMemoryStream &_n)
[[clang::no_sanitize("vptr")]]
#elif defined(__GNUC__)
+2 −2
Original line number Diff line number Diff line
@@ -554,7 +554,7 @@ void Configuration::validate_exporter_and_endpoint(Exporter exporter, const std:
    switch(exporter)
    {
    case Exporter::grpc:
#if !defined(TANGO_TELEMETRY_USE_GRPC)
#ifndef TANGO_TELEMETRY_USE_GRPC
        TANGO_THROW_EXCEPTION(Tango::API_InvalidArgs,
                              "Requested grpc trace exporter, but compiled without GRPC support.");
#else
@@ -569,7 +569,7 @@ void Configuration::validate_exporter_and_endpoint(Exporter exporter, const std:
        break;
#endif
    case Exporter::http:
#if !defined(TANGO_TELEMETRY_USE_HTTP)
#ifndef TANGO_TELEMETRY_USE_HTTP
        TANGO_THROW_EXCEPTION(Tango::API_InvalidArgs,
                              "Requested http trace exporter, but compiled without HTTP support.");
#else
Loading