-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compilation fixes for GCC 8.0.1 #9430
Conversation
px4_main_t is defined as: typedef int (*px4_main_t)(int argc, char *argv[]); which matches with the definition in NuttX, given to task_create
for GCC 8.0.1
-Wno-extra-semi is not valid for C code
compiler warning: ../../src/systemcmds/tests/test_mixer.cpp: In member function ‘bool MixerTest::loadAllTest()’: ../../src/systemcmds/tests/test_mixer.cpp:202:18: error: ‘char* strncpy(char*, const char*, size_t)’ output truncated before terminating nul copying 1 byte from a string of the same length [-Werror=stringop-truncation] (void)strncpy(&buf[strlen(MIXER_ONBOARD_PATH)], "/", 1);
… numerical inaccuracies Happend in SITL.
With GCC 8.1.0, I have another error:
which I fixed with |
@jlecoeur I got this one as well, but have not come around to create a PR for that. My mavlink diff: diff --git a/mavlink_helpers.h b/mavlink_helpers.h
index 77c848d5..6dbfe833 100644
--- a/mavlink_helpers.h
+++ b/mavlink_helpers.h
@@ -107,6 +107,10 @@ MAVLINK_HELPER uint8_t _mav_trim_payload(const char *payload, uint8_t length)
/**
* @brief check a signature block for a packet
*/
+ union tstamp_u {
+ uint64_t t64;
+ uint8_t t8[8];
+ };
MAVLINK_HELPER bool mavlink_signature_check(mavlink_signing_t *signing,
mavlink_signing_streams_t *signing_streams,
const mavlink_message_t *msg)
@@ -133,10 +137,10 @@ MAVLINK_HELPER bool mavlink_signature_check(mavlink_signing_t *signing,
// now check timestamp
bool timestamp_checks = !(signing->flags & MAVLINK_SIGNING_FLAG_NO_TIMESTAMPS);
- union tstamp {
- uint64_t t64;
- uint8_t t8[8];
- } tstamp;
+ //../../mavlink/include/mavlink/v2.0/common/../mavlink_helpers.h: In function ‘bool mavlink_signature_check(mavlink_signing_t*, mavlink_signing_streams_t*, const mavlink_message_t*)’:
+ //../../mavlink/include/mavlink/v2.0/common/../mavlink_helpers.h:139:4: error: conflicting C language linkage declaration ‘mavlink_signature_check(mavlink_signing_t*, mavlink_signing_streams_t*, const mavlink_message_t*)::tstamp_u tstamp’ [-Werror]
+ // } tstamp;
+ union tstamp_u tstamp;
uint8_t link_id = psig[0];
tstamp.t64 = 0;
memcpy(tstamp.t8, psig+1, 6);
@@ -168,7 +172,7 @@ MAVLINK_HELPER bool mavlink_signature_check(mavlink_signing_t *signing,
signing_streams->stream[i].link_id = link_id;
signing_streams->num_signing_streams++;
} else {
- union tstamp last_tstamp;
+ union tstamp_u last_tstamp;
last_tstamp.t64 = 0;
memcpy(last_tstamp.t8, signing_streams->stream[i].timestamp_bytes, 6);
if (timestamp_checks && tstamp.t64 <= last_tstamp.t64) {
diff --git a/protocol.h b/protocol.h
index 8f539709..5c09761a 100644
--- a/protocol.h
+++ b/protocol.h
@@ -242,9 +242,14 @@ _MAV_PUT_ARRAY(int64_t, i64)
_MAV_PUT_ARRAY(float, f)
_MAV_PUT_ARRAY(double, d)
-#define _MAV_RETURN_char(msg, wire_offset) (const char)_MAV_PAYLOAD(msg)[wire_offset]
-#define _MAV_RETURN_int8_t(msg, wire_offset) (const int8_t)_MAV_PAYLOAD(msg)[wire_offset]
-#define _MAV_RETURN_uint8_t(msg, wire_offset) (const uint8_t)_MAV_PAYLOAD(msg)[wire_offset]
+/*
+../../mavlink/include/mavlink/v2.0/common/./mavlink_msg_heartbeat.h: In function ‘uint8_t mavlink_msg_heartbeat_get_type(const mavlink_message_t*)’:
+../../mavlink/include/mavlink/v2.0/common/../protocol.h:247:91: error: type qualifiers ignored on cast result type [-Werror=ignored-qualifiers]
+ #define _MAV_RETURN_uint8_t(msg, wire_offset) (const uint8_t)_MAV_PAYLOAD(msg)[wire_offset]
+ */
+#define _MAV_RETURN_char(msg, wire_offset) (char)_MAV_PAYLOAD(msg)[wire_offset]
+#define _MAV_RETURN_int8_t(msg, wire_offset) (int8_t)_MAV_PAYLOAD(msg)[wire_offset]
+#define _MAV_RETURN_uint8_t(msg, wire_offset) (uint8_t)_MAV_PAYLOAD(msg)[wire_offset]
#if MAVLINK_NEED_BYTE_SWAP
#define _MAV_MSG_RETURN_TYPE(TYPE, SIZE) \
The first one is a strange error:
for |
@bkueng no I had no error on |
Ok then I guess it's some GCC weirdness. |
Thanks @bkueng. I might not have updated recently. And I'm not currently using my Arch box. |
GCC 8.0.1 brings some new warnings. None of these is an important fix though.
@julianoes I'm surprised that you haven't hit these yet.