Skip to content

Commit ed697f8

Browse files
testfw, minor compilation fixes
1 parent fa1a416 commit ed697f8

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

testfw.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ before you include this file in *one* C/C++ file to create the implementation.
1515

1616
#define TESTFW_INIT() testfw_init()
1717
#define TESTFW_SUMMARY() testfw_summary( __FILE__, __func__, __LINE__ )
18-
#if defined( _WIN32 ) && !defined( TESTFW_NO_SEH ) && !defined( __TINYC__ )
18+
#if defined( _WIN32 ) && !defined( TESTFW_NO_SEH ) && !defined( __TINYC__ ) && !defined( __GNUC__ ) && !defined( __clang__ )
1919
#if defined __cplusplus
2020
extern "C" unsigned long __cdecl _exception_code(void);
2121
#else
@@ -40,7 +40,7 @@ void testfw_print_test_desc( void );
4040
void testfw_print_failure( char const* filename, int line );
4141
void testfw_assertion_count_inc( void );
4242
void testfw_current_test_assertion_failed( void );
43-
#if defined( _WIN32 ) && !defined( TESTFW_NO_SEH ) && !defined( __TINYC__ )
43+
#if defined( _WIN32 ) && !defined( TESTFW_NO_SEH ) && !defined( __TINYC__ ) && !defined( __GNUC__ ) && !defined( __clang__ )
4444
void testfw_exception( unsigned int exception_code );
4545
#endif
4646

@@ -56,7 +56,7 @@ void testfw_current_test_assertion_failed( void );
5656
#define _CRT_SECURE_NO_WARNINGS
5757
#include <string.h>
5858

59-
#if defined( _WIN32 ) && !defined( __TINYC__ )
59+
#if defined( _WIN32 ) && !defined( __TINYC__ ) && !defined( __GNUC__ ) && !defined( __clang__ )
6060
#pragma warning( push )
6161
#pragma warning( disable: 4619 ) // pragma warning : there is no warning number 'number'
6262
#pragma warning( disable: 4668 ) // 'symbol' is not defined as a preprocessor macro, replacing with '0'
@@ -164,7 +164,7 @@ static struct
164164
int assertions_total;
165165
int assertions_failed;
166166
struct testfw_internal_current_test_state_t current_test;
167-
#if defined( _WIN32 ) && defined( _DEBUG ) && !defined( __TINYC__ )
167+
#if defined( _WIN32 ) && defined( _DEBUG ) && !defined( __TINYC__ ) && !defined( __GNUC__ ) && !defined( __clang__ )
168168
int total_leaks;
169169
#endif
170170
} testfw_internal_state;
@@ -189,7 +189,7 @@ static void testfw_internal_print_progress_divider( char ch, int fail, int total
189189
}
190190

191191

192-
#if defined( _WIN32 ) && defined( _DEBUG ) && !defined( __TINYC__ )
192+
#if defined( _WIN32 ) && defined( _DEBUG ) && !defined( __TINYC__ ) && !defined( __GNUC__ ) && !defined( __clang__ )
193193

194194
static int testfw_internal_debug_report_hook( int report_type, char* message, int* return_value )
195195
{
@@ -245,15 +245,18 @@ static void testfw_internal_print_progress_divider( char ch, int fail, int total
245245

246246

247247
#if defined( _WIN32 )
248+
#pragma warning( push )
249+
#pragma warning( disable: 4668 )
248250
#include <windows.h>
251+
#pragma warning( pop )
249252
#endif
250253

251254

252255
void testfw_init( void )
253256
{
254257
memset( &testfw_internal_state, 0, sizeof( testfw_internal_state ) );
255258

256-
#if defined( _WIN32 )
259+
#if defined( _WIN32 ) && !defined( __GNUC__ ) && !defined( __clang__ )
257260
#if !defined( __TINYC__ )
258261
int flag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ); // Get current flag
259262
flag ^= _CRTDBG_LEAK_CHECK_DF; // Turn on leak-checking bit
@@ -343,7 +346,7 @@ int testfw_summary( char const* filename, char const* funcname, int line )
343346

344347
TESTFW_PRINTF( "\n\n" );
345348

346-
#if defined( _WIN32 ) && defined( _DEBUG ) && !defined( __TINYC__ )
349+
#if defined( _WIN32 ) && defined( _DEBUG ) && !defined( __TINYC__ ) && !defined( __GNUC__ ) && !defined( __clang__ )
347350
int result = _CrtDumpMemoryLeaks();
348351
testfw_internal_state.tests_failed += result ? 1 : 0;
349352
#endif
@@ -378,7 +381,7 @@ void testfw_test_end( char const* filename, char const* funcname, int line )
378381
}
379382

380383

381-
#if defined( _WIN32 ) && !defined( TESTFW_NO_SEH ) && !defined( __TINYC__ )
384+
#if defined( _WIN32 ) && !defined( TESTFW_NO_SEH ) && !defined( __TINYC__ ) && !defined( __GNUC__ ) && !defined( __clang__ )
382385
#pragma warning( push )
383386
#pragma warning( disable: 4668 )
384387
#include <windows.h>

0 commit comments

Comments
 (0)