mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-30 19:44:06 +08:00
libuavcan now compiles warning-free with -Wundef
This commit is contained in:
parent
7d23c7be80
commit
6ea66c045c
@ -42,7 +42,7 @@ include_directories(${DSDLC_OUTPUT})
|
||||
# Compiler flags
|
||||
#
|
||||
if (COMPILER_IS_GCC_COMPATIBLE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef")
|
||||
if (USE_CPP03)
|
||||
message(STATUS "Using C++03")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03 -Wno-variadic-macros -Wno-long-long")
|
||||
|
||||
@ -37,13 +37,21 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This macro enables built-in runtime checks and debug output via printf().
|
||||
* Should be used only for library development.
|
||||
*/
|
||||
#ifndef UAVCAN_DEBUG
|
||||
# define UAVCAN_DEBUG 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* UAVCAN can be explicitly told to ignore exceptions, or it can be detected automatically.
|
||||
* Autodetection is not expected to work with all compilers, so it's safer to define it explicitly.
|
||||
* If the autodetection fails, exceptions will be disabled by default.
|
||||
*/
|
||||
#ifndef UAVCAN_EXCEPTIONS
|
||||
# if __EXCEPTIONS || _HAS_EXCEPTIONS
|
||||
# if defined(__EXCEPTIONS) || defined(_HAS_EXCEPTIONS)
|
||||
# define UAVCAN_EXCEPTIONS 1
|
||||
# else
|
||||
# define UAVCAN_EXCEPTIONS 0
|
||||
@ -89,7 +97,7 @@
|
||||
*/
|
||||
#ifndef UAVCAN_TOSTRING
|
||||
// Objective is to make sure that we're NOT on a resource constrained platform
|
||||
# if __linux__ || __linux || __APPLE__ || _WIN64 || _WIN32
|
||||
# if defined(__linux__) || defined(__linux) || defined(__APPLE__) || defined(_WIN64) || defined(_WIN32)
|
||||
# define UAVCAN_TOSTRING 1
|
||||
# else
|
||||
# define UAVCAN_TOSTRING 0
|
||||
@ -116,6 +124,9 @@
|
||||
* Disabled completely if UAVCAN_NO_ASSERTIONS is defined.
|
||||
*/
|
||||
#ifndef UAVCAN_ASSERT
|
||||
# ifndef UAVCAN_NO_ASSERTIONS
|
||||
# define UAVCAN_NO_ASSERTIONS 0
|
||||
# endif
|
||||
# if UAVCAN_NO_ASSERTIONS
|
||||
# define UAVCAN_ASSERT(x)
|
||||
# else
|
||||
@ -139,7 +150,7 @@ namespace uavcan
|
||||
* Note that the pool block size shall be aligned at biggest alignment of the target platform (detected and
|
||||
* checked automatically at compile time).
|
||||
*/
|
||||
#if UAVCAN_MEM_POOL_BLOCK_SIZE
|
||||
#ifdef UAVCAN_MEM_POOL_BLOCK_SIZE
|
||||
/// Explicitly specified by the user.
|
||||
static const unsigned MemPoolBlockSize = UAVCAN_MEM_POOL_BLOCK_SIZE;
|
||||
#elif defined(__BIGGEST_ALIGNMENT__) && (__BIGGEST_ALIGNMENT__ <= 8)
|
||||
|
||||
@ -5,6 +5,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <uavcan/build_config.hpp>
|
||||
|
||||
#if UAVCAN_DEBUG
|
||||
|
||||
# include <cstdio>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user