This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Patch: clang -vs- opcodes
- From: Tom Tromey <tromey at redhat dot com>
- To: Binutils Development <binutils at sourceware dot org>
- Date: Wed, 17 Oct 2012 12:41:51 -0600
- Subject: Patch: clang -vs- opcodes
I was trying to build gdb with clang on my Fedora 16 box and it was
unhappy with a file in opcodes:
libtool: compile: clang -DHAVE_CONFIG_H -I. -I../../archer/opcodes -I. -I../../archer/opcodes -I../bfd -I../../archer/opcodes/../include -I../../archer/opcodes/../bfd -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT tic54x-dis.lo -MD -MP -MF .deps/tic54x-dis.Tpo -c ../../archer/opcodes/tic54x-dis.c -o tic54x-dis.o
../../archer/opcodes/tic54x-dis.c:174:18: error: promoted type 'int' of K&R
function parameter is not compatible with the parameter type
'unsigned short' declared in a previous prototype [-Werror]
unsigned short opcode;
^
../../archer/opcodes/tic54x-dis.c:34:45: note: previous declaration is here
unsigned short, const char *,
^
../../archer/opcodes/tic54x-dis.c:475:18: error: promoted type 'int' of K&R
function parameter is not compatible with the parameter type
'unsigned short' declared in a previous prototype [-Werror]
unsigned short opcode;
^
../../archer/opcodes/tic54x-dis.c:37:54: note: previous declaration is here
unsigned short,
^
../../archer/opcodes/tic54x-dis.c:490:18: error: promoted type 'int' of K&R
function parameter is not compatible with the parameter type
'unsigned short' declared in a previous prototype [-Werror]
unsigned short code;
^
../../archer/opcodes/tic54x-dis.c:40:47: note: previous declaration is here
unsigned short);
^
../../archer/opcodes/tic54x-dis.c:505:18: error: promoted type 'int' of K&R
function parameter is not compatible with the parameter type
'unsigned short' declared in a previous prototype [-Werror]
unsigned short opcode;
^
../../archer/opcodes/tic54x-dis.c:42:51: note: previous declaration is here
unsigned short);
^
../../archer/opcodes/tic54x-dis.c:528:18: error: promoted type 'int' of K&R
function parameter is not compatible with the parameter type
'unsigned short' declared in a previous prototype [-Werror]
unsigned short opcode;
^
../../archer/opcodes/tic54x-dis.c:44:49: note: previous declaration is here
unsigned short);
^
../../archer/opcodes/tic54x-dis.c:558:18: error: promoted type 'int' of K&R
function parameter is not compatible with the parameter type
'unsigned short' declared in a previous prototype [-Werror]
unsigned short opcode;
^
../../archer/opcodes/tic54x-dis.c:47:64: note: previous declaration is here
static int sprint_cc2 (disassemble_info *,char *,unsigned short);
^
../../archer/opcodes/tic54x-dis.c:571:18: error: promoted type 'int' of K&R
function parameter is not compatible with the parameter type
'unsigned short' declared in a previous prototype [-Werror]
unsigned short opcode;
^
../../archer/opcodes/tic54x-dis.c:46:70: note: previous declaration is here
static int sprint_condition (disassemble_info *,char *,unsigned short);
^
7 errors generated.
I fixed this by changing tic54x-dis.c not to use the ancient K&R style.
Ok?
Tom
2012-10-17 Tom Tromey <tromey@redhat.com>
* tic54x-dis.c (print_instruction): Don't use K&R style.
(print_parallel_instruction, sprint_dual_address)
(sprint_indirect_address, sprint_direct_address, sprint_mmr)
(sprint_cc2, sprint_condition): Likewise.
diff --git a/opcodes/tic54x-dis.c b/opcodes/tic54x-dis.c
index ba33d5e..9811722 100644
--- a/opcodes/tic54x-dis.c
+++ b/opcodes/tic54x-dis.c
@@ -168,14 +168,13 @@ get_insn_size (unsigned short memdata, const insn_template *insn)
}
int
-print_instruction (info, memaddr, opcode, tm_name, tm_operands, size, ext)
- disassemble_info *info;
- bfd_vma memaddr;
- unsigned short opcode;
- const char *tm_name;
- const enum optype tm_operands[];
- int size;
- int ext;
+print_instruction (disassemble_info *info,
+ bfd_vma memaddr,
+ unsigned short opcode,
+ const char *tm_name,
+ const enum optype tm_operands[],
+ int size,
+ int ext)
{
static int n;
/* string storage for multiple operands */
@@ -469,12 +468,11 @@ print_instruction (info, memaddr, opcode, tm_name, tm_operands, size, ext)
}
static int
-print_parallel_instruction (info, memaddr, opcode, ptm, size)
- disassemble_info *info;
- bfd_vma memaddr;
- unsigned short opcode;
- const insn_template *ptm;
- int size;
+print_parallel_instruction (disassemble_info *info,
+ bfd_vma memaddr,
+ unsigned short opcode,
+ const insn_template *ptm,
+ int size)
{
print_instruction (info, memaddr, opcode,
ptm->name, ptm->operand_types, size, 0);
@@ -484,10 +482,9 @@ print_parallel_instruction (info, memaddr, opcode, ptm, size)
}
static int
-sprint_dual_address (info, buf, code)
- disassemble_info *info ATTRIBUTE_UNUSED;
- char buf[];
- unsigned short code;
+sprint_dual_address (disassemble_info *info ATTRIBUTE_UNUSED,
+ char buf[],
+ unsigned short code)
{
const char *formats[] = {
"*ar%d",
@@ -499,10 +496,9 @@ sprint_dual_address (info, buf, code)
}
static int
-sprint_indirect_address (info, buf, opcode)
- disassemble_info *info ATTRIBUTE_UNUSED;
- char buf[];
- unsigned short opcode;
+sprint_indirect_address (disassemble_info *info ATTRIBUTE_UNUSED,
+ char buf[],
+ unsigned short opcode)
{
const char *formats[] = {
"*ar%d",
@@ -522,20 +518,18 @@ sprint_indirect_address (info, buf, opcode)
}
static int
-sprint_direct_address (info, buf, opcode)
- disassemble_info *info ATTRIBUTE_UNUSED;
- char buf[];
- unsigned short opcode;
+sprint_direct_address (disassemble_info *info ATTRIBUTE_UNUSED,
+ char buf[],
+ unsigned short opcode)
{
/* FIXME -- look up relocation if available */
return sprintf (buf, "DP+0x%02x", (int) (opcode & 0x7F));
}
static int
-sprint_mmr (info, buf, mmr)
- disassemble_info *info ATTRIBUTE_UNUSED;
- char buf[];
- int mmr;
+sprint_mmr (disassemble_info *info ATTRIBUTE_UNUSED,
+ char buf[],
+ int mmr)
{
symbol *reg = (symbol *) mmregs;
while (reg->name != NULL)
@@ -552,10 +546,9 @@ sprint_mmr (info, buf, mmr)
}
static int
-sprint_cc2 (info, buf, opcode)
- disassemble_info *info ATTRIBUTE_UNUSED;
- char *buf;
- unsigned short opcode;
+sprint_cc2 (disassemble_info *info ATTRIBUTE_UNUSED,
+ char *buf,
+ unsigned short opcode)
{
const char *cc2[] = {
"??", "??", "ageq", "alt", "aneq", "aeq", "agt", "aleq",
@@ -565,10 +558,9 @@ sprint_cc2 (info, buf, opcode)
}
static int
-sprint_condition (info, buf, opcode)
- disassemble_info *info ATTRIBUTE_UNUSED;
- char *buf;
- unsigned short opcode;
+sprint_condition (disassemble_info *info ATTRIBUTE_UNUSED,
+ char *buf,
+ unsigned short opcode)
{
char *start = buf;
const char *cmp[] = {