Skip to content

Commit

Permalink
1. 修订ifndef-guard,不再使用保留字
Browse files Browse the repository at this point in the history
2. 移除过老编译器的支持,统一加#pragma once
  • Loading branch information
owent committed Oct 30, 2017
1 parent fc6b955 commit 029123a
Show file tree
Hide file tree
Showing 43 changed files with 258 additions and 284 deletions.
4 changes: 2 additions & 2 deletions include/libcopp/coroutine/coroutine_context.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _COPP_COROUTINE_CONTEXT_COROUTINE_CONTEXT_BASE_H_
#define _COPP_COROUTINE_CONTEXT_COROUTINE_CONTEXT_BASE_H_
#ifndef COPP_COROUTINE_CONTEXT_COROUTINE_CONTEXT_BASE_H
#define COPP_COROUTINE_CONTEXT_COROUTINE_CONTEXT_BASE_H

#pragma once

Expand Down
6 changes: 2 additions & 4 deletions include/libcopp/coroutine/coroutine_context_container.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/**
* coroutine context container
*/
#ifndef _COPP_COROUTINE_CONTEXT_COROUTINE_CONTEXT_CONTAINER_H_
#define _COPP_COROUTINE_CONTEXT_COROUTINE_CONTEXT_CONTAINER_H_
#ifndef COPP_COROUTINE_CONTEXT_COROUTINE_CONTEXT_CONTAINER_H
#define COPP_COROUTINE_CONTEXT_COROUTINE_CONTEXT_CONTAINER_H


#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

#include <cstddef>

Expand Down
4 changes: 2 additions & 2 deletions include/libcopp/stack/allocator/stack_allocator_malloc.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _COPP_STACKCONTEXT_ALLOCATOR_MALLOC_H_
#define _COPP_STACKCONTEXT_ALLOCATOR_MALLOC_H_
#ifndef COPP_STACKCONTEXT_ALLOCATOR_MALLOC_H
#define COPP_STACKCONTEXT_ALLOCATOR_MALLOC_H

#pragma once

Expand Down
4 changes: 2 additions & 2 deletions include/libcopp/stack/allocator/stack_allocator_memory.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _COPP_STACKCONTEXT_ALLOCATOR_MEMORY_H_
#define _COPP_STACKCONTEXT_ALLOCATOR_MEMORY_H_
#ifndef COPP_STACKCONTEXT_ALLOCATOR_MEMORY_H
#define COPP_STACKCONTEXT_ALLOCATOR_MEMORY_H

#pragma once

Expand Down
4 changes: 2 additions & 2 deletions include/libcopp/stack/allocator/stack_allocator_pool.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _COPP_STACKCONTEXT_ALLOCATOR_POOL_H_
#define _COPP_STACKCONTEXT_ALLOCATOR_POOL_H_
#ifndef COPP_STACKCONTEXT_ALLOCATOR_POOL_H
#define COPP_STACKCONTEXT_ALLOCATOR_POOL_H

#pragma once

Expand Down
4 changes: 2 additions & 2 deletions include/libcopp/stack/allocator/stack_allocator_posix.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _COPP_STACKCONTEXT_ALLOCATOR_POSIX_H_
#define _COPP_STACKCONTEXT_ALLOCATOR_POSIX_H_
#ifndef COPP_STACKCONTEXT_ALLOCATOR_POSIX_H
#define COPP_STACKCONTEXT_ALLOCATOR_POSIX_H

#pragma once

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _COPP_STACKCONTEXT_ALLOCATOR_SPLIT_SEGMENT_H_
#define _COPP_STACKCONTEXT_ALLOCATOR_SPLIT_SEGMENT_H_
#ifndef COPP_STACKCONTEXT_ALLOCATOR_SPLIT_SEGMENT_H
#define COPP_STACKCONTEXT_ALLOCATOR_SPLIT_SEGMENT_H

#pragma once

