Skip to content

Commit 4bc384c

Browse files
Fix __attribute__ (#941) (#942)
* Fix __attribute__ Signed-off-by: Pablo Garrido <[email protected]> * Update Signed-off-by: Pablo Garrido <[email protected]> (cherry picked from commit 2ef596b) Co-authored-by: Pablo Garrido <[email protected]>
1 parent 3df8bba commit 4bc384c

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/micro_ros_arduino.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
#ifndef MICRO_ROS_ARDUINO
33
#define MICRO_ROS_ARDUINO
44

5-
// ---- Build fixes -----
6-
//Removing __attribute__ not supported by gcc-arm-none-eabi-5_4
7-
#define __attribute__(x)
8-
95
#ifdef ARDUINO_SAMD_ZERO
106
// Avoid macro usage in https://github.com/eProsima/Micro-XRCE-DDS-Client/blob/66df0a6df20063d246dd638ac3d33eb2e652fab2/include/uxr/client/core/session/session.h#L97
117
// beacuse of https://github.com/arduino/ArduinoCore-samd/blob/0b60a79c4b194ed2e76fead95caf1bbce8960049/cores/arduino/sync.h#L28
@@ -14,8 +10,20 @@
1410
// ----------------------
1511

1612
#include <uxr/client/transport.h>
13+
14+
// In GNU C < 6.0.0 __attribute__((deprecated(msg))) is not supported for enums, used in rmw/types.h
15+
#if __GNUC__ < 6
16+
#define aux__attribute__(x) __attribute__(x)
17+
#define __attribute__(x)
18+
#endif
19+
1720
#include <rmw_microros/rmw_microros.h>
1821

22+
#if __GNUC__ < 6
23+
#undef __attribute__
24+
#define __attribute__(x) aux__attribute__(x)
25+
#endif
26+
1927
extern "C" bool arduino_transport_open(struct uxrCustomTransport * transport);
2028
extern "C" bool arduino_transport_close(struct uxrCustomTransport * transport);
2129
extern "C" size_t arduino_transport_write(struct uxrCustomTransport* transport, const uint8_t * buf, size_t len, uint8_t * err);
@@ -48,7 +56,7 @@ static inline void set_microros_transports(){
4856
#include <NativeEthernet.h>
4957
#endif
5058

51-
#if defined(TARGET_PORTENTA_H7_M7)
59+
#if defined(TARGET_PORTENTA_H7_M7)
5260
#include <PortentaEthernet.h>
5361
#endif
5462

0 commit comments

Comments
 (0)