Browse Source

!14233 fix mindrt cpplint warning

From: @wangcong666
Reviewed-by: @kisnwang,@limingqi107
Signed-off-by: @limingqi107
pull/14233/MERGE
mindspore-ci-bot Gitee 4 years ago
parent
commit
3fe2ea6f6b
16 changed files with 58 additions and 20 deletions
  1. +8
    -2
      mindspore/core/mindrt/include/actor/actorapp.h
  2. +4
    -1
      mindspore/core/mindrt/include/actor/msg.h
  3. +1
    -0
      mindspore/core/mindrt/include/actor/naught.h
  4. +2
    -0
      mindspore/core/mindrt/include/async/apply.h
  5. +4
    -0
      mindspore/core/mindrt/include/async/async.h
  6. +2
    -2
      mindspore/core/mindrt/include/async/result.h
  7. +2
    -2
      mindspore/core/mindrt/include/async/spinlock.h
  8. +2
    -1
      mindspore/core/mindrt/include/async/uuid_base.h
  9. +2
    -1
      mindspore/core/mindrt/include/async/uuid_generator.h
  10. +5
    -0
      mindspore/core/mindrt/src/actor/actormgr.cc
  11. +5
    -1
      mindspore/core/mindrt/src/actor/actormgr.h
  12. +4
    -1
      mindspore/core/mindrt/src/actor/actorpolicy.h
  13. +5
    -2
      mindspore/core/mindrt/src/actor/actorpolicyinterface.h
  14. +2
    -0
      mindspore/core/mindrt/src/actor/actorthread.cc
  15. +2
    -0
      mindspore/core/mindrt/src/actor/actorthread.h
  16. +8
    -7
      mindspore/core/mindrt/src/actor/iomgr.h

+ 8
- 2
mindspore/core/mindrt/include/actor/actorapp.h View File

@@ -17,6 +17,11 @@
#ifndef MINDSPORE_CORE_MINDRT_INCLUDE_ACTOR_ACTORAPP_H
#define MINDSPORE_CORE_MINDRT_INCLUDE_ACTOR_ACTORAPP_H

#include <memory>
#include <utility>
#include <map>
#include <string>

#include "actor/actor.h"

