linux-msm / qdl

BSD 3-Clause "New" or "Revised" License
196 stars 76 forks source link

Fix gcc-14 compile errors #55

Closed quincyf467 closed 2 months ago

quincyf467 commented 3 months ago

this fails to compile using gcc-14 without including stdlib.h in the following files.

quincyf467 commented 3 months ago

patch.c: In function ‘attr_as_unsigned’: patch.c:49:16: error: implicit declaration of function ‘strtoul’; did you mean ‘strtok’? [-Wimplicit-function-declaration[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration]] 49 | return strtoul((char*)value, NULL, 10); | ^~~ | strtok patch.c: In function ‘patch_load’: patch.c:89:25: error: implicit declaration of function ‘calloc’ [-Wimplicit-function-declaration[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration]] 89 | patch = calloc(1, sizeof(struct patch)); | ^~ patch.c:37:8: note: include ‘’ or provide a declaration of ‘calloc’ 36 | #include "patch.h" +++ |+#include 37 | patch.c:89:25: warning: incompatible implicit declaration of built-in function ‘calloc’ [-Wbuiltin-declaration-mismatch[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wbuiltin-declaration-mismatch]] 89 | patch = calloc(1, sizeof(struct patch)); | ^~ patch.c:89:25: note: include ‘’ or provide a declaration of ‘calloc’ patch.c:102:25: error: implicit declaration of function ‘free’ [-Wimplicit-function-declaration[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration]] 102 | free(patch); | ^~~~ patch.c:102:25: note: include ‘’ or provide a declaration of ‘free’ patch.c:102:25: warning: incompatible implicit declaration of built-in function ‘free’ [-Wbuiltin-declaration-mismatch[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wbuiltin-declaration-mismatch]] patch.c:102:25: note: include ‘’ or provide a declaration of ‘free’ make: [: patch.o] Error 1 make: Waiting for unfinished jobs.... sahara.c: In function ‘sahara_hello’: sahara.c:103:9: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wno-unused-result]] 103 | write(fd, &resp, resp.length); | ^~~~~~~~~ sahara.c: In function ‘sahara_eoi’: sahara.c:182:9: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wno-unused-result]] 182 | write(fd, &done, done.length); | ^~~~~~~~~ program.c: In function ‘attr_as_unsigned’: program.c:51:16: error: implicit declaration of function ‘strtoul’; did you mean ‘strtok’? [-Wimplicit-function-declaration[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration]] 51 | return strtoul((char*)value, NULL, 10); | ^~~ | strtok program.c: In function ‘program_load’: program.c:105:27: error: implicit declaration of function ‘calloc’ [-Wimplicit-function-declaration[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration]] 105 | program = calloc(1, sizeof(struct program)); | ^~ program.c:39:8: note: include ‘’ or provide a declaration of ‘calloc’ 38 | #include "program.h" +++ |+#include 39 | program.c:105:27: warning: incompatible implicit declaration of built-in function ‘calloc’ [-Wbuiltin-declaration-mismatch[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wbuiltin-declaration-mismatch]] 105 | program = calloc(1, sizeof(struct program)); | ^~ program.c:105:27: note: include ‘’ or provide a declaration of ‘calloc’ program.c:120:25: error: implicit declaration of function ‘free’ [-Wimplicit-function-declaration[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration]] 120 | free(program); | ^~~~ program.c:120:25: note: include ‘’ or provide a declaration of ‘free’ program.c:120:25: warning: incompatible implicit declaration of built-in function ‘free’ [-Wbuiltin-declaration-mismatch[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wbuiltin-declaration-mismatch]] program.c:120:25: note: include ‘’ or provide a declaration of ‘free’

quincyf467 commented 3 months ago

this happens in version 1.0 and also on the latest commit