summary refs log tree commit diff
diff options
context:
space:
mode:
authorZ. Liu <zhixu.liu@gmail.com>2024-08-24 23:01:29 +0800
committerGerrit Pape <pape@smarden.org>2024-09-25 22:14:00 +0000
commit8aaa59ec8d096d892b315c8fe691c4eca306ba01 (patch)
tree99d43257189c7bf78579141e277b9ff37c4b2623
parent1fea9d47117eebcd1cb3e1bf259fa1cc5d4895ec (diff)
downloadrunit-8aaa59ec8d096d892b315c8fe691c4eca306ba01.tar.gz
runit-8aaa59ec8d096d892b315c8fe691c4eca306ba01.tar.xz
runit-8aaa59ec8d096d892b315c8fe691c4eca306ba01.zip
fix undesired compilation error(s) of feature test
If don't fix, the feature test will generate undesired .h which will be used
in later compilation, some will cause build failed.

see *.h{1,2} for details, run following cmd to see difference:
  diff -uprN <(more *.h1|sed 's:\.h1$:.h:g') <(more *.h2|sed 's:\.h2$:.h:g')

found by using clang 18 with CFLAGS: -Wall

link of debian's patches is: https://salsa.debian.org/debian/runit/-/tree/master/debian/patches
  0029-fix-ftbfs-with-gcc14.patch

chkshsgr.c trycpp.c trypoll.c tryshsgr.c tryulong64.c:
  error: call to undeclared function '...'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  functions are: _exit, exit, getgroups, printf, setgroups

tryflock.c trysgact.c trysgprm.c trywaitp.c:
  error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
-rw-r--r--src/chkshsgr.c1
-rw-r--r--src/trycpp.c3
-rw-r--r--src/tryflock.c2
-rw-r--r--src/trypoll.c1
-rw-r--r--src/trysgact.c2
-rw-r--r--src/trysgprm.c2
-rw-r--r--src/tryshsgr.c3
-rw-r--r--src/tryulong64.c2
-rw-r--r--src/trywaitp.c2
9 files changed, 14 insertions, 4 deletions
diff --git a/src/chkshsgr.c b/src/chkshsgr.c
index 38c352d..a33403b 100644
--- a/src/chkshsgr.c
+++ b/src/chkshsgr.c
@@ -1,6 +1,7 @@
 /* Public domain. */
 
 #include <unistd.h>
+#include <grp.h>
 
 int main()
 {
diff --git a/src/trycpp.c b/src/trycpp.c
index e4503d4..70bc8d6 100644
--- a/src/trycpp.c
+++ b/src/trycpp.c
@@ -1,5 +1,8 @@
 /* Public domain. */
 
+#include <stdio.h>
+#include <stdlib.h>
+
 int main()
 {
 #ifdef NeXT
diff --git a/src/tryflock.c b/src/tryflock.c
index a82ffc2..68599d3 100644
--- a/src/tryflock.c
+++ b/src/tryflock.c
@@ -4,7 +4,7 @@
 #include <sys/file.h>
 #include <fcntl.h>
 
-main()
+int main()
 {
   flock(0,LOCK_EX | LOCK_UN | LOCK_NB);
 }
diff --git a/src/trypoll.c b/src/trypoll.c
index 6506617..ae36929 100644
--- a/src/trypoll.c
+++ b/src/trypoll.c
@@ -1,5 +1,6 @@
 /* Public domain. */
 
+#include <unistd.h>
 #include <sys/types.h>
 #include <fcntl.h>
 #include <poll.h>
diff --git a/src/trysgact.c b/src/trysgact.c
index e264ef2..841b88a 100644
--- a/src/trysgact.c
+++ b/src/trysgact.c
@@ -2,7 +2,7 @@
 
 #include <signal.h>
 
-main()
+int main()
 {
   struct sigaction sa;
   sa.sa_handler = 0;
diff --git a/src/trysgprm.c b/src/trysgprm.c
index a46c82c..3e78a82 100644
--- a/src/trysgprm.c
+++ b/src/trysgprm.c
@@ -2,7 +2,7 @@
 
 #include <signal.h>
 
-main()
+int main()
 {
   sigset_t ss;
  
diff --git a/src/tryshsgr.c b/src/tryshsgr.c
index c5ed6d6..1bb5f61 100644
--- a/src/tryshsgr.c
+++ b/src/tryshsgr.c
@@ -1,5 +1,8 @@
 /* Public domain. */
 
+#include <unistd.h>
+#include <grp.h>
+
 int main()
 {
   short x[4];
diff --git a/src/tryulong64.c b/src/tryulong64.c
index 003548a..a4b9839 100644
--- a/src/tryulong64.c
+++ b/src/tryulong64.c
@@ -1,5 +1,7 @@
 /* Public domain. */
 
+#include <unistd.h>
+
 int main()
 {
   unsigned long u;
diff --git a/src/trywaitp.c b/src/trywaitp.c
index 319b81f..76b3329 100644
--- a/src/trywaitp.c
+++ b/src/trywaitp.c
@@ -3,7 +3,7 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 
-main()
+int main()
 {
   waitpid(0,0,0);
 }