Skip to content

Commit

Permalink
Fix compilation warnings related to TriCore. (#2012)
Browse files Browse the repository at this point in the history
* fix tricore compiler warn `-Wmissing-prototypes`

* include cstool.h
  • Loading branch information
imbillow authored May 9, 2023
1 parent 3aff954 commit 5e2edea
Show file tree
Hide file tree
Showing 24 changed files with 54 additions and 60 deletions.
2 changes: 2 additions & 0 deletions arch/TriCore/TriCoreDisassembler.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "../../MCDisassembler.h"
#include "../../MathExtras.h"

#include "TriCoreDisassembler.h"

static bool readInstruction16(const uint8_t *code, size_t code_len,
uint16_t *insn)
{
Expand Down
2 changes: 2 additions & 0 deletions arch/TriCore/TriCoreDisassembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ bool TriCore_getInstruction(csh ud, const uint8_t *code, size_t code_len,
MCInst *instr, uint16_t *size, uint64_t address,
void *info);

bool TriCore_getFeatureBits(unsigned int mode, unsigned int feature);

#endif
5 changes: 4 additions & 1 deletion arch/TriCore/TriCoreInstPrinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,11 +514,14 @@ typedef struct {
uint64_t second; // Bits
} MnemonicBitsInfo;

void set_mem_access(MCInst *MI, unsigned int access)
static void set_mem_access(MCInst *MI, unsigned int access)
{
// TODO: TriCore
}

MnemonicBitsInfo getMnemonic(MCInst *MI, SStream *O);
bool printAliasInstr(MCInst *MI, uint64_t Address, SStream *OS);

#define PRINT_ALIAS_INSTR

#include "TriCoreGenAsmWriter.inc"
Expand Down
3 changes: 3 additions & 0 deletions arch/TriCore/TriCoreMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ const char *TriCore_insn_name(csh handle, unsigned int id);

const char *TriCore_group_name(csh handle, unsigned int id);

cs_err TRICORE_global_init(cs_struct *ud);
cs_err TRICORE_option(cs_struct *handle, cs_opt_type type, size_t value);

#endif
20 changes: 1 addition & 19 deletions cstool/cstool.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "getopt.h"

#include <capstone/capstone.h>
#include "cstool.h"

void print_string_hex(const char *comment, unsigned char *str, size_t len);

Expand Down Expand Up @@ -115,25 +116,6 @@ static struct {
{ NULL }
};

void print_insn_detail_x86(csh ud, cs_mode mode, cs_insn *ins);
void print_insn_detail_arm(csh handle, cs_insn *ins);
void print_insn_detail_arm64(csh handle, cs_insn *ins);
void print_insn_detail_mips(csh handle, cs_insn *ins);
void print_insn_detail_ppc(csh handle, cs_insn *ins);
void print_insn_detail_sparc(csh handle, cs_insn *ins);
void print_insn_detail_sysz(csh handle, cs_insn *ins);
void print_insn_detail_xcore(csh handle, cs_insn *ins);
void print_insn_detail_m68k(csh handle, cs_insn *ins);
void print_insn_detail_tms320c64x(csh handle, cs_insn *ins);
void print_insn_detail_m680x(csh handle, cs_insn *ins);
void print_insn_detail_evm(csh handle, cs_insn *ins);
void print_insn_detail_riscv(csh handle, cs_insn *ins);
void print_insn_detail_wasm(csh handle, cs_insn *ins);
void print_insn_detail_mos65xx(csh handle, cs_insn *ins);
void print_insn_detail_bpf(csh handle, cs_insn *ins);
void print_insn_detail_sh(csh handle, cs_insn *ins);
void print_insn_detail_tricore(csh handle, cs_insn *ins);

static void print_details(csh handle, cs_arch arch, cs_mode md, cs_insn *ins);

void print_string_hex(const char *comment, unsigned char *str, size_t len)
Expand Down
23 changes: 23 additions & 0 deletions cstool/cstool.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef CAPSTONE_CSTOOL_CSTOOL_H_
#define CAPSTONE_CSTOOL_CSTOOL_H_

void print_insn_detail_x86(csh ud, cs_mode mode, cs_insn *ins);
void print_insn_detail_arm(csh handle, cs_insn *ins);
void print_insn_detail_arm64(csh handle, cs_insn *ins);
void print_insn_detail_mips(csh handle, cs_insn *ins);
void print_insn_detail_ppc(csh handle, cs_insn *ins);
void print_insn_detail_sparc(csh handle, cs_insn *ins);
void print_insn_detail_sysz(csh handle, cs_insn *ins);
void print_insn_detail_xcore(csh handle, cs_insn *ins);
void print_insn_detail_m68k(csh handle, cs_insn *ins);
void print_insn_detail_tms320c64x(csh handle, cs_insn *ins);
void print_insn_detail_m680x(csh handle, cs_insn *ins);
void print_insn_detail_evm(csh handle, cs_insn *ins);
void print_insn_detail_riscv(csh handle, cs_insn *ins);
void print_insn_detail_wasm(csh handle, cs_insn *ins);
void print_insn_detail_mos65xx(csh handle, cs_insn *ins);
void print_insn_detail_bpf(csh handle, cs_insn *ins);
void print_insn_detail_sh(csh handle, cs_insn *ins);
void print_insn_detail_tricore(csh handle, cs_insn *ins);

#endif //CAPSTONE_CSTOOL_CSTOOL_H_
3 changes: 1 addition & 2 deletions cstool/cstool_arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#include <stdlib.h>

#include <capstone/capstone.h>

void print_insn_detail_arm(csh handle, cs_insn *ins);
#include "cstool.h"

void print_insn_detail_arm(csh handle, cs_insn *ins)
{
Expand Down
3 changes: 1 addition & 2 deletions cstool/cstool_arm64.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#include <stdlib.h>

#include <capstone/capstone.h>

void print_insn_detail_arm64(csh handle, cs_insn *ins);
#include "cstool.h"

void print_insn_detail_arm64(csh handle, cs_insn *ins)
{
Expand Down
3 changes: 1 addition & 2 deletions cstool/cstool_bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

#include <capstone/capstone.h>
#include <capstone/platform.h>
#include "cstool.h"

static const char * ext_name[] = {
[BPF_EXT_LEN] = "#len",
};

void print_insn_detail_bpf(csh handle, cs_insn *ins);

void print_insn_detail_bpf(csh handle, cs_insn *ins)
{
unsigned i;
Expand Down
3 changes: 1 addition & 2 deletions cstool/cstool_evm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#include <stdlib.h>

#include <capstone/capstone.h>

void print_insn_detail_evm(csh handle, cs_insn *ins);
#include "cstool.h"

void print_insn_detail_evm(csh handle, cs_insn *ins)
{
Expand Down
4 changes: 1 addition & 3 deletions cstool/cstool_m680x.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@

#include <stdio.h>
#include <capstone/capstone.h>

void print_insn_detail_m680x(csh handle, cs_insn *insn);
#include "cstool.h"

static const char *s_access[] = {
"UNCHANGED", "READ", "WRITE", "READ | WRITE",
};


static void print_read_write_regs(csh handle, cs_detail *detail)
{
int i;
Expand Down
3 changes: 1 addition & 2 deletions cstool/cstool_m68k.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

#include <stdio.h>
#include <capstone/capstone.h>

void print_insn_detail_m68k(csh handle, cs_insn *ins);
#include "cstool.h"

static const char* s_addressing_modes[] = {
"<invalid mode>",
Expand Down
3 changes: 1 addition & 2 deletions cstool/cstool_mips.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#include <stdlib.h>

#include <capstone/capstone.h>

void print_insn_detail_mips(csh handle, cs_insn *ins);
#include "cstool.h"

void print_insn_detail_mips(csh handle, cs_insn *ins)
{
Expand Down
5 changes: 1 addition & 4 deletions cstool/cstool_mos65xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
#include <stdlib.h>

#include <capstone/capstone.h>

void print_insn_detail_mos65xx(csh handle, cs_insn *ins);

#include "cstool.h"

static const char *get_am_name(mos65xx_address_mode mode)
{
Expand Down Expand Up @@ -65,7 +63,6 @@ static const char *get_am_name(mos65xx_address_mode mode)
}
}


void print_insn_detail_mos65xx(csh handle, cs_insn *ins)
{
int i;
Expand Down
4 changes: 1 addition & 3 deletions cstool/cstool_ppc.c → cstool/cstool_powerpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
#include <stdio.h>

#include <capstone/capstone.h>

void print_insn_detail_ppc(csh handle, cs_insn *ins);

#include "cstool.h"

static const char* get_bc_name(int bc)
{
Expand Down
3 changes: 1 addition & 2 deletions cstool/cstool_riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

#include <stdio.h>
#include <capstone/capstone.h>

void print_insn_detail_riscv(csh handle, cs_insn *ins);
#include "cstool.h"

void print_insn_detail_riscv(csh handle, cs_insn *ins)
{
Expand Down
3 changes: 1 addition & 2 deletions cstool/cstool_sh.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

#include <stdio.h>
#include <capstone/capstone.h>

void print_insn_detail_sh(csh handle, cs_insn *ins);
#include "cstool.h"

static const char* s_addressing_modes[] = {
"<invalid mode>",
Expand Down
4 changes: 1 addition & 3 deletions cstool/cstool_sparc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
#include <stdio.h>

#include <capstone/capstone.h>

void print_insn_detail_sparc(csh handle, cs_insn *ins);

#include "cstool.h"

void print_insn_detail_sparc(csh handle, cs_insn *ins)
{
Expand Down
3 changes: 1 addition & 2 deletions cstool/cstool_systemz.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
#include <stdio.h>

#include <capstone/capstone.h>

void print_insn_detail_sysz(csh handle, cs_insn *ins);
#include "cstool.h"

void print_insn_detail_sysz(csh handle, cs_insn *ins)
{
Expand Down
3 changes: 1 addition & 2 deletions cstool/cstool_tms320c64x.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

#include <stdio.h>
#include <capstone/capstone.h>

void print_insn_detail_tms320c64x(csh handle, cs_insn *ins);
#include "cstool.h"

void print_insn_detail_tms320c64x(csh handle, cs_insn *ins)
{
Expand Down
3 changes: 2 additions & 1 deletion cstool/cstool_tricore.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <stdlib.h>

#include <capstone/capstone.h>
#include "cstool.h"

void print_insn_detail_tricore(csh handle, cs_insn *ins)
{
Expand Down Expand Up @@ -68,4 +69,4 @@ void print_insn_detail_tricore(csh handle, cs_insn *ins)
}
}
}
}
}
3 changes: 1 addition & 2 deletions cstool/cstool_wasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#include <stdlib.h>

#include <capstone/capstone.h>

void print_insn_detail_wasm(csh handle, cs_insn *ins);
#include "cstool.h"

void print_insn_detail_wasm(csh handle, cs_insn *ins)
{
Expand Down
3 changes: 1 addition & 2 deletions cstool/cstool_x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
#include <stdlib.h>

#include <capstone/capstone.h>

void print_insn_detail_x86(csh ud, cs_mode mode, cs_insn *ins);
#include "cstool.h"

void print_string_hex(const char *comment, unsigned char *str, size_t len);

Expand Down
3 changes: 1 addition & 2 deletions cstool/cstool_xcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

#include <stdio.h>
#include <capstone/capstone.h>

void print_insn_detail_xcore(csh handle, cs_insn *ins);
#include "cstool.h"

void print_insn_detail_xcore(csh handle, cs_insn *ins)
{
Expand Down

0 comments on commit 5e2edea

Please sign in to comment.