The get_cpu_type function produces compilation warnings related to a missing pre-processor directive declaration:
detect-cpu.c: In function ‘get_cpu_type’:
detect-cpu.c:26:13: warning: implicit declaration of function ‘strncmp’ [-Wimplicit-function-declaration]
26 | if (strncmp(line, "model name", 10) == 0)
| ^~~~~~~
detect-cpu.c:9:1: note: include ‘<string.h>’ or provide a declaration of ‘strncmp’
8 | #include <sys/sysinfo.h>
+++ |+#include <string.h>
9 |
detect-cpu.c:26:41: warning: ‘strncmp’ argument 3 type is ‘int’ where ‘long unsigned int’ is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
26 | if (strncmp(line, "model name", 10) == 0)
| ^~
<built-in>: note: built-in ‘strncmp’ declared here
detect-cpu.c:28:23: warning: implicit declaration of function ‘strchr’ [-Wimplicit-function-declaration]
28 | cputype = strchr(line, ':') + 2;
| ^~~~~~
detect-cpu.c:28:23: note: include ‘<string.h>’ or provide a declaration of ‘strchr’
detect-cpu.c:28:23: warning: incompatible implicit declaration of built-in function ‘strchr’ [-Wbuiltin-declaration-mismatch]
detect-cpu.c:28:23: note: include ‘<string.h>’ or provide a declaration of ‘strchr’
The compiler recommends we add #include <string.h> for strncmp and strchr declarations.
The
get_cpu_typefunction produces compilation warnings related to a missing pre-processor directive declaration:The compiler recommends we add
#include <string.h>forstrncmpandstrchrdeclarations.