diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2021-03-25 16:32:46 +0000 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2021-03-25 16:32:47 +0000 |
commit | 24c877f9b19dc38f9c40e25116175481c8bb78f2 (patch) | |
tree | 8fbbd508b009e36b690ff30176cf6df38f17534a /include/ctf.h | |
parent | 485170cdb1b634b550cf227f4642dcb38097b80c (diff) | |
download | gdb-24c877f9b19dc38f9c40e25116175481c8bb78f2.zip gdb-24c877f9b19dc38f9c40e25116175481c8bb78f2.tar.gz gdb-24c877f9b19dc38f9c40e25116175481c8bb78f2.tar.bz2 |
include: always do unsigned left-shift in CTF_SET_STID
This turns into a signed left shift by 31 bits, otherwise. This is an
offset and is always treated as unsigned in any case, so add an
appropriate cast.
include/ChangeLog
2021-03-25 Nick Alcock <nick.alcock@oracle.com>
PR libctf/27628
* ctf-api.h: Fix some indentation.
(CTF_SET_STID): Always do an unsigned shift, even if STID is
signed.
Diffstat (limited to 'include/ctf.h')
-rw-r--r-- | include/ctf.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/include/ctf.h b/include/ctf.h index 5060574..90631fc 100644 --- a/include/ctf.h +++ b/include/ctf.h @@ -358,9 +358,9 @@ union c.ctt_info = CTF_TYPE_INFO(kind, vlen); c.ctt_name = CTF_TYPE_NAME(stid, offset); */ -# define CTF_V1_INFO_KIND(info) (((info) & 0xf800) >> 11) -# define CTF_V1_INFO_ISROOT(info) (((info) & 0x0400) >> 10) -# define CTF_V1_INFO_VLEN(info) (((info) & CTF_MAX_VLEN_V1)) +#define CTF_V1_INFO_KIND(info) (((info) & 0xf800) >> 11) +#define CTF_V1_INFO_ISROOT(info) (((info) & 0x0400) >> 10) +#define CTF_V1_INFO_VLEN(info) (((info) & CTF_MAX_VLEN_V1)) #define CTF_V2_INFO_KIND(info) (((info) & 0xfc000000) >> 26) #define CTF_V2_INFO_ISROOT(info) (((info) & 0x2000000) >> 25) @@ -368,7 +368,7 @@ union #define CTF_NAME_STID(name) ((name) >> 31) #define CTF_NAME_OFFSET(name) ((name) & CTF_MAX_NAME) -#define CTF_SET_STID(name, stid) ((name) | (stid) << 31) +#define CTF_SET_STID(name, stid) ((name) | ((unsigned int) stid) << 31) /* V2 only. */ #define CTF_TYPE_INFO(kind, isroot, vlen) \ @@ -387,10 +387,10 @@ union #define CTF_V2_TYPE_TO_INDEX(id) ((id) & CTF_MAX_PTYPE) #define CTF_V2_INDEX_TO_TYPE(id, child) ((child) ? ((id) | (CTF_MAX_PTYPE+1)) : (id)) -# define CTF_V1_TYPE_ISPARENT(fp, id) ((id) <= CTF_MAX_PTYPE_V1) -# define CTF_V1_TYPE_ISCHILD(fp, id) ((id) > CTF_MAX_PTYPE_V1) -# define CTF_V1_TYPE_TO_INDEX(id) ((id) & CTF_MAX_PTYPE_V1) -# define CTF_V1_INDEX_TO_TYPE(id, child) ((child) ? ((id) | (CTF_MAX_PTYPE_V1+1)) : (id)) +#define CTF_V1_TYPE_ISPARENT(fp, id) ((id) <= CTF_MAX_PTYPE_V1) +#define CTF_V1_TYPE_ISCHILD(fp, id) ((id) > CTF_MAX_PTYPE_V1) +#define CTF_V1_TYPE_TO_INDEX(id) ((id) & CTF_MAX_PTYPE_V1) +#define CTF_V1_INDEX_TO_TYPE(id, child) ((child) ? ((id) | (CTF_MAX_PTYPE_V1+1)) : (id)) /* Valid for both V1 and V2. */ #define CTF_TYPE_LSIZE(cttp) \ |