ice icon indicating copy to clipboard operation
ice copied to clipboard

Const correctness of dispatch code

Open pepone opened this issue 2 years ago • 2 comments

C++ 11 generated code for a dispatch looks like

/// \cond INTERNAL
bool
PollingChat::PollingChatSession::_iceD_getUpdates(::IceInternal::Incoming& inS, const ::Ice::Current& current)
{
    _iceCheckMode(::Ice::OperationMode::Normal, current.mode);
    inS.readEmptyParams();
    ChatRoomEventSeq ret = this->getUpdates(current);
    auto ostr = inS.startWriteParams();
    ostr->writeAll(ret);
    ostr->writePendingValues();
    inS.endWriteParams();
    return true;
}

clang-tidy rerpots

cpp11/Chat/server/generated/PollingChat.cpp:155:5: warning: variable 'ret' of type 'PollingChat::ChatRoomEventSeq' (aka 'vector< ::std::shared_ptr<ChatRoomEvent>>') can be declared 'const' [misc-const-correctness]
    ChatRoomEventSeq ret = this->getUpdates(current);
    ^

pepone avatar Mar 08 '23 18:03 pepone

The clang-tidy diagnostics does not match your generated code snippet.

bernardnormier avatar Mar 08 '23 18:03 bernardnormier

updated the generated code snippet

pepone avatar Mar 08 '23 19:03 pepone