commit: 62f501f0b29cd88ed4fd4ed6d252dcd62a42b954
parent: 34dc34c156d68e59255fa37b8d2b29f6091a474d
author: Brian Callahan <bcallah@openbsd.org>
date: Tue, 16 Jan 2018 23:16:58 -0500
Last commit added a function declared __dead which is a synonym for __attribute__((__no_return__)).
Check for it in configure as well as the FreeBSD synonym __dead2.
Fall back to __attribute__((__no_return__)) if you don't have either.
1 file changed, 47 insertions(+)
diff --git a/configure b/configure
@@ -51,6 +51,36 @@ EOF
fi
}
+deadcheck() {
+ cat << EOF > conftest.c
+#include <stdlib.h>
+__dead usage(void){exit(1);}int main(void){usage();return 0;}
+EOF
+ $cc $tflags -o conftest conftest.c > /dev/null 2>&1
+ if [ $? -eq 0 ] ; then
+ rm -f conftest conftest.c
+ return 0
+ else
+ rm -f conftest conftest.c
+ return 1
+ fi
+}
+
+dead2check() {
+ cat << EOF > conftest.c
+#include <stdlib.h>
+__dead2 usage(void){exit(1);}int main(void){usage();return 0;}
+EOF
+ $cc $tflags -o conftest conftest.c > /dev/null 2>&1
+ if [ $? -eq 0 ] ; then
+ rm -f conftest conftest.c
+ return 0
+ else
+ rm -f conftest conftest.c
+ return 1
+ fi
+}
+
pledgecheck() {
cat << EOF > conftest.c
#include <unistd.h>
@@ -332,6 +362,23 @@ cat << EOF > pconfig.h
EOF
+printf "checking for __dead... "
+deadcheck
+if [ $? -eq 0 ] ; then
+ echo "yes"
+else
+ echo "no"
+ printf "checking for __dead2... "
+ dead2check
+ if [ $? -eq 0 ] ; then
+ echo "#define __dead __dead2" >> pconfig.h
+ echo "yes"
+ else
+ echo "#define __dead __attribute__((__no_return__))" >> pconfig.h
+ echo "no"
+ fi
+fi
+
printf "checking for confstr... "
confstrcheck
if [ $? -eq 0 ] ; then