Also use -Werror only in DEBUG builds, otherwise normal builds fail with:
src/am7xxx.c:42:13: error: ‘dump_header’ defined but not used [-Werror=unused-function]
src/am7xxx.c:73:13: error: ‘dump_buffer’ defined but not used [-Werror=unused-function]
add_flags(CMAKE_C_FLAGS
-fno-common
-Wall
- -Werror
-Wextra
-Wformat=2
-Winit-self
)
endif()
-set(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG=1")
+set(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG=1 -Werror")
set(CMAKE_C_FLAGS_RELEASE "-O2")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
int ret;
int transferred;
+#if DEBUG
dump_buffer(buffer, len);
+ printf("\n");
+#endif
ret = libusb_bulk_transfer(dev, 1, buffer, len, &transferred, 0);
if (ret != 0 || (unsigned int)transferred != len) {
uint8_t *buffer;
int ret;
+#if DEBUG
+ dump_header(h);
+ printf("\n");
+#endif
+
buffer = calloc(AM7XXX_HEADER_WIRE_SIZE, 1);
if (buffer == NULL) {
perror("calloc buffer");
},
};
- dump_header(&h);
- printf("\n");
-
- printf("Dump Buffers\n");
- dump_buffer(reference_image_header, sizeof(struct am7xxx_header));
-
ret = send_header(dev, &h);
if (ret < 0)
return ret;