Skip to content
Snippets Groups Projects
Commit 4b872b56 authored by rahix's avatar rahix
Browse files

Merge 'Increase warning level & Fix all warnings'

Closes #192

See merge request card10/firmware!360
parents 1eef5c51 24985020
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,7 @@ void gfx_setpixel(struct gfx_region *r, int x, int y, Color c)
{
if (x < 0 || y < 0)
return;
if (x >= r->width || y >= r->height)
if ((size_t)x >= r->width || (size_t)y >= r->height)
return;
fb_setpixel(r->fb, r->x + x, r->y + y, c);
......@@ -90,7 +90,7 @@ void gfx_puts(
while (*str) {
// if the current position plus the width of the next character
// would bring us outside of the display ...
if ((x + font->Width) > r->width) {
if ((x + font->Width) > (int)r->width) {
// ... we move down a line before printing the character
x = 0;
y += font->Height;
......@@ -350,7 +350,7 @@ static void gfx_copy_region_rle_mono(
Color white = gfx_color(reg, WHITE);
Color black = gfx_color(reg, BLACK);
for (int i = 0; i < size; i++) {
for (size_t i = 0; i < size; i++) {
Color color = (data[i] & 0x80) ? white : black;
uint8_t length = data[i] & 0x7f;
......
......@@ -41,7 +41,7 @@ static void scrollup(struct txt_buffer *tm)
for (int row = 0; row < last_row; row++)
memcpy(&tm->text[row][0], &tm->text[row + 1][0], line_size);
for (int col = 0; col < width_(tm); col++) {
for (size_t col = 0; col < width_(tm); col++) {
struct txt_glyph *g = &tm->text[last_row][col];
g->ch = ' ';
g->fg_color = tm->fg_color;
......@@ -63,7 +63,7 @@ static inline void advance_cursor(struct txt_buffer *tm)
const int last_row = height_(tm) - 1;
tm->cursor_column++;
if (tm->cursor_column >= width_(tm)) {
if (tm->cursor_column >= (int)width_(tm)) {
tm->cursor_column = 0;
tm->cursor_row++;
if (tm->cursor_row > last_row)
......@@ -226,9 +226,9 @@ void txt_set_cursor(struct txt_buffer *tm, int x, int y, int draw_cursor)
{
tm->draw_cursor = draw_cursor;
if (x < 0 || x >= width_(tm))
if (x < 0 || x >= (int)width_(tm))
return;
if (y < 0 || y >= height_(tm))
if (y < 0 || y >= (int)height_(tm))
return;
tm->cursor_column = x;
......
......@@ -31,7 +31,7 @@ mpy_cross_wrapper = executable(
'mpy-cross-wrapper.c',
link_depends: mpy_cross_bin,
native: true,
c_args: ['-DMPY_CROSS_PATH="' + meson.current_build_dir() + '"'],
c_args: ['-DMPY_CROSS_PATH="' + meson.current_build_dir() + '"', '-Wno-unused-parameter'],
)
mpy_cross = generator(
......
......@@ -98,7 +98,7 @@ int Board_Init(void)
{PORT_0, PIN_31, GPIO_FUNC_OUT, GPIO_PAD_NONE}, // ECG switch
};
const unsigned int num_pins = (sizeof(pins) / sizeof(gpio_cfg_t));
int i;
unsigned int i;
for (i = 0; i < num_pins; i++) {
GPIO_OutClr(&pins[i]);
GPIO_Config(&pins[i]);
......
......@@ -7,6 +7,7 @@ project(
'c_std=c99',
'b_staticpic=false',
'b_asneeded=false',
'warning_level=2',
],
)
......@@ -17,6 +18,8 @@ assert(
)
add_global_arguments(
'-Wno-unused-parameter',
'-Wno-old-style-declaration',
meson.get_cross_property('target_defs'),
language: 'c',
)
......
......@@ -80,6 +80,7 @@ upy = static_library(
micropython_extmod_sources,
mp_headers,
include_directories: micropython_includes,
c_args: '-w',
)
elf = executable(
......
......@@ -29,7 +29,7 @@ bool pycrd_filename_restricted(const char *path)
}
fname = path;
for (int i = 0;
for (size_t i = 0;
i < sizeof(forbidden_files) / sizeof(forbidden_files[0]);
i++) {
if (strcasecmp(fname, forbidden_files[i]) == 0) {
......
......@@ -120,7 +120,7 @@ static mp_obj_t mp_display_line(size_t n_args, const mp_obj_t *args)
uint16_t ls = mp_obj_get_int(args[5]);
uint16_t ps = mp_obj_get_int(args[6]);
if (ls > 1 || ls < 0) {
if (ls > 1) {
mp_raise_ValueError("Line style has to be 0 or 1");
}
......@@ -145,7 +145,7 @@ static mp_obj_t mp_display_rect(size_t n_args, const mp_obj_t *args)
uint16_t fs = mp_obj_get_int(args[5]);
uint16_t ps = mp_obj_get_int(args[6]);
if (fs > 1 || fs < 0) {
if (fs > 1) {
mp_raise_ValueError("Fill style has to be 0 or 1");
}
......@@ -169,7 +169,7 @@ static mp_obj_t mp_display_circ(size_t n_args, const mp_obj_t *args)
uint16_t fs = mp_obj_get_int(args[4]);
uint16_t ps = mp_obj_get_int(args[5]);
if (fs > 1 || fs < 0) {
if (fs > 1) {
mp_raise_ValueError("Fill style has to be 0 or 1");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment