Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH c++ 3/6] xtensa: Fix implicit enum conversions
Date: Mon, 12 Oct 2015 04:32:00 -0000	[thread overview]
Message-ID: <1444624329-4828-3-git-send-email-simon.marchi@polymtl.ca> (raw)
In-Reply-To: <1444624329-4828-1-git-send-email-simon.marchi@polymtl.ca>

XTREG is used with raw numbers, like:

...
  XTREG( 78,312,32, 4, 4,0x02d7,0x0007,-2, 2,0x1000,excsave7,    0,0,0,0,0,0)
  XTREG( 79,316, 8, 4, 4,0x02e0,0x0007,-2, 2,0x1000,cpenable,    0,0,0,0,0,0)
  XTREG( 80,320,22, 4, 4,0x02e2,0x000b,-2, 2,0x1000,interrupt,   0,0,0,0,0,0)
  XTREG( 81,324,22, 4, 4,0x02e2,0x000d,-2, 2,0x1000,intset,      0,0,0,0,0,0)
...

So just add the explicit cast to the macro.

In file included from /home/pedro/gdb/mygit/src/gdb/xtensa-config.c:25:0:
/home/pedro/gdb/mygit/src/gdb/xtensa-tdep.h:289:2: error: invalid conversion from ‘int’ to ‘call_abi_t’ [-fpermissive]
  }
  ^

gdb/ChangeLog:

	* xtensa-tdep.h (XTREG): Add casts.
	(XTREG_END): Likewise.
---
 gdb/xtensa-tdep.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gdb/xtensa-tdep.h b/gdb/xtensa-tdep.h
index fbf0e1d..275f40d 100644
--- a/gdb/xtensa-tdep.h
+++ b/gdb/xtensa-tdep.h
@@ -124,9 +124,13 @@ typedef struct
 
 /*  For xtensa-config.c to expand to the structure above.  */
 #define XTREG(index,ofs,bsz,sz,al,tnum,flg,cp,ty,gr,name,fet,sto,mas,ct,x,y) \
-	{#name, ofs, ty, ((gr) | ((xtRegisterGroupNCP >> 2) << (cp + 2))), \
+       {#name, ofs, (xtensa_register_type_t) (ty), \
+	((xtensa_register_group_t) \
+	 ((gr) | ((xtRegisterGroupNCP >> 2) << (cp + 2)))), \
 	 ct, bsz, sz, al, tnum, flg, cp, mas, fet, sto},
-#define XTREG_END {0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0},
+#define XTREG_END \
+  {0, 0, (xtensa_register_type_t) 0, (xtensa_register_group_t) 0,	\
+   0, 0, 0, 0, -1, 0, 0, 0, 0, 0},
 
 #define XTENSA_REGISTER_FLAGS_PRIVILEGED	0x0001
 #define XTENSA_REGISTER_FLAGS_READABLE		0x0002
-- 
2.6.1


  parent reply	other threads:[~2015-10-12  4:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12  4:32 [PATCH c++ 1/6] rs6000: Add cast for int to enum conversion Simon Marchi
2015-10-12  4:32 ` [PATCH c++ 2/6] solib-spu: Add gdb_byte* cast Simon Marchi
2015-10-22 13:39   ` Pedro Alves
2015-10-12  4:32 ` [PATCH c++ 6/6] aarch64: Add cast for integer to enum cast Simon Marchi
2015-10-12 10:06   ` Yao Qi
2015-10-12 16:26     ` Simon Marchi
2015-10-12  4:32 ` [PATCH c++ 4/6] gdb_bfd_lookup_symbol: Cast const char* arguments to void* Simon Marchi
2015-10-12 10:16   ` Yao Qi
2015-10-12 16:14     ` Simon Marchi
2015-10-13 16:09       ` Yao Qi
2015-10-13 16:44         ` Simon Marchi
2015-10-12  4:32 ` Simon Marchi [this message]
2015-10-22 13:39   ` [PATCH c++ 3/6] xtensa: Fix implicit enum conversions Pedro Alves
2015-10-12  4:37 ` [PATCH c++ 5/6] aarch64: Use gdb_sys_no_syscall enum instead of -1 Simon Marchi
2015-10-12 10:01   ` Yao Qi
2015-10-12 16:26     ` Simon Marchi
2015-10-22  9:59 ` [PATCH c++ 1/6] rs6000: Add cast for int to enum conversion Simon Marchi
2015-10-22 15:27   ` Simon Marchi
2015-10-22 13:39 ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444624329-4828-3-git-send-email-simon.marchi@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox