matlo / GIMX

The GIMX software.
GNU General Public License v3.0
590 stars 105 forks source link

Build failed gcc 12 #700

Open Filin3 opened 2 years ago

Filin3 commented 2 years ago

software: OS: Arch Linux gcc 12.2.0 g++ 12.2.0

commands: git clone https://github.com/matlo/GIMX.git git submodule init git submodule update make

make output:

cc -fPIC -Iinclude -Wall -Wextra -Werror -O3 -I../ -DGLOG_NAME=gimxcontroller -c -o src/controller.o src/controller.c src/controller.c: In function ‘controller_get_axis_index’: src/controller.c:361:10: error: the comparison will always evaluate as ‘true’ for the address of ‘name’ will never be NULL [-Werror=address] 361 | if(controllers[C_TYPE_SIXAXIS]->axes[i].name) | ^~~ In file included from src/controller.c:6: src/../include/controller.h:46:14: note: ‘name’ declared here 46 | const char name[AXIS_NAME_MAX_SIZE]; | ^~~~

In function ‘get_string_descriptor’, inlined from ‘get_string_descriptor’ at src/gusb.c:523:12: src/gusb.c:569:120: error: pointer ‘data’ may be used after ‘realloc’ [-Werror=use-after-free] 569 | LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_STRING << 8) | index, descriptors->langId0.wData[0], data, descriptor->bLength, DEFAULT_TIMEOUT); | ~~^~~~~ src/gusb.c:559:18: note: call to ‘realloc’ here 559 | void ptr = realloc(data, descriptor->bLength sizeof(*data)); | ^~~~~~~~~~~~~~