silent some bad-function-cast

This commit is contained in:
Philippe Teuwen 2020-05-04 01:18:26 +02:00
parent 723503b74e
commit 58f71d97f5
6 changed files with 15 additions and 11 deletions

View file

@ -47,9 +47,9 @@ endif
DEFCFLAGS = -Wall -Werror -O3
# Some more warnings we want as errors:
DEFCFLAGS += -Wredundant-decls -Wmissing-prototypes -Wchar-subscripts -Wshadow -Wundef -Wwrite-strings -Wunused -Wuninitialized -Wpointer-arith -Winline -Wformat -Wformat-security -Winit-self -Wmissing-include-dirs -Wnested-externs -Wmissing-declarations
DEFCFLAGS += -Wcast-align -Wbad-function-cast -Wredundant-decls -Wmissing-prototypes -Wchar-subscripts -Wshadow -Wundef -Wwrite-strings -Wunused -Wuninitialized -Wpointer-arith -Winline -Wformat -Wformat-security -Winit-self -Wmissing-include-dirs -Wnested-externs -Wmissing-declarations
# Some more warnings we need first to eliminate, so temporarely tolerated:
DEFCFLAGS += -Wbad-function-cast -Wno-error=bad-function-cast -Wcast-align -Wno-error=cast-align
DEFCFLAGS += -Wno-error=cast-align
# TODO?:
#DEFCFLAGS += -Wextra -Wswitch-enum -Wold-style-definition

View file

@ -793,7 +793,8 @@ static void update_p_K(void) {
}
for (uint8_t sum_a8_idx = 0; sum_a8_idx < NUM_SUMS; sum_a8_idx++) {
uint16_t sum_a8 = sums[sum_a8_idx];
my_p_K[sum_a8_idx] = (float)estimated_num_states_coarse(sum_a0, sum_a8) / total_count;
float f = estimated_num_states_coarse(sum_a0, sum_a8);
my_p_K[sum_a8_idx] = f / total_count;
}
// PrintAndLogEx(NORMAL, "my_p_K = [");
// for (uint8_t sum_a8_idx = 0; sum_a8_idx < NUM_SUMS; sum_a8_idx++) {

View file

@ -12,7 +12,6 @@
#include <string.h>
#include <inttypes.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
@ -70,9 +69,9 @@ static uint64_t getJablontronCardId(uint64_t rawcode) {
uint64_t id = 0;
uint8_t bytes[] = {0, 0, 0, 0, 0};
num_to_bytes(rawcode, 5, bytes);
for (int i = 4, j = 0; i > -1; --i, j += 2) {
id += NIBBLE_LOW(bytes[i]) * (int)pow(10, j);
id += NIBBLE_HIGH(bytes[i]) * (int)pow(10, j + 1);
for (int i = 0; i < 5; i++) {
id *= 100;
id += NIBBLE_HIGH(bytes[i]) * 10 + NIBBLE_LOW(bytes[i]);
}
return id;
}

View file

@ -203,7 +203,8 @@ static int l_unpack(lua_State *L) { /** unpack(f,s, [init]) */
#define PACKNUMBER(OP,T) \
case OP: \
{ \
T a=(T)luaL_checknumber(L,i++); \
lua_Number n = luaL_checknumber(L,i++); \
T a=(T)n; \
doswap(swap,&a,sizeof(a)); \
luaL_addlstring(&b,(char*)&a,sizeof(a)); \
break; \

View file

@ -92,16 +92,18 @@ typedef size_t lua_UInteger;
#define LOGICAL_SHIFT(name, op) \
static int bit_ ## name(lua_State *L) { \
lua_Number f; \
lua_Number n = luaL_checknumber(L, 2); \
lua_pushinteger(L, BIT_TRUNCATE(BIT_TRUNCATE((lua_UInteger)TOBIT(L, 1, f)) op \
(unsigned)luaL_checknumber(L, 2))); \
(unsigned)n)); \
return 1; \
}
#define ARITHMETIC_SHIFT(name, op) \
static int bit_ ## name(lua_State *L) { \
lua_Number f; \
lua_Number n = luaL_checknumber(L, 2); \
lua_pushinteger(L, BIT_TRUNCATE((lua_Integer)TOBIT(L, 1, f) op \
(unsigned)luaL_checknumber(L, 2))); \
(unsigned)n)); \
return 1; \
}

View file

@ -253,7 +253,8 @@ int WAI_PREFIX(getModulePath)(char *out, int capacity, int *dirname_length) {
break;
if (sscanf(buffer, "%" SCNx64 "-%" SCNx64 " %s %" SCNx64 " %x:%x %u %s\n", &low, &high, perms, &offset, &major, &minor, &inode, path) == 8) {
uint64_t addr = (uint64_t)(uintptr_t)WAI_RETURN_ADDRESS();
void *addr_tmp = WAI_RETURN_ADDRESS();
uint64_t addr = (uint64_t)addr_tmp;
if (low <= addr && addr <= high) {
char *resolved;