GIMP 2.10 build: compiler warnings at build configuration time from C source in configure.ac using newer compilers GCC 13 and Clang15
GIMP configuration warnings appear when GCC-13 (and Clang 15) is used:
conftest.c:74:13: warning: function declaration isn't a prototype [-Wstrict-prototypes]
74 | int main()
| ^~~~
conftest.c: In function 'main':
conftest.c:74:13: warning: old-style function definition [-Wold-style-definition]
conftest.c:80:11: warning: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
80 | exit (2);
| ^~~~
conftest.c:74:8: note: include '<stdlib.h>' or provide a declaration of 'exit'
73 | #include <sys/shm.h>
+++ |+#include <stdlib.h>
74 | int main()
conftest.c:80:11: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
80 | exit (2);
| ^~~~
conftest.c:80:11: note: include '<stdlib.h>' or provide a declaration of 'exit'
conftest.c:79:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
79 | if (id == -1)
| ^~
conftest.c:81:11: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
81 | shmaddr = shmat (id, 0, 0);
| ^~~~~~~
conftest.c:86:13: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
86 | exit (1);
| ^~~~
conftest.c:86:13: note: include '<stdlib.h>' or provide a declaration of 'exit'
conftest.c:90:11: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
90 | exit (0);
| ^~~~
conftest.c:90:11: note: include '<stdlib.h>' or provide a declaration of 'exit'
Sorry I have problems with push commits to my fork using ssh-key therefore I attach patch to fix here: gimp-2.10_fix_configure_GCC13_implicit_function_declarations.patch
Gentoo issue: https://bugs.gentoo.org/899796
diff -Naur a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1291,13 +1291,14 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
- int main()
+ #include <stdlib.h>
+ int main(void)
{
int id;
char *shmaddr;
- id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0600);
- if (id == -1)
- exit (2);
+ id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0600);
+ if (id == -1)
+ exit (2);
shmaddr = shmat (id, 0, 0);
shmctl (id, IPC_RMID, 0);
if ((char*) shmat (id, 0, 0) == (char*) -1)