Browse Source

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.
sbg
Lucas De Marchi 9 years ago committed by Lorenz Meier
parent
commit
18330f7ab7
  1. 1
      Tools/generate_listener.py
  2. 1
      cmake/common/px4_base.cmake
  3. 1
      src/drivers/drv_hrt.h
  4. 1
      src/drivers/px4flow/i2c_frame.h
  5. 2
      src/lib/DriverFramework
  6. 1
      src/lib/controllib/block/Block.hpp
  7. 2
      src/lib/ecl
  8. 1
      src/modules/px4iofirmware/protocol.h
  9. 1
      src/modules/systemlib/err.c
  10. 1
      src/modules/systemlib/uthash/uthash.h
  11. 1
      src/platforms/posix/drivers/barosim/baro.cpp
  12. 1
      src/platforms/posix/drivers/gpssim/gpssim.cpp
  13. 1
      src/platforms/posix/drivers/gyrosim/gyrosim.cpp
  14. 1
      src/platforms/posix/px4_layer/drv_hrt.c
  15. 1
      src/platforms/px4_log.h
  16. 1
      src/platforms/px4_nodehandle.h
  17. 1
      src/systemcmds/tests/test_bson.c
  18. 1
      src/systemcmds/tests/test_int.c

1
Tools/generate_listener.py

@ -115,7 +115,6 @@ print(""" @@ -115,7 +115,6 @@ print("""
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#ifndef PRIu64

1
cmake/common/px4_base.cmake

@ -787,6 +787,7 @@ function(px4_add_common_flags) @@ -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.*")))

1
src/drivers/drv_hrt.h

@ -41,7 +41,6 @@ @@ -41,7 +41,6 @@
#include <sys/types.h>
#include <stdbool.h>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <px4_time.h>

1
src/drivers/px4flow/i2c_frame.h

@ -41,7 +41,6 @@ @@ -41,7 +41,6 @@
#ifndef I2C_FRAME_H_
#define I2C_FRAME_H_
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
typedef struct i2c_frame {

2
src/lib/DriverFramework

@ -1 +1 @@ @@ -1 +1 @@
Subproject commit 7c468a60ae64726fb42989fe552feb21b7978289
Subproject commit ed8550b1ec4d8a71e3512bb6712e28e8f4d8a6cc

1
src/lib/controllib/block/Block.hpp

@ -39,7 +39,6 @@ @@ -39,7 +39,6 @@
#pragma once
#define __STDC_FORMAT_MACROS
#include <stdint.h>
#include <inttypes.h>

2
src/lib/ecl

@ -1 +1 @@ @@ -1 +1 @@
Subproject commit a2d866520a0477574d0ade68b0f5e7becb57431b
Subproject commit 63b95a17382bb4f930ac56ae2ddf6fdeb157ac73

1
src/modules/px4iofirmware/protocol.h

@ -33,7 +33,6 @@ @@ -33,7 +33,6 @@
#pragma once
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
/**

1
src/modules/systemlib/err.c

@ -40,7 +40,6 @@ @@ -40,7 +40,6 @@
#include <px4_config.h>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <stdlib.h>

1
src/modules/systemlib/uthash/uthash.h

@ -61,7 +61,6 @@ do { @@ -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

1
src/platforms/posix/drivers/barosim/baro.cpp

@ -36,7 +36,6 @@ @@ -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>

1
src/platforms/posix/drivers/gpssim/gpssim.cpp

@ -37,7 +37,6 @@ @@ -37,7 +37,6 @@
*/
#include <sys/types.h>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <stdio.h>
#include <stdbool.h>

1
src/platforms/posix/drivers/gyrosim/gyrosim.cpp

@ -41,7 +41,6 @@ @@ -41,7 +41,6 @@
* @author Mark Charlebois
*/
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <px4_config.h>

1
src/platforms/posix/px4_layer/drv_hrt.c

@ -45,7 +45,6 @@ @@ -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"

1
src/platforms/px4_log.h

@ -118,7 +118,6 @@ static inline void do_nothing(int level, ...) @@ -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>

1
src/platforms/px4_nodehandle.h

@ -48,7 +48,6 @@ @@ -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

1
src/systemcmds/tests/test_bson.c

@ -37,7 +37,6 @@ @@ -37,7 +37,6 @@
* Tests for the bson en/decoder
*/
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <px4_defines.h>

1
src/systemcmds/tests/test_int.c

@ -36,7 +36,6 @@ @@ -36,7 +36,6 @@
* Included Files
****************************************************************************/
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <px4_config.h>

Loading…
Cancel
Save