mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-07 17:35:22 +08:00
px4_log: reverted unused attribute annotations
Used a do_nothing() function for px4_omit() that will satisfy the compiler so it will not report unused variables when a debug message is compiled out. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
@@ -361,7 +361,7 @@ int commander_main(int argc, char *argv[])
|
||||
|
||||
if (!strcmp(argv[1], "check")) {
|
||||
int mavlink_fd_local = open(MAVLINK_LOG_DEVICE, 0);
|
||||
int checkres __attribute__ ((unused)) = prearm_check(&status, mavlink_fd_local);
|
||||
int checkres = prearm_check(&status, mavlink_fd_local);
|
||||
close(mavlink_fd_local);
|
||||
warnx("FINAL RESULT: %s", (checkres == 0) ? "OK" : "FAILED");
|
||||
return 0;
|
||||
|
||||
@@ -1936,8 +1936,8 @@ void sdlog2_status()
|
||||
} else {
|
||||
|
||||
float kibibytes = log_bytes_written / 1024.0f;
|
||||
float mebibytes __attribute__ ((unused)) = kibibytes / 1024.0f;
|
||||
float seconds __attribute__ ((unused)) = ((float)(hrt_absolute_time() - start_time)) / 1000000.0f;
|
||||
float mebibytes = kibibytes / 1024.0f;
|
||||
float seconds = ((float)(hrt_absolute_time() - start_time)) / 1000000.0f;
|
||||
|
||||
warnx("wrote %lu msgs, %4.2f MiB (average %5.3f KiB/s), skipped %lu msgs", log_msgs_written, (double)mebibytes, (double)(kibibytes / seconds), log_msgs_skipped);
|
||||
mavlink_log_info(mavlink_fd, "[sdlog2] wrote %lu msgs, skipped %lu msgs", log_msgs_written, log_msgs_skipped);
|
||||
|
||||
@@ -706,7 +706,7 @@ Sensors::parameters_update()
|
||||
warnx("WARNING WARNING WARNING\n\nRC CALIBRATION NOT SANE!\n\n");
|
||||
}
|
||||
|
||||
const char *paramerr __attribute__ ((unused)) = "FAIL PARM LOAD";
|
||||
const char *paramerr = "FAIL PARM LOAD";
|
||||
|
||||
/* channel mapping */
|
||||
if (param_get(_parameter_handles.rc_map_roll, &(_parameters.rc_map_roll)) != OK) {
|
||||
|
||||
@@ -58,6 +58,12 @@
|
||||
__BEGIN_DECLS
|
||||
__EXPORT extern uint64_t hrt_absolute_time(void);
|
||||
|
||||
// Used to silence unused variable warning
|
||||
static inline void do_nothing(int level, ...)
|
||||
{
|
||||
(void)level;
|
||||
}
|
||||
|
||||
#define _PX4_LOG_LEVEL_ALWAYS 0
|
||||
#define _PX4_LOG_LEVEL_PANIC 1
|
||||
#define _PX4_LOG_LEVEL_ERROR 2
|
||||
@@ -103,7 +109,7 @@ __EXPORT extern int __px4_log_level_current;
|
||||
* __px4_log_omit:
|
||||
* Compile out the message
|
||||
****************************************************************************/
|
||||
#define __px4_log_omit(level, FMT, ...) { }
|
||||
#define __px4_log_omit(level, FMT, ...) do_nothing(level, ##__VA_ARGS__)
|
||||
|
||||
/****************************************************************************
|
||||
* __px4_log:
|
||||
|
||||
Reference in New Issue
Block a user