Expand Down
4 changes: 2 additions & 2 deletions include/libcopp/stack/allocator/stack_allocator_windows.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _COPP_STACKCONTEXT_ALLOCATOR_WINDOWS_H_
#define _COPP_STACKCONTEXT_ALLOCATOR_WINDOWS_H_
#ifndef COPP_STACKCONTEXT_ALLOCATOR_WINDOWS_H
#define COPP_STACKCONTEXT_ALLOCATOR_WINDOWS_H

#pragma once

Expand Down
6 changes: 4 additions & 2 deletions include/libcopp/stack/stack_allocator.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef _COPP_STACKCONTEXT_STACK_ALLOCATOR_H_
#define _COPP_STACKCONTEXT_STACK_ALLOCATOR_H_
#ifndef COPP_STACKCONTEXT_STACK_ALLOCATOR_H
#define COPP_STACKCONTEXT_STACK_ALLOCATOR_H


#pragma once

#include <libcopp/utils/features.h>

#include "allocator/stack_allocator_malloc.h"
Expand Down
6 changes: 2 additions & 4 deletions include/libcopp/stack/stack_context.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#ifndef _COPP_STACKCONTEXT_STACKCONTEXT_H_
#define _COPP_STACKCONTEXT_STACKCONTEXT_H_
#ifndef COPP_STACKCONTEXT_STACKCONTEXT_H
#define COPP_STACKCONTEXT_STACKCONTEXT_H


#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif

#include <cstddef>

Expand Down
4 changes: 2 additions & 2 deletions include/libcopp/stack/stack_pool.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _COPP_STACKCONTEXT_STACK_POOL_H_
#define _COPP_STACKCONTEXT_STACK_POOL_H_
#ifndef COPP_STACKCONTEXT_STACK_POOL_H
#define COPP_STACKCONTEXT_STACK_POOL_H

#pragma once

Expand Down
2 changes: 0 additions & 2 deletions include/libcopp/stack/stack_traits.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#ifndef _COPP_STACKCONTEXT_STACK_TRAITS_H
#define _COPP_STACKCONTEXT_STACK_TRAITS_H

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif

#include <cstddef>
#include <libcopp/utils/features.h>
Expand Down
4 changes: 2 additions & 2 deletions include/libcopp/utils/atomic_int_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
* 2016-06-14
*/

#ifndef _UTIL_LOCK_ATOMIC_INT_TYPE_H_
#define _UTIL_LOCK_ATOMIC_INT_TYPE_H_
#ifndef UTIL_LOCK_ATOMIC_INT_TYPE_H
#define UTIL_LOCK_ATOMIC_INT_TYPE_H

#pragma once

Expand Down
4 changes: 2 additions & 2 deletions include/libcopp/utils/atomic_int_type_msvc_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* @history
* 2016-06-14
*/
#ifndef _UTIL_LOCK_ATOMIC_INT_TYPE_MSVC_IMPL_H_
#define _UTIL_LOCK_ATOMIC_INT_TYPE_MSVC_IMPL_H_
#ifndef UTIL_LOCK_ATOMIC_INT_TYPE_MSVC_IMPL_H
#define UTIL_LOCK_ATOMIC_INT_TYPE_MSVC_IMPL_H

#pragma once

Expand Down
2 changes: 2 additions & 0 deletions include/libcopp/utils/config/compiler_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,8 @@
# else
# define UTIL_CONFIG_STATIC_ASSERT_JOIN(X, Y) UTIL_CONFIG_STATIC_ASSERT_JOIN_IMPL(X, Y)
# define UTIL_CONFIG_STATIC_ASSERT_JOIN_IMPL(X, Y) X##Y
#pragma once

template<bool> struct UTIL_CONFIGStaticAssert;
template<> struct UTIL_CONFIGStaticAssert<true>{};
# define UTIL_CONFIG_STATIC_ASSERT(X) enum { UTIL_CONFIG_STATIC_ASSERT_JOIN(UTIL_CONFIGStaticAssertEnum, __LINE__) = sizeof(UTIL_CONFIGStaticAssert<X>) }
Expand Down
6 changes: 2 additions & 4 deletions include/libcopp/utils/errno.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#ifndef _COPP_UTILS_ERRNO_H_
#define _COPP_UTILS_ERRNO_H_
#ifndef COPP_UTILS_ERRNO_H
#define COPP_UTILS_ERRNO_H


