Merge pull request #2538 from enkiller/cplusplus

[components][cplusplus] 格式化代码
This commit is contained in:
Bernard Xiong 2019-04-03 22:47:56 +08:00 committed by GitHub
commit 6b9c2f7b29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 10 deletions

View File

@ -28,7 +28,7 @@ template<typename T, uint32_t queue_sz>
class Mail { class Mail {
public: public:
/** Create and Initialise Mail queue. */ /** Create and Initialise Mail queue. */
Mail(const char* name = "") Mail(const char *name = "")
{ {
rt_mb_init(&mID, name, mPool, queue_sz, RT_IPC_FLAG_FIFO); rt_mb_init(&mID, name, mPool, queue_sz, RT_IPC_FLAG_FIFO);
} }

View File

@ -21,7 +21,7 @@ namespace rtthread {
class Mutex { class Mutex {
public: public:
/** Create and Initialize a Mutex object */ /** Create and Initialize a Mutex object */
Mutex(const char* name = "mutex"); Mutex(const char *name = "mutex");
~Mutex(); ~Mutex();
/** Wait until a Mutex becomes available. /** Wait until a Mutex becomes available.

View File

@ -68,7 +68,7 @@ public:
private: private:
struct rt_messagequeue mID; struct rt_messagequeue mID;
char mPool[(sizeof(struct rt_messagequeue)+sizeof(T)) * queue_sz]; char mPool[(sizeof(struct rt_messagequeue) + sizeof(T)) * queue_sz];
}; };
} }

View File

@ -20,7 +20,7 @@ namespace rtthread
class Thread class Thread
{ {
public: public:
typedef void (*thread_func_t) (void *param); typedef void (*thread_func_t)(void *param);
/** Allocate a new thread without starting execution /** Allocate a new thread without starting execution
@param priority initial priority of the thread function. (default: osPriorityNormal). @param priority initial priority of the thread function. (default: osPriorityNormal).
@ -28,14 +28,14 @@ public:
@param stack_pointer pointer to the stack area to be used by this thread (default: NULL). @param stack_pointer pointer to the stack area to be used by this thread (default: NULL).
*/ */
Thread(rt_uint32_t stack_size = 2048, Thread(rt_uint32_t stack_size = 2048,
rt_uint8_t priority = (RT_THREAD_PRIORITY_MAX * 2)/3, rt_uint8_t priority = (RT_THREAD_PRIORITY_MAX * 2) / 3,
rt_uint32_t tick = 20, rt_uint32_t tick = 20,
const char *name = "th"); const char *name = "th");
Thread(void (*entry)(void *p), Thread(void (*entry)(void *p),
void *p = RT_NULL, void *p = RT_NULL,
rt_uint32_t stack_size = 2048, rt_uint32_t stack_size = 2048,
rt_uint8_t priority = (RT_THREAD_PRIORITY_MAX * 2)/3, rt_uint8_t priority = (RT_THREAD_PRIORITY_MAX * 2) / 3,
rt_uint32_t tick = 20, rt_uint32_t tick = 20,
const char *name = "th"); const char *name = "th");

View File

@ -26,7 +26,7 @@ void operator delete(void *ptr)
rt_free(ptr); rt_free(ptr);
} }
void operator delete[] (void *ptr) void operator delete[](void *ptr)
{ {
return rt_free(ptr); return rt_free(ptr);
} }

View File

@ -18,7 +18,7 @@ void *operator new(size_t size);
void *operator new[](size_t size); void *operator new[](size_t size);
void operator delete(void * ptr); void operator delete(void * ptr);
void operator delete[] (void *ptr); void operator delete[](void *ptr);
extern "C" void __cxa_pure_virtual(void); extern "C" void __cxa_pure_virtual(void);
extern "C" int cplusplus_system_init(void); extern "C" int cplusplus_system_init(void);

View File

@ -50,11 +50,11 @@ RT_WEAK int cplusplus_system_init(void)
for (; base != lim; base++) for (; base != lim; base++)
{ {
PROC *proc = (PROC*)((const char*)base + *base); PROC *proc = (PROC *)((const char *)base + *base);
(*proc)(); (*proc)();
} }
#elif defined(__GNUC__) #elif defined(__GNUC__)
typedef void(*pfunc) (); typedef void(*pfunc)();
extern pfunc __ctors_start__[]; extern pfunc __ctors_start__[];
extern pfunc __ctors_end__[]; extern pfunc __ctors_end__[];
pfunc *p; pfunc *p;