mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-23 15:57:35 +08:00
Move __STDC_FORMAT_MACROS to build system
__STDC_FORMAT_MACROS changes the behavior of inttypes.h to allow defining format macros for printf-like functions. It needs to be defined before any include is done, otherwise due to include chains and header guards it may not take effect. Instead of having to define it everywhere it is used, move the define to the build system. Also update ecl and DriverFramework submodules to deal with the changed definitions.
This commit is contained in:
committed by
Lorenz Meier
parent
d2194d787f
commit
18330f7ab7
@@ -115,7 +115,6 @@ print("""
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifndef PRIu64
|
||||
|
||||
@@ -787,6 +787,7 @@ function(px4_add_common_flags)
|
||||
string(REPLACE "-" "_" board_config ${board_upper})
|
||||
set(added_definitions
|
||||
-DCONFIG_ARCH_BOARD_${board_config}
|
||||
-D__STDC_FORMAT_MACROS
|
||||
)
|
||||
|
||||
if (NOT (APPLE AND (${CMAKE_C_COMPILER_ID} MATCHES ".*Clang.*")))
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdbool.h>
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <px4_time.h>
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#ifndef I2C_FRAME_H_
|
||||
#define I2C_FRAME_H_
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
|
||||
typedef struct i2c_frame {
|
||||
|
||||
+1
-1
Submodule src/lib/DriverFramework updated: 7c468a60ae...ed8550b1ec
@@ -39,7 +39,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
|
||||
+1
-1
Submodule src/lib/ecl updated: a2d866520a...63b95a1738
@@ -33,7 +33,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
|
||||
#include <px4_config.h>
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -61,7 +61,6 @@ do {
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned char uint8_t;
|
||||
#else
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h> /* uint32_t */
|
||||
#endif
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
* Driver for the simulated barometric pressure sensor
|
||||
*/
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
#include <px4_config.h>
|
||||
#include <px4_defines.h>
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
* @author Mark Charlebois
|
||||
*/
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <px4_config.h>
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
#include <semaphore.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
#include <errno.h>
|
||||
#include "hrt_work.h"
|
||||
|
||||
@@ -118,7 +118,6 @@ static inline void do_nothing(int level, ...)
|
||||
|
||||
#else
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
/* includes when building for ros */
|
||||
#include "ros/ros.h"
|
||||
#include <list>
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
#include <type_traits>
|
||||
#else
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
* Tests for the bson en/decoder
|
||||
*/
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <px4_defines.h>
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <px4_config.h>
|
||||
|
||||
Reference in New Issue
Block a user