Skip to content

Commit

Permalink
Fix few random warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
trufae authored May 2, 2024
1 parent f79c208 commit fe70288
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 24 deletions.
7 changes: 4 additions & 3 deletions libr/arch/p/ppc/gnu/ppc-dis.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,10 @@ operand_value_powerpc (const struct powerpc_operand *operand,
/* BITM is always some number of zeros followed by some
number of ones, followed by some numer of zeros. */
unsigned long top = operand->bitm;
/* top & -top gives the rightmost 1 bit, so this
fills in any trailing zeros. */
top |= (top & -top) - 1;
unsigned long ntop = (unsigned long)(-top & 0xFFFFFFFF);

/* top & -top gives the rightmost 1 bit, so this fills in any trailing zeros. */
top |= (top & ntop) - 1;
top &= ~(top >> 1);
value = (value ^ top) - top;
}
Expand Down
2 changes: 1 addition & 1 deletion libr/arch/p/stm8/gmtdisas/asm.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ typedef struct {
uint32_t ext_offset;
uint32_t size;
uint32_t line_index;
unsigned char *data;
const ut8 *data;
} datablock;

char *stm8_disasm(ut64 pc, const ut8 *data, int size, unsigned int *type, ut64 *jump, int *len) {
Expand Down
11 changes: 0 additions & 11 deletions libr/arch/p/stm8/gmtdisas/ins.inc.c
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
// https://www.st.com/resource/en/programming_manual/pm0044-stm8-cpu-programming-manual-stmicroelectronics.pdf
//
typedef enum {
INHERENT,
IMMEDIATE,
DIRECT,
INDEXED,
SP_INDEXED,
INDIRECT,
RELATIVE,
BIT_OPERATION
} Adressing_Mode;

typedef enum {
STM8_NONE = 0,
Expand Down
5 changes: 3 additions & 2 deletions libr/arch/p/stm8/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ const RArchPlugin r_arch_plugin_stm8 = {
.license = "GPL3",
},
.arch = "stm8",
.info = archinfo,
.bits = R_SYS_BITS_PACK (32),
.cpus = NULL,
.endian = R_SYS_ENDIAN_LITTLE,
.bits = R_SYS_BITS_PACK (32),
.info = archinfo,
.decode = &stm8_op,
.regs = &regs,
};
Expand Down
6 changes: 3 additions & 3 deletions libr/bin/p/bin_cgc.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* radare - LGPL - Copyright 2009-2019 - ret2libc, pancake */
/* radare - LGPL - Copyright 2009-2024 - ret2libc, pancake */

#define R_BIN_CGC 1
#include "bin_elf.inc.c"

extern struct r_bin_dbginfo_t r_bin_dbginfo_elf;
// extern struct r_bin_dbginfo_t r_bin_dbginfo_elf;
extern struct r_bin_write_t r_bin_write_elf;

static bool check(RBinFile *bf, RBuffer *buf) {
Expand Down Expand Up @@ -115,7 +115,7 @@ RBinPlugin r_bin_plugin_cgc = {
.size = &size,
.libs = &libs,
.relocs = &relocs,
.dbginfo = &r_bin_dbginfo_elf,
// .dbginfo = &r_bin_dbginfo_elf,
.create = &create,
.patch_relocs = &patch_relocs,
.write = &r_bin_write_elf,
Expand Down
2 changes: 2 additions & 0 deletions libr/bin/p/bin_dbginfo_elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <r_bin.h>

#if 0
// TODO: use proper dwarf api here.. or deprecate
// XXX this is the generic api, so it doesnt belong to elf. this code can be removed
static bool get_line(RBinFile *bf, ut64 addr, char *file, int len, int *line, int *colu) {
Expand Down Expand Up @@ -37,3 +38,4 @@ RBinDbgInfo r_bin_dbginfo_elf = {
// .get_line = &get_line,
};
#endif
#endif
4 changes: 2 additions & 2 deletions libr/bin/p/bin_elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static bool check(RBinFile *bf, RBuffer *buf) {
return !memcmp (b, ELFMAG, SELFMAG) && b[4] != 2;
}

extern struct r_bin_dbginfo_t r_bin_dbginfo_elf;
// extern struct r_bin_dbginfo_t r_bin_dbginfo_elf;
extern struct r_bin_write_t r_bin_write_elf;

static RBuffer* create(RBin* bin, const ut8 *code, int codelen, const ut8 *data, int datalen, RBinArchOptions *opt) {
Expand Down Expand Up @@ -149,7 +149,7 @@ RBinPlugin r_bin_plugin_elf = {
.libs = &libs,
.relocs = &relocs,
.patch_relocs = &patch_relocs,
.dbginfo = &r_bin_dbginfo_elf,
// .dbginfo = &r_bin_dbginfo_elf,
.create = &create,
.write = &r_bin_write_elf,
.regstate = &regstate,
Expand Down
4 changes: 2 additions & 2 deletions libr/bin/p/bin_elf64.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static bool check(RBinFile *bf, RBuffer *b) {
return false;
}

extern struct r_bin_dbginfo_t r_bin_dbginfo_elf64;
// extern struct r_bin_dbginfo_t r_bin_dbginfo_elf64;
extern struct r_bin_write_t r_bin_write_elf64;

static ut64 get_elf_vaddr64(RBinFile *bf, ut64 baddr, ut64 paddr, ut64 vaddr) {
Expand Down Expand Up @@ -151,7 +151,7 @@ RBinPlugin r_bin_plugin_elf64 = {
.libs = &libs,
.relocs = &relocs,
.patch_relocs = &patch_relocs,
.dbginfo = &r_bin_dbginfo_elf64,
// .dbginfo = &r_bin_dbginfo_elf64,
.create = &create,
.write = &r_bin_write_elf64,
.get_vaddr = &get_elf_vaddr64,
Expand Down

0 comments on commit fe70288

Please sign in to comment.