-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
Community: QuestionFurther information is requestedFurther information is requested
Description
Description
When I was trying to replace the NuttX version that PX4 depends on with 12.12, I encountered some compilation errors. Here is the specific compilation error:
PX4-Autopilot/src/modules/navigator/mission_base.cpp:76:60: error: no matching function for call to 'constrain(int32_t&, long long int, long int)'
76 | const int32_t start_index = `math::constrain`(_mission.current_seq, `INT32_C(0)`, int32_t(_mission.count) - 1);
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors
In this case, math::constrain is a template function that expects all arguments to be of a single type (which should be int32_t here). However, the type of INT32_C(0) is not int32_t.
I searched for INT32_C and found its definition in arch/xtensa/include/inttypes.h:
#define INT32_C(x) x ## ll
#define INT64_C(x) x ## ll This shows its definition is the same as INT64_C, both being long long int. But the _int32_t defined in xtensa is long int (in arch/xtensa/include/types.h). Is this a mistake?
Verification
- I have verified before submitting the report.
Metadata
Metadata
Assignees
Labels
Community: QuestionFurther information is requestedFurther information is requested