Project

General

Profile

Enhancement #750 » 0021-sanitize-pragmas-for-our-code.patch

Loïc Gomez, 2022-01-10 19:28

View differences:

src/bip.c
md5 = bip_malloc((size_t) 20);
for (i = 0; i < 20; i++) {
sscanf(hex + 2 * i, "%02x", &buf);
// conversion from ‘unsigned int’ to ‘unsigned char’ may change value
// we're parsing a text (hex) so buf won't ever be something else than a char
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
md5[i] = buf;
#pragma GCC diagnostic pop
}
*seed = 0;
src/irc.c
#include "md5.h"
#include "utils/base64.h"
// TODO resolve assuming signed overflow does not occur when changing X +- C1 cmp C2 to X cmp C2 -+ C1
#pragma GCC diagnostic ignored "-Wstrict-overflow"
#define S_CONN_DELAY (10)
extern int sighup;
src/line.c
#include "line.h"
#include "util.h"
// TODO resolve assuming signed overflow does not occur when changing X +- C1 cmp C2 to X cmp C2 -+ C1
#pragma GCC diagnostic ignored "-Wstrict-overflow"
void irc_line_init(struct line *l)
{
memset(l, 0, sizeof(struct line));
src/md5.c
length = strlen(str);
length += 4;
ptr = bip_malloc(length);
// conversion from ‘unsigned int’ to ‘unsigned char’ may change value [-Werror=conversion]
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
ptr[0] = seed >> 24 & 0xff;
#pragma GCC diagnostic pop
ptr[1] = seed >> 16 & 0xff;
ptr[2] = seed >> 8 & 0xff;
ptr[3] = seed & 0xff;
src/util.h
void *ptr;
};
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
typedef struct list {
struct list_item *first;
struct list_item *last;
int (*cmp)();
} list_t;
#pragma GCC diagnostic pop
typedef struct list_iterator {
list_t *list;
(20-20/24)