I use C to create bags. I get an error message parameter 'light_bitmap' set but not used [-Werror=unused-but-set-parameter]
. However, the variable is used in my function. I am not sure what this message means. Below is the code I have:
In the header declaration:
void backlight_subscribe(GBitmap *light_bitmap, int start_hour, int end_hour);
In the definition of .c:
void backlight_subscribe(GBitmap *light_bitmap, int start_hour, int end_hour) {
int hour = get_current_hour();
if((hour >= start_hour) || (hour < end_hour)) {
accel_tap_service_subscribe(tap_handler);
light_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_LIGHT_ON_ICON);
} else {
accel_tap_service_unsubscribe();
light_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_LIGHT_OFF_ICON);
}
}
and in main.c:
static GBitmap *light_bitmap;
...
static void window_load(Window *window) {
...
backlight_subscribe(light_bitmap, 22, 8);
...
}
static void init(void) {
s_main_window = window_create();
window_set_window_handlers(s_main_window, (WindowHandlers) {
.load = window_load,
.unload = window_unload,
});
window_stack_push(s_main_window, false);
}
...
int main(void) {
init();
app_event_loop();
deinit();
}
Full error message:
[16/28] c: src/accel_sensor.c -> build/src/accel_sensor.c.16.o
../src/accel_sensor.c: In function 'backlight_subscribe':
../src/accel_sensor.c:22:35: error: parameter 'light_bitmap' set but not used [-Werror=unused-but-set-parameter]
void backlight_subscribe(GBitmap *light_bitmap, int start_hour, int end_hour) {
^
cc1: all warnings being treated as errors
Waf: Leaving directory `/home/adminuser/pebble/pebble-app/watchface/build'
Build failed
Can anyone see where I am doing wrong?
source
share