diff options
author | Jozef Lawrynowicz <jozef.l@mittosystems.com> | 2020-09-02 15:50:07 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2020-09-03 12:55:32 +0200 |
commit | 754386c7f558a686420d4646c101706d9020f5d3 (patch) | |
tree | 2b40e3a34f5e8a414da75e1191bd67ed2d01d719 /newlib/libc/search | |
parent | a634adda5af00c5936e3e7a5e2950c05c14981d3 (diff) | |
download | newlib-754386c7f558a686420d4646c101706d9020f5d3.zip newlib-754386c7f558a686420d4646c101706d9020f5d3.tar.gz newlib-754386c7f558a686420d4646c101706d9020f5d3.tar.bz2 |
Fix warnings when building for msp430-elf
The MSP430 target supports both 16-bit and 20-bit size_t and intptr_t.
Some implicit casts in Newlib expect these types to be
"long", (a 32-bit type on MSP430) which causes warnings during
compilation such as:
"cast from pointer to integer of different size"
Diffstat (limited to 'newlib/libc/search')
-rw-r--r-- | newlib/libc/search/db_local.h | 2 | ||||
-rw-r--r-- | newlib/libc/search/hcreate_r.c | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/newlib/libc/search/db_local.h b/newlib/libc/search/db_local.h index ba82866..8167953 100644 --- a/newlib/libc/search/db_local.h +++ b/newlib/libc/search/db_local.h @@ -125,7 +125,7 @@ typedef struct { int lorder; /* byte order */ } BTREEINFO; -#define HASHMAGIC 0x061561 +#define HASHMAGIC 0x061561L #define HASHVERSION 2 /* Structure used to pass parameters to the hashing routines. */ diff --git a/newlib/libc/search/hcreate_r.c b/newlib/libc/search/hcreate_r.c index 8aba524..400a57f 100644 --- a/newlib/libc/search/hcreate_r.c +++ b/newlib/libc/search/hcreate_r.c @@ -72,7 +72,12 @@ SLIST_HEAD(internal_head, internal_entry); * max * sizeof internal_entry must fit into size_t. * assumes internal_entry is <= 32 (2^5) bytes. */ +#ifdef __MSP430X_LARGE__ +/* 20-bit size_t. */ +#define MAX_BUCKETS_LG2 (20 - 1 - 5) +#else #define MAX_BUCKETS_LG2 (sizeof (size_t) * 8 - 1 - 5) +#endif #define MAX_BUCKETS ((size_t)1 << MAX_BUCKETS_LG2) /* Default hash function, from db/hash/hash_func.c */ |