Fix compilation warnings related to TriCore. (#2012)

* fix tricore compiler warn `-Wmissing-prototypes`

* include cstool.h
This commit is contained in:
billow 2023-05-09 20:46:10 +08:00 committed by GitHub
parent 20d3fec4f4
commit 404edd5772
24 changed files with 54 additions and 60 deletions

View File

@ -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)
{

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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);
@ -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)

23
cstool/cstool.h Normal file
View File

@ -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_

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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;

View File

@ -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)
{

View File

@ -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;

View File

@ -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>",

View File

@ -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)
{

View File

@ -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)
{
@ -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;

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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>",

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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)
{

View File

@ -2,6 +2,7 @@
#include <stdlib.h>
#include <capstone/capstone.h>
#include "cstool.h"
void print_insn_detail_tricore(csh handle, cs_insn *ins)
{
@ -68,4 +69,4 @@ void print_insn_detail_tricore(csh handle, cs_insn *ins)
}
}
}
}
}

View File

@ -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)
{

View File

@ -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);

View File

@ -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)
{