Merge pull request #12287 from maciejbocianski/fix_unittests_on_windows

Fix unittests on windows(mingw)
pull/12389/head
Martin Kojtal 2020-02-07 11:00:24 +00:00 committed by GitHub
commit e68915392b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 8 deletions

View File

@ -19,6 +19,13 @@ endmacro()
use_cxx14()
if (MINGW)
# enable PRIx formatting globally
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__STDC_FORMAT_MACROS")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_FORMAT_MACROS")
endif (MINGW)
####################
# GTEST
####################

View File

@ -23,13 +23,13 @@
namespace rtos {
class Semaphore {
public:
Semaphore(int32_t count = 0) {};
Semaphore(int32_t count, uint16_t max_count) {};
void acquire() {};
bool try_acquire() { return false; };
bool try_acquire_for(uint32_t millisec) { return false; };
bool try_acquire_until(uint64_t millisec) { return false; };
osStatus release(void) {return 0;};
Semaphore(int32_t count = 0);
Semaphore(int32_t count, uint16_t max_count);
void acquire();
bool try_acquire();
bool try_acquire_for(uint32_t millisec);
bool try_acquire_until(uint64_t millisec);
osStatus release(void);
};
}

View File

@ -35,7 +35,7 @@ extern "C" {
// Try to infer a platform if none was manually selected
#if !defined(EQUEUE_PLATFORM_POSIX) \
&& !defined(EQUEUE_PLATFORM_MBED)
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__MINGW32__) || defined(__MINGW64__)
#define EQUEUE_PLATFORM_POSIX
#elif defined(__MBED__)
#define EQUEUE_PLATFORM_MBED