CARLA
 
载入中...
搜索中...
未找到
Platform.h
浏览该文件的文档.
1// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
7#pragma once // 防止头文件被重复包含
8// 检查是否使用Microsoft Visual C++编译器
9#if defined(_MSC_VER)
10 // 定义LIBCARLA_FORCEINLINE宏为__forceinline,用于强制内联函数
11# define LIBCARLA_FORCEINLINE __forceinline
12 // 定义LIBCARLA_NOINLINE宏为__declspec(noinline),用于禁止函数内联RCEINLINE __forceinline
13# define LIBCARLA_NOINLINE __declspec(noinline)
14
15
16 // 检查是否使用Clang或GCC编译器
17#elif defined(__clang__) || defined(__GNUC__)
18 // 如果定义了NDEBUG(即非调试模式),则定义LIBCARLA_FORCEINLINE宏为inline并添加always_inline属性
19# if defined(NDEBUG)
20# define LIBCARLA_FORCEINLINE inline __attribute__((always_inline))
21 // 否则,在非调试模式下,仅定义为inline
22# else
23# define LIBCARLA_FORCEINLINE inline
24# endif // NDEBUG
25# define LIBCARLA_NOINLINE __attribute__((noinline)) // 禁止内联
26#else
27# warning Compiler not supported. // 编译器不支持的警告
28# define LIBCARLA_NOINLINE // 定义LIBCARLA_NOINLINE为空
29#endif