mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 04:33:35 +08:00
libuavcan now compiles warning-free with -Wundef
This commit is contained in:
@@ -42,7 +42,7 @@ include_directories(${DSDLC_OUTPUT})
|
|||||||
# Compiler flags
|
# Compiler flags
|
||||||
#
|
#
|
||||||
if (COMPILER_IS_GCC_COMPATIBLE)
|
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)
|
if (USE_CPP03)
|
||||||
message(STATUS "Using C++03")
|
message(STATUS "Using C++03")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03 -Wno-variadic-macros -Wno-long-long")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03 -Wno-variadic-macros -Wno-long-long")
|
||||||
|
|||||||
@@ -37,13 +37,21 @@
|
|||||||
# endif
|
# endif
|
||||||
#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.
|
* 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.
|
* 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.
|
* If the autodetection fails, exceptions will be disabled by default.
|
||||||
*/
|
*/
|
||||||
#ifndef UAVCAN_EXCEPTIONS
|
#ifndef UAVCAN_EXCEPTIONS
|
||||||
# if __EXCEPTIONS || _HAS_EXCEPTIONS
|
# if defined(__EXCEPTIONS) || defined(_HAS_EXCEPTIONS)
|
||||||
# define UAVCAN_EXCEPTIONS 1
|
# define UAVCAN_EXCEPTIONS 1
|
||||||
# else
|
# else
|
||||||
# define UAVCAN_EXCEPTIONS 0
|
# define UAVCAN_EXCEPTIONS 0
|
||||||
@@ -89,7 +97,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef UAVCAN_TOSTRING
|
#ifndef UAVCAN_TOSTRING
|
||||||
// Objective is to make sure that we're NOT on a resource constrained platform
|
// 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
|
# define UAVCAN_TOSTRING 1
|
||||||
# else
|
# else
|
||||||
# define UAVCAN_TOSTRING 0
|
# define UAVCAN_TOSTRING 0
|
||||||
@@ -116,6 +124,9 @@
|
|||||||
* Disabled completely if UAVCAN_NO_ASSERTIONS is defined.
|
* Disabled completely if UAVCAN_NO_ASSERTIONS is defined.
|
||||||
*/
|
*/
|
||||||
#ifndef UAVCAN_ASSERT
|
#ifndef UAVCAN_ASSERT
|
||||||
|
# ifndef UAVCAN_NO_ASSERTIONS
|
||||||
|
# define UAVCAN_NO_ASSERTIONS 0
|
||||||
|
# endif
|
||||||
# if UAVCAN_NO_ASSERTIONS
|
# if UAVCAN_NO_ASSERTIONS
|
||||||
# define UAVCAN_ASSERT(x)
|
# define UAVCAN_ASSERT(x)
|
||||||
# else
|
# 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
|
* Note that the pool block size shall be aligned at biggest alignment of the target platform (detected and
|
||||||
* checked automatically at compile time).
|
* checked automatically at compile time).
|
||||||
*/
|
*/
|
||||||
#if UAVCAN_MEM_POOL_BLOCK_SIZE
|
#ifdef UAVCAN_MEM_POOL_BLOCK_SIZE
|
||||||
/// Explicitly specified by the user.
|
/// Explicitly specified by the user.
|
||||||
static const unsigned MemPoolBlockSize = UAVCAN_MEM_POOL_BLOCK_SIZE;
|
static const unsigned MemPoolBlockSize = UAVCAN_MEM_POOL_BLOCK_SIZE;
|
||||||
#elif defined(__BIGGEST_ALIGNMENT__) && (__BIGGEST_ALIGNMENT__ <= 8)
|
#elif defined(__BIGGEST_ALIGNMENT__) && (__BIGGEST_ALIGNMENT__ <= 8)
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <uavcan/build_config.hpp>
|
||||||
|
|
||||||
#if UAVCAN_DEBUG
|
#if UAVCAN_DEBUG
|
||||||
|
|
||||||
# include <cstdio>
|
# include <cstdio>
|
||||||
|
|||||||
Reference in New Issue
Block a user