File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,11 +22,11 @@ extern "C"
2222{
2323#endif
2424
25- #ifndef _WIN32
25+ #ifndef _MSC_VER
2626/// A macro to make the compiler warn when the return value of a function is not used.
2727#define RCUTILS_WARN_UNUSED __attribute__((warn_unused_result))
2828#else
29- /// A macro to make the compiler warn when the return value of a function is not used.
29+ /// A macro to make the compiler (MSVC) warn when the return value of a function is not used.
3030#define RCUTILS_WARN_UNUSED _Check_return_
3131#endif
3232
Original file line number Diff line number Diff line change 2727# endif
2828#endif
2929
30- #if !defined(_WIN32 )
30+ #if !defined(_WIN32 ) || defined( __MINGW64__ )
3131
3232// The my__has_feature avoids a preprocessor error when you check for it and
3333// use it on the same line below.
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ char * rcutils_get_executable_name(rcutils_allocator_t allocator)
6060
6161#if defined __APPLE__ || defined __FreeBSD__ || (defined __ANDROID__ && __ANDROID_API__ >= 21 )
6262 const char * appname = getprogname ();
63- #elif defined __GNUC__ && !defined(__QNXNTO__ ) && !defined(__OHOS__ )
63+ #elif ( defined __GNUC__ && !defined( __MINGW64__ )) && !defined(__QNXNTO__ ) && !defined(__OHOS__ )
6464 const char * appname = program_invocation_name ;
6565#elif defined _WIN32 || defined __CYGWIN__
6666 char appname [MAX_PATH ];
@@ -85,7 +85,7 @@ char * rcutils_get_executable_name(rcutils_allocator_t allocator)
8585 }
8686
8787 // Get just the executable name (Unix may return the absolute path)
88- #if defined __APPLE__ || defined __FreeBSD__ || defined __GNUC__
88+ #if defined __APPLE__ || defined __FreeBSD__ || ( defined __GNUC__ && !defined( __MINGW64__ ))
8989 // We need an intermediate copy because basename may modify its arguments
9090 char * intermediate = rcutils_strdup (appname , allocator );
9191 if (NULL == intermediate ) {
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ TEST(TestProcess, test_get_executable_name) {
3333 EXPECT_STREQ (NULL , rcutils_get_executable_name (time_bomb_allocator));
3434
3535 // Allocating intermediate fails. This allocation doesn't happen on windows
36- #if defined __APPLE__ || defined __FreeBSD__ || defined __GNUC__
36+ #if defined __APPLE__ || defined __FreeBSD__ || ( defined __GNUC__ && !defined(__MINGW64__))
3737 set_time_bomb_allocator_malloc_count (time_bomb_allocator, 1 );
3838 EXPECT_STREQ (NULL , rcutils_get_executable_name (time_bomb_allocator));
3939#endif
You can’t perform that action at this time.
0 commit comments