fix warings

This commit is contained in:
Gabor Kiss-Vamosi
2020-05-24 13:13:07 +02:00
parent 1c9830b715
commit a2c973bd5b
24 changed files with 147 additions and 103 deletions

View File

@@ -2929,6 +2929,7 @@ void * lv_obj_get_group(const lv_obj_t * obj)
#if LV_USE_GROUP
return obj->group_p;
#else
LV_UNUSED(obj);
return NULL;
#endif
}
@@ -2948,6 +2949,7 @@ bool lv_obj_is_focused(const lv_obj_t * obj)
}
return false;
#else
LV_UNUSED(obj);
return false;
#endif
}

View File

@@ -758,7 +758,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
}
/*Go to the next column*/
if(col_bit < 8 - bpp) {
if(col_bit < (int32_t) (8 - bpp)) {
col_bit += bpp;
bitmask = bitmask >> bpp;
}
@@ -778,7 +778,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
}
}
if((uint32_t) mask_p + (col_end - col_start) < mask_buf_size) {
if((int32_t) mask_p + (col_end - col_start) < mask_buf_size) {
map_area.y2 ++;
}
else {

View File

@@ -188,7 +188,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const
if(dashed) {
if(mask_res != LV_DRAW_MASK_RES_TRANSP) {
lv_style_int_t dash_cnt = dash_start;
uint32_t i;
lv_coord_t i;
for(i = 0; i < draw_area_w; i++, dash_cnt++) {
if(dash_cnt <= dsc->dash_width) {
int16_t diff = dsc->dash_width - dash_cnt;

View File

@@ -112,6 +112,9 @@ void lv_draw_rect(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect
*/
void lv_draw_px(const lv_point_t * point, const lv_area_t * clip_area, const lv_style_t * style)
{
LV_UNUSED(point);
LV_UNUSED(clip_area);
LV_UNUSED(style);
// lv_opa_t opa = style->body.opa;
// if(opa_scale != LV_OPA_COVER) opa = (opa * opa_scale) >> 8;
//
@@ -811,7 +814,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
/*Invert the shadow corner buffer and draw the corners on the left*/
sh_buf_tmp = sh_buf ;
for(y = 0; y < corner_size; y++) {
uint32_t x;
int32_t x;
for(x = 0; x < corner_size / 2; x++) {
lv_opa_t tmp = sh_buf_tmp[x];
sh_buf_tmp[x] = sh_buf_tmp[corner_size - x - 1];

View File

@@ -523,6 +523,9 @@ void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t
res->y1 = LV_MATH_MIN4(lb.y, lt.y, rb.y, rt.y);
res->y2 = LV_MATH_MAX4(lb.y, lt.y, rb.y, rt.y);
#else
LV_UNUSED(angle);
LV_UNUSED(zoom);
LV_UNUSED(pivot);
res->x1 = 0;
res->y1 = 0;
res->x2 = w;

View File

@@ -568,6 +568,11 @@ static lv_res_t lv_img_decoder_built_in_line_true_color(lv_img_decoder_dsc_t * d
return LV_RES_OK;
#else
LV_UNUSED(dsc);
LV_UNUSED(x);
LV_UNUSED(y);
LV_UNUSED(len);
LV_UNUSED(buf);
LV_LOG_WARN("Image built-in decoder cannot read file because LV_USE_FILESYSTEM = 0");
return LV_RES_INV;
#endif

View File

@@ -257,6 +257,7 @@ lv_coord_t lv_disp_get_ver_res(lv_disp_t * disp)
bool lv_disp_get_antialiasing(lv_disp_t * disp)
{
#if LV_ANTIALIAS == 0
LV_UNUSED(disp);
return false;
#else
if(disp == NULL) disp = lv_disp_get_default();
@@ -271,7 +272,7 @@ bool lv_disp_get_antialiasing(lv_disp_t * disp)
* @param disp pointer to a display (NULL to use the default display)
* @return dpi of the display
*/
uint32_t lv_disp_get_dpi(lv_disp_t * disp)
lv_coord_t lv_disp_get_dpi(lv_disp_t * disp)
{
if(disp == NULL) disp = lv_disp_get_default();
if(disp == NULL) return LV_DPI; /*Do not return 0 because it might be a divider*/

View File

@@ -255,7 +255,7 @@ bool lv_disp_get_antialiasing(lv_disp_t * disp);
* @param disp pointer to a display (NULL to use the default display)
* @return dpi of the display
*/
uint32_t lv_disp_get_dpi(lv_disp_t * disp);
lv_coord_t lv_disp_get_dpi(lv_disp_t * disp);
/**
* Get the size category of the display based on it's hor. res. and dpi.

View File

@@ -224,6 +224,8 @@ void lv_anim_refr_now(void)
*/
lv_anim_value_t lv_anim_path_linear(const lv_anim_path_t * path, const lv_anim_t * a)
{
LV_UNUSED(path);
/*Calculate the current step*/
uint32_t step;
if(a->time == a->act_time) {
@@ -250,6 +252,8 @@ lv_anim_value_t lv_anim_path_linear(const lv_anim_path_t * path, const lv_anim_t
*/
lv_anim_value_t lv_anim_path_ease_in(const lv_anim_path_t * path, const lv_anim_t * a)
{
LV_UNUSED(path);
/*Calculate the current step*/
uint32_t t;
if(a->time == a->act_time)
@@ -274,6 +278,8 @@ lv_anim_value_t lv_anim_path_ease_in(const lv_anim_path_t * path, const lv_anim_
*/
lv_anim_value_t lv_anim_path_ease_out(const lv_anim_path_t * path, const lv_anim_t * a)
{
LV_UNUSED(path);
/*Calculate the current step*/
uint32_t t;
@@ -299,6 +305,8 @@ lv_anim_value_t lv_anim_path_ease_out(const lv_anim_path_t * path, const lv_anim
*/
lv_anim_value_t lv_anim_path_ease_in_out(const lv_anim_path_t * path, const lv_anim_t * a)
{
LV_UNUSED(path);
/*Calculate the current step*/
uint32_t t;
@@ -324,6 +332,8 @@ lv_anim_value_t lv_anim_path_ease_in_out(const lv_anim_path_t * path, const lv_a
*/
lv_anim_value_t lv_anim_path_overshoot(const lv_anim_path_t * path, const lv_anim_t * a)
{
LV_UNUSED(path);
/*Calculate the current step*/
uint32_t t;
@@ -350,6 +360,8 @@ lv_anim_value_t lv_anim_path_overshoot(const lv_anim_path_t * path, const lv_ani
*/
lv_anim_value_t lv_anim_path_bounce(const lv_anim_path_t * path, const lv_anim_t * a)
{
LV_UNUSED(path);
/*Calculate the current step*/
uint32_t t;
if(a->time == a->act_time)
@@ -412,6 +424,8 @@ lv_anim_value_t lv_anim_path_bounce(const lv_anim_path_t * path, const lv_anim_t
*/
lv_anim_value_t lv_anim_path_step(const lv_anim_path_t * path, const lv_anim_t * a)
{
LV_UNUSED(path);
if(a->act_time >= a->time)
return a->end;
else

View File

@@ -83,7 +83,7 @@ typedef struct _lv_anim_t {
lv_anim_path_t path; /**< Describe the path (curve) of animations*/
int32_t start; /**< Start value*/
int32_t end; /**< End value*/
uint32_t time; /**< Animation time in ms*/
int32_t time; /**< Animation time in ms*/
int32_t act_time; /**< Current time in animation. Set to negative to make delay.*/
uint32_t playback_delay; /**< Wait before play back*/
uint32_t playback_time; /**< Duration of playback animation*/

View File

@@ -459,6 +459,7 @@ LV_ATTRIBUTE_FAST_MEM static inline void lv_color_premult(lv_color_t c, uint8_t
out[1] = (uint16_t) LV_COLOR_GET_G(c) * mix;
out[2] = (uint16_t) LV_COLOR_GET_B(c) * mix;
#else
(void) mix;
/*Pre-multiplication can't be used with 1 bpp*/
out[0] = LV_COLOR_GET_R(c);
out[1] = LV_COLOR_GET_G(c);

View File

@@ -77,6 +77,8 @@ typedef uint32_t lv_uintptr_t;
* MACROS
**********************/
#define LV_UNUSED(x) ((void) x)
#ifdef __cplusplus
} /* extern "C" */
#endif

View File

@@ -163,6 +163,7 @@ void lv_bar_set_value(lv_obj_t * bar, int16_t value, lv_anim_enable_t anim)
if(ext->cur_value == new_value) return;
#if LV_USE_ANIMATION == 0
LV_UNUSED(anim);
ext->cur_value = new_value;
lv_obj_invalidate(bar);
#else
@@ -189,6 +190,7 @@ void lv_bar_set_start_value(lv_obj_t * bar, int16_t start_value, lv_anim_enable_
if(ext->start_value == new_value) return;
#if LV_USE_ANIMATION == 0
LV_UNUSED(anim);
ext->start_value = new_value;
#else
lv_bar_set_value_with_anim(bar, new_value, &ext->start_value, &ext->start_value_anim, anim);

View File

@@ -364,6 +364,15 @@ void lv_canvas_transform(lv_obj_t * canvas, lv_img_dsc_t * img, int16_t angle, u
lv_obj_invalidate(canvas);
#else
LV_UNUSED(canvas);
LV_UNUSED(img);
LV_UNUSED(angle);
LV_UNUSED(zoom);
LV_UNUSED(offset_x);
LV_UNUSED(offset_y);
LV_UNUSED(pivot_x);
LV_UNUSED(pivot_y);
LV_UNUSED(antialias);
LV_LOG_WARN("LV_USE_IMG_TRANSFORM is disabled in lv_conf.h");
#endif
}
@@ -1009,7 +1018,7 @@ void lv_canvas_draw_polygon(lv_obj_t * canvas, const lv_point_t points[], uint32
lv_disp_t * refr_ori = _lv_refr_get_disp_refreshing();
_lv_refr_set_disp_refreshing(&disp);
// lv_draw_polygon(points, point_cnt, &mask, poly_draw_dsc);
lv_draw_polygon(points, point_cnt, &mask, poly_draw_dsc);
_lv_refr_set_disp_refreshing(refr_ori);

View File

@@ -359,7 +359,7 @@ uint8_t lv_gauge_get_label_count(const lv_obj_t * gauge)
* @return pointer to an `lv_img_dsc_t` variable or a path to an image
* (not an `lv_img` object). `NULL` if not used.
*/
const void * lv_gauge_get_needle_img(lv_obj_t * gauge, const void * img, lv_coord_t pivot_x, lv_coord_t pivot_y)
const void * lv_gauge_get_needle_img(lv_obj_t * gauge)
{
LV_ASSERT_OBJ(gauge, LV_OBJX_NAME);

View File

@@ -246,7 +246,7 @@ static inline uint16_t lv_gauge_get_angle_offset(lv_obj_t * gauge)
* @return pointer to an `lv_img_dsc_t` variable or a path to an image
* (not an `lv_img` object). `NULL` if not used.
*/
const void * lv_gauge_get_needle_img(lv_obj_t * gauge, const void * img, lv_coord_t pivot_x, lv_coord_t pivot_y);
const void * lv_gauge_get_needle_img(lv_obj_t * gauge);
/**
* Get the X coordinate of the rotation center of the needle image

View File

@@ -1233,7 +1233,7 @@ static void lv_label_refr_text(lv_obj_t * label)
lv_anim_set_playback_time(&a, a.time);
lv_anim_t * anim_cur = lv_anim_get(label, (lv_anim_exec_xcb_t)lv_label_set_offset_x);
uint32_t act_time = 0;
int32_t act_time = 0;
bool playback_now = false;
if(anim_cur) {
act_time = anim_cur->act_time;
@@ -1268,7 +1268,7 @@ static void lv_label_refr_text(lv_obj_t * label)
lv_anim_set_playback_time(&a, a.time);
lv_anim_t * anim_cur = lv_anim_get(label, (lv_anim_exec_xcb_t)lv_label_set_offset_y);
uint32_t act_time = 0;
int32_t act_time = 0;
bool playback_now = false;
if(anim_cur) {
act_time = anim_cur->act_time;
@@ -1311,7 +1311,7 @@ static void lv_label_refr_text(lv_obj_t * label)
lv_anim_set_time(&a, lv_anim_speed_to_time(ext->anim_speed, a.start, a.end));
lv_anim_t * anim_cur = lv_anim_get(label, (lv_anim_exec_xcb_t)lv_label_set_offset_x);
uint32_t act_time = anim_cur ? anim_cur->act_time : 0;
int32_t act_time = anim_cur ? anim_cur->act_time : 0;
if(act_time < a.time) {
a.act_time = act_time; /*To keep the old position*/
a.early_apply = 0;
@@ -1332,7 +1332,7 @@ static void lv_label_refr_text(lv_obj_t * label)
lv_anim_set_time(&a, lv_anim_speed_to_time(ext->anim_speed, a.start, a.end));
lv_anim_t * anim_cur = lv_anim_get(label, (lv_anim_exec_xcb_t)lv_label_set_offset_y);
uint32_t act_time = anim_cur ? anim_cur->act_time : 0;
int32_t act_time = anim_cur ? anim_cur->act_time : 0;
if(act_time < a.time) {
a.act_time = act_time; /*To keep the old position*/
a.early_apply = 0;

View File

@@ -654,7 +654,8 @@ void lv_page_start_edge_flash(lv_obj_t * page, lv_page_edge_t edge)
}
#else
(void)page; /*Unused*/
LV_UNUSED(page);
LV_UNUSED(edge);
#endif
}

View File

@@ -174,7 +174,7 @@ void lv_spinbox_set_digit_format(lv_obj_t * spinbox, uint8_t digit_count, uint8_
if(separator_position > LV_SPINBOX_MAX_DIGIT_COUNT) separator_position = LV_SPINBOX_MAX_DIGIT_COUNT;
if(digit_count < LV_SPINBOX_MAX_DIGIT_COUNT) {
uint64_t max_val = _lv_pow(10, digit_count);
int64_t max_val = _lv_pow(10, digit_count);
if(ext->range_max > max_val - 1) ext->range_max = max_val - 1;
if(ext->range_min < - max_val + 1) ext->range_min = - max_val + 1;
}

View File

@@ -152,6 +152,7 @@ lv_obj_t * lv_tileview_create(lv_obj_t * par, const lv_obj_t * copy)
*/
void lv_tileview_add_element(lv_obj_t * tileview, lv_obj_t * element)
{
LV_UNUSED(tileview);
LV_ASSERT_OBJ(tileview, LV_OBJX_NAME);
LV_ASSERT_NULL(tileview);

View File

@@ -5,13 +5,11 @@ CC ?= gcc
LVGL_DIR ?= ${shell pwd}/../..
LVGL_DIR_NAME ?= lvgl
WARNINGS ?= -Werror -Wall -Wextra \
-Wshadow -Wundef -Wmaybe-uninitialized -Wmissing-prototypes -Wno-discarded-qualifiers \
-Wno-unused-function -Wno-error=strict-prototypes -Wpointer-arith -fno-strict-aliasing -Wno-error=cpp -Wuninitialized \
-Wno-unused-parameter -Wno-missing-field-initializers -Wno-format-nonliteral -Wno-cast-qual -Wunreachable-code -Wno-switch-default \
-Wreturn-type -Wmultichar -Wformat-security -Wno-ignored-qualifiers -Wno-error=pedantic -Wno-sign-compare -Wno-error=missing-prototypes -Wdouble-promotion -Wclobbered -Wdeprecated \
WARNINGS = -Werror -Wall -Wextra \
-Wshadow -Wundef -Wmaybe-uninitialized -Wmissing-prototypes -Wpointer-arith -Wuninitialized \
-Wunreachable-code -Wreturn-type -Wmultichar -Wformat-security -Wdouble-promotion -Wclobbered -Wdeprecated \
-Wempty-body -Wshift-negative-value -Wstack-usage=2048 \
-Wtype-limits -Wsizeof-pointer-memaccess -Wpointer-arith
-Wtype-limits -Wsizeof-pointer-memaccess
#-Wno-unused-value -Wno-unused-parameter
OPTIMIZATION ?= -O3 -g0

View File

@@ -11,7 +11,7 @@ optimization = '"-O3 -g0"'
def build(name, defines):
global warnings, base_defines, optimization
global base_defines, optimization
print("=============================")
print(name)

View File

@@ -48,9 +48,9 @@ typedef struct {
* STATIC PROTOTYPES
**********************/
static void read_png_file(png_img_t * p, const char* file_name);
static void write_png_file(png_img_t * p, const char* file_name);
//static void write_png_file(png_img_t * p, const char* file_name);
static void png_release(png_img_t * p);
static void process_file(png_img_t * p);
//static void process_file(png_img_t * p);
/**********************
* STATIC VARIABLES
@@ -254,59 +254,59 @@ static void read_png_file(png_img_t * p, const char* file_name)
fclose(fp);
}
static void write_png_file(png_img_t * p, const char* file_name)
{
/* create file */
FILE *fp = fopen(file_name, "wb");
if (!fp)
lv_test_exit("[write_png_file] File %s could not be opened for writing", file_name);
/* initialize stuff */
p->png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!p->png_ptr)
lv_test_exit("[write_png_file] png_create_write_struct failed");
p->info_ptr = png_create_info_struct(p->png_ptr);
if (!p->info_ptr)
lv_test_exit("[write_png_file] png_create_info_struct failed");
if (setjmp(png_jmpbuf(p->png_ptr)))
lv_test_exit("[write_png_file] Error during init_io");
png_init_io(p->png_ptr, fp);
/* write header */
if (setjmp(png_jmpbuf(p->png_ptr)))
lv_test_exit("[write_png_file] Error during writing header");
png_set_IHDR(p->png_ptr, p->info_ptr, p->width, p->height,
p->bit_depth, p->color_type, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
png_write_info(p->png_ptr, p->info_ptr);
/* write bytes */
if (setjmp(png_jmpbuf(p->png_ptr)))
lv_test_exit("[write_png_file] Error during writing bytes");
png_write_image(p->png_ptr, p->row_pointers);
/* end write */
if (setjmp(png_jmpbuf(p->png_ptr)))
lv_test_exit("[write_png_file] Error during end of write");
png_write_end(p->png_ptr, NULL);
fclose(fp);
}
//
//
//static void write_png_file(png_img_t * p, const char* file_name)
//{
// /* create file */
// FILE *fp = fopen(file_name, "wb");
// if (!fp)
// lv_test_exit("[write_png_file] File %s could not be opened for writing", file_name);
//
//
// /* initialize stuff */
// p->png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
//
// if (!p->png_ptr)
// lv_test_exit("[write_png_file] png_create_write_struct failed");
//
// p->info_ptr = png_create_info_struct(p->png_ptr);
// if (!p->info_ptr)
// lv_test_exit("[write_png_file] png_create_info_struct failed");
//
// if (setjmp(png_jmpbuf(p->png_ptr)))
// lv_test_exit("[write_png_file] Error during init_io");
//
// png_init_io(p->png_ptr, fp);
//
//
// /* write header */
// if (setjmp(png_jmpbuf(p->png_ptr)))
// lv_test_exit("[write_png_file] Error during writing header");
//
// png_set_IHDR(p->png_ptr, p->info_ptr, p->width, p->height,
// p->bit_depth, p->color_type, PNG_INTERLACE_NONE,
// PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
//
// png_write_info(p->png_ptr, p->info_ptr);
//
//
// /* write bytes */
// if (setjmp(png_jmpbuf(p->png_ptr)))
// lv_test_exit("[write_png_file] Error during writing bytes");
//
// png_write_image(p->png_ptr, p->row_pointers);
//
//
// /* end write */
// if (setjmp(png_jmpbuf(p->png_ptr)))
// lv_test_exit("[write_png_file] Error during end of write");
//
// png_write_end(p->png_ptr, NULL);
//
// fclose(fp);
//}
//
static void png_release(png_img_t * p)
{
int y;
@@ -314,30 +314,30 @@ static void png_release(png_img_t * p)
free(p->row_pointers[y]);
free(p->row_pointers);
}
static void process_file(png_img_t * p)
{
if (png_get_color_type(p->png_ptr, p->info_ptr) == PNG_COLOR_TYPE_RGB)
lv_test_exit("[process_file] input file is PNG_COLOR_TYPE_RGB but must be PNG_COLOR_TYPE_RGBA "
"(lacks the alpha channel)");
if (png_get_color_type(p->png_ptr, p->info_ptr) != PNG_COLOR_TYPE_RGBA)
lv_test_exit("[process_file] color_type of input file must be PNG_COLOR_TYPE_RGBA (%d) (is %d)",
PNG_COLOR_TYPE_RGBA, png_get_color_type(p->png_ptr, p->info_ptr));
int x, y;
for (y=0; y<p->height; y++) {
png_byte* row = p->row_pointers[y];
for (x=0; x<p->width; x++) {
png_byte* ptr = &(row[x*4]);
printf("Pixel at position [ %d - %d ] has RGBA values: %d - %d - %d - %d\n",
x, y, ptr[0], ptr[1], ptr[2], ptr[3]);
/* set red value to 0 and green value to the blue one */
ptr[0] = 0;
ptr[1] = ptr[2];
}
}
}
//
//static void process_file(png_img_t * p)
//{
// if (png_get_color_type(p->png_ptr, p->info_ptr) == PNG_COLOR_TYPE_RGB)
// lv_test_exit("[process_file] input file is PNG_COLOR_TYPE_RGB but must be PNG_COLOR_TYPE_RGBA "
// "(lacks the alpha channel)");
//
// if (png_get_color_type(p->png_ptr, p->info_ptr) != PNG_COLOR_TYPE_RGBA)
// lv_test_exit("[process_file] color_type of input file must be PNG_COLOR_TYPE_RGBA (%d) (is %d)",
// PNG_COLOR_TYPE_RGBA, png_get_color_type(p->png_ptr, p->info_ptr));
//
// int x, y;
// for (y=0; y<p->height; y++) {
// png_byte* row = p->row_pointers[y];
// for (x=0; x<p->width; x++) {
// png_byte* ptr = &(row[x*4]);
// printf("Pixel at position [ %d - %d ] has RGBA values: %d - %d - %d - %d\n",
// x, y, ptr[0], ptr[1], ptr[2], ptr[3]);
//
// /* set red value to 0 and green value to the blue one */
// ptr[0] = 0;
// ptr[1] = ptr[2];
// }
// }
//}
#endif

View File

@@ -40,6 +40,8 @@ static void hal_init(void)
static void dummy_flush_cb(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{
LV_UNUSED(area);
LV_UNUSED(color_p);
lv_disp_flush_ready(disp_drv);
}