diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2020-07-21 15:38:08 +0100 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2020-07-22 18:05:32 +0100 |
commit | 8c419a91d761989b824d1bbe3b4575068317181e (patch) | |
tree | c5876fb9131c7d553ea9503b862906533899c957 /libctf/ctf-create.c | |
parent | 734c894234e800c924d97ae69d4774c9b00797dd (diff) | |
download | gdb-8c419a91d761989b824d1bbe3b4575068317181e.zip gdb-8c419a91d761989b824d1bbe3b4575068317181e.tar.gz gdb-8c419a91d761989b824d1bbe3b4575068317181e.tar.bz2 |
libctf: fixes for systems on which sizeof (void *) > sizeof (long)
Systems like mingw64 have pointers that can only be represented by 'long
long'. Consistently cast integers stored in pointers through uintptr_t
to cater for this.
libctf/
* ctf-create.c (ctf_dtd_insert): Add uintptr_t casts.
(ctf_dtd_delete): Likewise.
(ctf_dtd_lookup): Likewise.
(ctf_rollback): Likewise.
* ctf-hash.c (ctf_hash_lookup_type): Likewise.
* ctf-types.c (ctf_lookup_by_rawhash): Likewise.
Diffstat (limited to 'libctf/ctf-create.c')
-rw-r--r-- | libctf/ctf-create.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/libctf/ctf-create.c b/libctf/ctf-create.c index 35c286c..ee87575 100644 --- a/libctf/ctf-create.c +++ b/libctf/ctf-create.c @@ -617,16 +617,19 @@ int ctf_dtd_insert (ctf_file_t *fp, ctf_dtdef_t *dtd, int flag, int kind) { const char *name; - if (ctf_dynhash_insert (fp->ctf_dthash, (void *) dtd->dtd_type, dtd) < 0) + if (ctf_dynhash_insert (fp->ctf_dthash, (void *) (uintptr_t) dtd->dtd_type, + dtd) < 0) return -1; if (flag == CTF_ADD_ROOT && dtd->dtd_data.ctt_name && (name = ctf_strraw (fp, dtd->dtd_data.ctt_name)) != NULL) { if (ctf_dynhash_insert (ctf_name_table (fp, kind)->ctn_writable, - (char *) name, (void *) dtd->dtd_type) < 0) + (char *) name, (void *) (uintptr_t) + dtd->dtd_type) < 0) { - ctf_dynhash_remove (fp->ctf_dthash, (void *) dtd->dtd_type); + ctf_dynhash_remove (fp->ctf_dthash, (void *) (uintptr_t) + dtd->dtd_type); return -1; } } @@ -642,7 +645,7 @@ ctf_dtd_delete (ctf_file_t *fp, ctf_dtdef_t *dtd) int name_kind = kind; const char *name; - ctf_dynhash_remove (fp->ctf_dthash, (void *) dtd->dtd_type); + ctf_dynhash_remove (fp->ctf_dthash, (void *) (uintptr_t) dtd->dtd_type); switch (kind) { @@ -682,7 +685,8 @@ ctf_dtd_delete (ctf_file_t *fp, ctf_dtdef_t *dtd) ctf_dtdef_t * ctf_dtd_lookup (const ctf_file_t *fp, ctf_id_t type) { - return (ctf_dtdef_t *) ctf_dynhash_lookup (fp->ctf_dthash, (void *) type); + return (ctf_dtdef_t *) + ctf_dynhash_lookup (fp->ctf_dthash, (void *) (uintptr_t) type); } ctf_dtdef_t * @@ -794,7 +798,7 @@ ctf_rollback (ctf_file_t *fp, ctf_snapshot_id_t id) ctf_str_remove_ref (fp, name, &dtd->dtd_data.ctt_name); } - ctf_dynhash_remove (fp->ctf_dthash, (void *) dtd->dtd_type); + ctf_dynhash_remove (fp->ctf_dthash, (void *) (uintptr_t) dtd->dtd_type); ctf_dtd_delete (fp, dtd); } |