#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

namespace copp {
/**
Expand Down
6 changes: 2 additions & 4 deletions include/libcopp/utils/features.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// cmake template file

#ifndef _COPP_UTILS_FEATURES_H_
#define _COPP_UTILS_FEATURES_H_
#ifndef COPP_UTILS_FEATURES_H
#define COPP_UTILS_FEATURES_H


#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

#include <libcopp/utils/config/compiler_features.h>

Expand Down
4 changes: 2 additions & 2 deletions include/libcopp/utils/lock_holder.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
* @history
*/

#ifndef _UTIL_LOCK_LOCK_HOLDER_H_
#define _UTIL_LOCK_LOCK_HOLDER_H_
#ifndef UTIL_LOCK_LOCK_HOLDER_H
#define UTIL_LOCK_LOCK_HOLDER_H

#pragma once

Expand Down
6 changes: 4 additions & 2 deletions include/libcopp/utils/non_copyable.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
* Released under the MIT license
*/

#ifndef _COPP_UTILS_NON_COPYABLE_H_
#define _COPP_UTILS_NON_COPYABLE_H_
#ifndef COPP_UTILS_NON_COPYABLE_H
#define COPP_UTILS_NON_COPYABLE_H

#pragma once

#include "libcopp/utils/config/compiler_features.h"

Expand Down
6 changes: 2 additions & 4 deletions include/libcopp/utils/spin_lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@
* 1. using atomic_int_type
*/

#ifndef _UTIL_LOCK_SPINLOCK_H_
#define _UTIL_LOCK_SPINLOCK_H_
#ifndef UTIL_LOCK_SPINLOCK_H
#define UTIL_LOCK_SPINLOCK_H

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

#include "atomic_int_type.h"

Expand Down
6 changes: 2 additions & 4 deletions include/libcopp/utils/std/decltype.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@
*
*/

#ifndef _STD_DECLTYPE_H_
#define _STD_DECLTYPE_H_
#ifndef STD_DECLTYPE_H
#define STD_DECLTYPE_H


#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

#include <libcopp/utils/config/compiler_features.h>

Expand Down
6 changes: 2 additions & 4 deletions include/libcopp/utils/std/functional.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@
*
*/

#ifndef _STD_FUNCTIONAL_H_
#define _STD_FUNCTIONAL_H_
#ifndef STD_FUNCTIONAL_H
#define STD_FUNCTIONAL_H

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

// ============================================================
// 公共包含部分
Expand Down
4 changes: 2 additions & 2 deletions include/libcopp/utils/std/intrusive_ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
*
*/

#ifndef _STD_INTRUSIVE_PTR_H_
#define _STD_INTRUSIVE_PTR_H_
#ifndef STD_INTRUSIVE_PTR_H
#define STD_INTRUSIVE_PTR_H

#pragma once

Expand Down
4 changes: 2 additions & 2 deletions include/libcopp/utils/std/smart_ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
*
*/

#ifndef _STD_SMARTPTR_H_
#define _STD_SMARTPTR_H_
#ifndef STD_SMARTPTR_H
#define STD_SMARTPTR_H

#pragma once

Expand Down
6 changes: 4 additions & 2 deletions include/libcotask/core/standard_int_id_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
* Released under the MIT license
*/

#ifndef _COTASK_CORE_STANDARD_INT_ID_ALLOCATOR_H_
#define _COTASK_CORE_STANDARD_INT_ID_ALLOCATOR_H_
#ifndef COTASK_CORE_STANDARD_INT_ID_ALLOCATOR_H
#define COTASK_CORE_STANDARD_INT_ID_ALLOCATOR_H

#pragma once

#include <ctime>
#include <stdint.h>
Expand Down
6 changes: 4 additions & 2 deletions include/libcotask/core/standard_new_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
* Released under the MIT license
*/

#ifndef _COTASK_CORE_STANDARD_NEW_ALLOCATOR_H_
#define _COTASK_CORE_STANDARD_NEW_ALLOCATOR_H_
#ifndef COTASK_CORE_STANDARD_NEW_ALLOCATOR_H
#define COTASK_CORE_STANDARD_NEW_ALLOCATOR_H

#pragma once

#include <libcopp/utils/features.h>
#include <libcopp/utils/std/smart_ptr.h>

Expand Down
6 changes: 4 additions & 2 deletions include/libcotask/impl/id_allocator_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
* Released under the MIT license
*/

#ifndef _COTASK_IMPL_ID_ALLOCATOR_IMPL_H_
#define _COTASK_IMPL_ID_ALLOCATOR_IMPL_H_
#ifndef COTASK_IMPL_ID_ALLOCATOR_IMPL_H
#define COTASK_IMPL_ID_ALLOCATOR_IMPL_H

#pragma once

#include "libcopp/utils/config/compiler_features.h"

Expand Down
6 changes: 4 additions & 2 deletions include/libcotask/impl/task_action_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
* Released under the MIT license
*/

#ifndef _COTASK_IMPL_TASK_ACTION_IMPL_H_
#define _COTASK_IMPL_TASK_ACTION_IMPL_H_
#ifndef COTASK_IMPL_TASK_ACTION_IMPL_H
#define COTASK_IMPL_TASK_ACTION_IMPL_H
#pragma once

namespace cotask {

namespace impl {
Expand Down
6 changes: 4 additions & 2 deletions include/libcotask/impl/task_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
* Released under the MIT license
*/

#ifndef _COTASK_IMPL_TASK_IMPL_H_
#define _COTASK_IMPL_TASK_IMPL_H_
#ifndef COTASK_IMPL_TASK_IMPL_H
#define COTASK_IMPL_TASK_IMPL_H

#pragma once

#include <list>
#include <stdint.h>
Expand Down
6 changes: 4 additions & 2 deletions include/libcotask/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
* Released under the MIT license
*/

#ifndef _COTASK_TASK_H_
#define _COTASK_TASK_H_
#ifndef COTASK_TASK_H
#define COTASK_TASK_H

#pragma once

#include <algorithm>
#include <stdint.h>
Expand Down
6 changes: 4 additions & 2 deletions include/libcotask/task_actions.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
* Released under the MIT license
*/

#ifndef _COTASK_TASK_ACTIONS_H_
#define _COTASK_TASK_ACTIONS_H_
#ifndef COTASK_TASK_ACTIONS_H
#define COTASK_TASK_ACTIONS_H

#pragma once

#include <libcotask/impl/task_action_impl.h>

Expand Down
6 changes: 4 additions & 2 deletions include/libcotask/task_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
* Released under the MIT license
*/

#ifndef _COTASK_TASK_MACROS_H_
#define _COTASK_TASK_MACROS_H_
#ifndef COTASK_TASK_MACROS_H
#define COTASK_TASK_MACROS_H

#pragma once

#include <stdint.h>

Expand Down
6 changes: 4 additions & 2 deletions include/libcotask/task_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
* Released under the MIT license
*/

#ifndef _COTASK_TASK_MANAGER_H_
#define _COTASK_TASK_MANAGER_H_
#ifndef COTASK_TASK_MANAGER_H
#define COTASK_TASK_MANAGER_H

#pragma once

#include <algorithm>
#include <assert.h>
Expand Down
6 changes: 4 additions & 2 deletions include/libcotask/this_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
* Released under the MIT license
*/

#ifndef _COTASK_THIS_TASK_H_
#define _COTASK_THIS_TASK_H_
#ifndef COTASK_THIS_TASK_H
#define COTASK_THIS_TASK_H

#pragma once

#include <libcotask/impl/task_impl.h>

Expand Down
Loading

0 comments on commit 029123a

Please sign in to comment.