Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJozef Lawrynowicz <jozef.l@mittosystems.com>2020-09-02 17:50:07 +0300
committerCorinna Vinschen <corinna@vinschen.de>2020-09-03 13:55:32 +0300
commit754386c7f558a686420d4646c101706d9020f5d3 (patch)
tree2b40e3a34f5e8a414da75e1191bd67ed2d01d719 /newlib/libc/search
parenta634adda5af00c5936e3e7a5e2950c05c14981d3 (diff)
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.h2
-rw-r--r--newlib/libc/search/hcreate_r.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/newlib/libc/search/db_local.h b/newlib/libc/search/db_local.h
index ba8286657..8167953e8 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 8aba524ec..400a57f0c 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 */