File tree 4 files changed +6
-6
lines changed
4 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -22,11 +22,11 @@ extern "C"
22
22
{
23
23
#endif
24
24
25
- #ifndef _WIN32
25
+ #ifndef _MSC_VER
26
26
/// A macro to make the compiler warn when the return value of a function is not used.
27
27
#define RCUTILS_WARN_UNUSED __attribute__((warn_unused_result))
28
28
#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.
30
30
#define RCUTILS_WARN_UNUSED _Check_return_
31
31
#endif
32
32
Original file line number Diff line number Diff line change 27
27
# endif
28
28
#endif
29
29
30
- #if !defined(_WIN32 )
30
+ #if !defined(_WIN32 ) || defined( __MINGW64__ )
31
31
32
32
// The my__has_feature avoids a preprocessor error when you check for it and
33
33
// 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)
60
60
61
61
#if defined __APPLE__ || defined __FreeBSD__ || (defined __ANDROID__ && __ANDROID_API__ >= 21 )
62
62
const char * appname = getprogname ();
63
- #elif defined __GNUC__ && !defined(__QNXNTO__ ) && !defined(__OHOS__ )
63
+ #elif ( defined __GNUC__ && !defined( __MINGW64__ )) && !defined(__QNXNTO__ ) && !defined(__OHOS__ )
64
64
const char * appname = program_invocation_name ;
65
65
#elif defined _WIN32 || defined __CYGWIN__
66
66
char appname [MAX_PATH ];
@@ -85,7 +85,7 @@ char * rcutils_get_executable_name(rcutils_allocator_t allocator)
85
85
}
86
86
87
87
// 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__ ))
89
89
// We need an intermediate copy because basename may modify its arguments
90
90
char * intermediate = rcutils_strdup (appname , allocator );
91
91
if (NULL == intermediate ) {
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ TEST(TestProcess, test_get_executable_name) {
33
33
EXPECT_STREQ (NULL , rcutils_get_executable_name (time_bomb_allocator));
34
34
35
35
// 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__))
37
37
set_time_bomb_allocator_malloc_count (time_bomb_allocator, 1 );
38
38
EXPECT_STREQ (NULL , rcutils_get_executable_name (time_bomb_allocator));
39
39
#endif
You can’t perform that action at this time.
0 commit comments