namespace mindspore {
@@ -33,7 +38,7 @@ class AppActor : public ActorBase {
public:
typedef std::function<void(std::unique_ptr<MessageBase>)> APPBehavior;

AppActor(const std::string &name) : ActorBase(name) {}
explicit AppActor(const std::string &name) : ActorBase(name) {}
~AppActor() {}

inline int Send(const AID &to, std::unique_ptr<MessageBase> msg) { return ActorBase::Send(to, std::move(msg)); }
@@ -63,7 +68,8 @@ class AppActor : public ActorBase {

template <typename T, typename M>
static void BehaviorBase(T *t, void (T::*method)(const AID &, std::unique_ptr<M>), std::unique_ptr<MessageBase> msg) {
(t->*method)(msg->From(), std::move(std::unique_ptr<M>((M *)static_cast<MessageLocal *>(msg.get())->ptr)));
(t->*method)(msg->From(),
std::move(std::unique_ptr<M>(reinterpret_cast<M *>(static_cast<MessageLocal *>(msg.get())->ptr))));
return;
}



+ 4
- 1
mindspore/core/mindrt/include/actor/msg.h View File

@@ -17,6 +17,9 @@
#ifndef MINDSPORE_CORE_MINDRT_INCLUDE_ACTOR_MSG_H
#define MINDSPORE_CORE_MINDRT_INCLUDE_ACTOR_MSG_H

#include <utility>
#include <string>

#include "actor/aid.h"

namespace mindspore {
@@ -33,7 +36,7 @@ class MessageBase {
KTERMINATE,
};

MessageBase(Type eType = Type::KMSG) : from(), name(), type(eType) {}
explicit MessageBase(Type eType = Type::KMSG) : from(), name(), type(eType) {}

explicit MessageBase(const std::string &sName, Type eType = Type::KMSG) : from(), name(sName), type(eType) {}



+ 1
- 0
mindspore/core/mindrt/include/actor/naught.h View File

@@ -18,6 +18,7 @@
#define MINDSPORE_CORE_MINDRT_INCLUDE_ACTOR_NAUGHT_H

#include <memory>
#include <string>

namespace mindspore {



+ 2
- 0
mindspore/core/mindrt/include/async/apply.h View File

@@ -17,6 +17,8 @@
#ifndef MINDSPORE_CORE_MINDRT_INCLUDE_ASYNC_APPLY_H
#define MINDSPORE_CORE_MINDRT_INCLUDE_ASYNC_APPLY_H

#include <utility>

namespace mindspore {

template <typename T, T... Ints>


+ 4
- 0
mindspore/core/mindrt/include/async/async.h View File

@@ -17,6 +17,10 @@
#ifndef MINDSPORE_CORE_MINDRT_INCLUDE_ASYNC_ASYNC_H
#define MINDSPORE_CORE_MINDRT_INCLUDE_ASYNC_ASYNC_H

#include <tuple>
#include <memory>
#include <utility>

#include "actor/actor.h"
#include "actor/buslog.h"



+ 2
- 2
mindspore/core/mindrt/include/async/result.h View File

@@ -19,8 +19,8 @@

#include <tuple>

#include "option.h"
#include "status.h"
#include "async/option.h"
#include "async/status.h"

namespace mindspore {



+ 2
- 2
mindspore/core/mindrt/include/async/spinlock.h View File

@@ -24,8 +24,8 @@ namespace mindspore {
class SpinLock {
public:
void Lock() {
while (locked.test_and_set(std::memory_order_acquire))
;
while (locked.test_and_set(std::memory_order_acquire)) {
}
}

void Unlock() { locked.clear(std::memory_order_release); }


+ 2
- 1
mindspore/core/mindrt/include/async/uuid_base.h View File

@@ -22,6 +22,7 @@
#include <sstream>
#include <iostream>
#include <iomanip>
#include <string>
#include "async/option.h"

namespace mindspore {
@@ -88,7 +89,7 @@ std::basic_ostream<T, F> &operator<<(std::basic_ostream<T, F> &s, const struct u

int i = 0;
for (const uint8_t *ptr = outputUuid.BeginAddress(); ptr < outputUuid.EndAddress(); ++ptr, ++i) {
s << std::setw(UUID_WIDTH) << (int)(*ptr);
s << std::setw(UUID_WIDTH) << static_cast<int>(*ptr);
if (i == FIRST_DELIM_OFFSET || i == SECOND_DELIM_OFFSET || i == THIRD_DELIM_OFFSET || i == FOURTH_DELIM_OFFSET) {
s << '-';
}


+ 2
- 1
mindspore/core/mindrt/include/async/uuid_generator.h View File

@@ -17,7 +17,8 @@
#ifndef MINDSPORE_CORE_MINDRT_INCLUDE_ASYNC_UUID_GENERATOR_H
#define MINDSPORE_CORE_MINDRT_INCLUDE_ASYNC_UUID_GENERATOR_H

#include "uuid_base.h"
#include <string>
#include "async/uuid_base.h"

namespace mindspore {



+ 5
- 0
mindspore/core/mindrt/src/actor/actormgr.cc View File

@@ -13,6 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <map>
#include <list>
#include <string>
#include <memory>
#include <utility>

#include "actor/actormgr.h"
#include "actor/actorpolicy.h"


+ 5
- 1
mindspore/core/mindrt/src/actor/actormgr.h View File

@@ -18,6 +18,11 @@
#define MINDSPORE_CORE_MINDRT_SRC_ACTOR_ACTORMGR_H

#include <set>
#include <utility>
#include <map>
#include <memory>
#include <string>

#include "actor/actorthread.h"

namespace mindspore {
@@ -78,7 +83,6 @@ class ActorMgr {
std::string delegate;
static std::shared_ptr<ActorMgr> actorMgr;
static std::map<std::string, std::shared_ptr<IOMgr> > ioMgrs;

}; // end of class ActorMgr

}; // end of namespace mindspore


+ 4
- 1
mindspore/core/mindrt/src/actor/actorpolicy.h View File

@@ -16,13 +16,16 @@

#ifndef MINDSPORE_CORE_MINDRT_SRC_ACTOR_ACTORPOLICY_H
#define MINDSPORE_CORE_MINDRT_SRC_ACTOR_ACTORPOLICY_H
#include <list>
#include <memory>

#include "actor/actorpolicyinterface.h"

namespace mindspore {

class ShardedThread : public ActorPolicy {
public:
ShardedThread(const std::shared_ptr<ActorBase> &actor);
explicit ShardedThread(const std::shared_ptr<ActorBase> &actor);
virtual ~ShardedThread();

protected:


+ 5
- 2
mindspore/core/mindrt/src/actor/actorpolicyinterface.h View File

@@ -17,6 +17,9 @@
#ifndef MINDSPORE_CORE_MINDRT_SRC_ACTOR_ACTORPOLICYINTERFACE_H
#define MINDSPORE_CORE_MINDRT_SRC_ACTOR_ACTORPOLICYINTERFACE_H

#include <list>
#include <memory>

namespace mindspore {

class ActorPolicy {
@@ -26,8 +29,8 @@ class ActorPolicy {
dequeMailbox = &mailbox2;
msgCount = 0;
start = false;
};
virtual ~ActorPolicy(){};
}
virtual ~ActorPolicy() {}
inline void SwapMailbox() {
std::list<std::unique_ptr<MessageBase>> *temp;
temp = enqueMailbox;


+ 2
- 0
mindspore/core/mindrt/src/actor/actorthread.cc View File

@@ -16,6 +16,8 @@

#include "actor/actorthread.h"
#include <atomic>
#include <utility>
#include <memory>

namespace mindspore {
constexpr int MAXTHREADNAMELEN = 12;


+ 2
- 0
mindspore/core/mindrt/src/actor/actorthread.h View File

@@ -20,6 +20,8 @@
#include <condition_variable>
#include <list>
#include <thread>
#include <memory>
#include <string>

#include "actor/actor.h"



+ 8
- 7
mindspore/core/mindrt/src/actor/iomgr.h View File

@@ -17,6 +17,7 @@
#ifndef MINDSPORE_CORE_MINDRT_SRC_ACTOR_IOMGR_H
#define MINDSPORE_CORE_MINDRT_SRC_ACTOR_IOMGR_H
#include <memory>
#include <string>
#include "actor/aid.h"

#include "actor/msg.h"
@@ -41,18 +42,18 @@ static const int SOCKET_KEEPINTERVAL = 5;
// probes without getting a reply.
static const int SOCKET_KEEPCOUNT = 3;

static const std::string BUS_MAGICID = "BUS0";
static const char BUS_MAGICID[] = "BUS0";

static const std::string URL_PROTOCOL_IP_SEPARATOR = "://";
static const char URL_PROTOCOL_IP_SEPARATOR[] = "://";

static const std::string URL_IP_PORT_SEPARATOR = ":";
static const char URL_IP_PORT_SEPARATOR[] = ":";

static const std::string UDP_EVLOOP_THREADNAME = "HARES_LB_Udp";
static const char UDP_EVLOOP_THREADNAME[] = "HARES_LB_Udp";

static const std::string TCP_RECV_EVLOOP_THREADNAME = "HARES_LB_TcpR";
static const std::string TCP_SEND_EVLOOP_THREADNAME = "HARES_LB_TcpS";
static const char TCP_RECV_EVLOOP_THREADNAME[] = "HARES_LB_TcpR";
static const char TCP_SEND_EVLOOP_THREADNAME[] = "HARES_LB_TcpS";

static const std::string HTTP_CLIENT_EVLOOP_THREADNAME = "HARES_LB_Htp";
static const char HTTP_CLIENT_EVLOOP_THREADNAME[] = "HARES_LB_Htp";

class IOMgr {
public:


Loading…
Cancel
Save