Skip to content

Commit

Permalink
- further fixes to pointer auto-detect
Browse files Browse the repository at this point in the history
git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@139 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
  • Loading branch information
mvandervoord committed May 27, 2012
1 parent c1b954e commit dbdc603
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 55 deletions.
36 changes: 26 additions & 10 deletions src/unity_internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#ifdef UNITY_USE_LIMITS_H
#include <limits.h>
#endif
#ifdef UNITY_USE_STDINT_H
#include <stdint.h>
#endif

//-------------------------------------------------------
// Int Support
Expand Down Expand Up @@ -108,7 +111,10 @@ typedef _UU64 _U_UINT;
typedef _US64 _U_SINT;

#endif


#ifndef UINTPTR_MAX
#error "OH SHITSTICKS!"
#endif
//-------------------------------------------------------
// Pointer Support
//-------------------------------------------------------
Expand All @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion targets/gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
44 changes: 0 additions & 44 deletions targets/gcc_64.yml

This file was deleted.

0 comments on commit dbdc603

Please sign in to comment.