diff --git a/src/unity_internals.h b/src/unity_internals.h index 2c7180b..0f4c90a 100644 --- a/src/unity_internals.h +++ b/src/unity_internals.h @@ -15,6 +15,9 @@ #ifdef UNITY_USE_LIMITS_H #include #endif +#ifdef UNITY_USE_STDINT_H +#include +#endif //------------------------------------------------------- // Int Support @@ -108,7 +111,10 @@ typedef _UU64 _U_UINT; typedef _US64 _U_SINT; #endif - + +#ifndef UINTPTR_MAX +#error "OH SHITSTICKS!" +#endif //------------------------------------------------------- // Pointer Support //------------------------------------------------------- @@ -117,19 +123,29 @@ typedef _US64 _U_SINT; // We first try to guess based on INTPTR_MAX (if it exists) // Otherwise we fall back on assuming 32-bit #ifndef UNITY_POINTER_WIDTH - #ifdef INTPTR_MAX - #if (INTPTR_MAX == 0xFFFF) + #ifdef UINTPTR_MAX + #if (UINTPTR_MAX <= 0xFFFF) #define UNITY_POINTER_WIDTH (16) - #elif (INTPTR_MAX == 0xFFFFFFFF) + #elif (UINTPTR_MAX <= 0xFFFFFFFF) #define UNITY_POINTER_WIDTH (32) - #elif (INTPTR_MAX == 0xFFFFFFFFFFFFFFFF) + #elif (UINTPTR_MAX <= 0xFFFFFFFFFFFFFFFF) #define UNITY_POINTER_WIDTH (64) - #else - #define UNITY_POINTER_WIDTH (32) #endif - #else - #define UNITY_POINTER_WIDTH (32) - #endif + #endif +#endif +#ifndef UNITY_POINTER_WIDTH + #ifdef INTPTR_MAX + #if (INTPTR_MAX <= 0x7FFF) + #define UNITY_POINTER_WIDTH (16) + #elif (INTPTR_MAX <= 0x7FFFFFFF) + #define UNITY_POINTER_WIDTH (32) + #elif (INTPTR_MAX <= 0x7FFFFFFFFFFFFFFF) + #define UNITY_POINTER_WIDTH (64) + #endif + #endif +#endif +#ifndef UNITY_POINTER_WIDTH + #define UNITY_POINTER_WIDTH (32) #endif #if (UNITY_POINTER_WIDTH == 32) diff --git a/targets/gcc.yml b/targets/gcc.yml index f3072e0..fc3841b 100644 --- a/targets/gcc.yml +++ b/targets/gcc.yml @@ -20,7 +20,8 @@ compiler: items: - UNITY_SUPPORT_64 - UNITY_INCLUDE_DOUBLE - - UNITY_SUPPORT_TEST_CASES + - UNITY_SUPPORT_TEST_CASES + - UNITY_USE_STDINT_H object_files: prefix: '-o' extension: '.o' diff --git a/targets/gcc_64.yml b/targets/gcc_64.yml deleted file mode 100644 index eb7886f..0000000 --- a/targets/gcc_64.yml +++ /dev/null @@ -1,44 +0,0 @@ -compiler: - path: gcc - source_path: 'src/' - unit_tests_path: &unit_tests_path 'test/' - build_path: &build_path 'build/' - options: - - '-c' - - '-Wall' - - '-Wno-address' - - '-std=c99' - - '-pedantic' - includes: - prefix: '-I' - items: - - 'src/' - - '../src/' - - *unit_tests_path - defines: - prefix: '-D' - items: - - UNITY_SUPPORT_64 - - UNITY_INCLUDE_DOUBLE - - UNITY_SUPPORT_TEST_CASES - - 'UNITY_POINTER_WIDTH=64' - object_files: - prefix: '-o' - extension: '.o' - destination: *build_path -linker: - path: gcc - options: - - -lm - includes: - prefix: '-I' - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.exe' - destination: *build_path -colour: true -:unity: - :plugins: [] \ No newline at end of file