aboutsummaryrefslogtreecommitdiffstats
path: root/main/openntpd/fix-__dead-macro.patch
blob: 56e711da79654282eb10c90f4e5b588c4b56ec89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
From 17aa5d98191c4dc85d0645443fc97a12601ae8da Mon Sep 17 00:00:00 2001
From: Baruch Siach <baruch@tkos.co.il>
Date: Tue, 26 Sep 2017 14:55:31 +0300
Subject: [PATCH] Revert "use __dead macro from sys/cdefs.h"

This partially reverts commit a7577667d673f49800e15461fe384817a1572eae.

The musl C library does not use an internal cdefs.h header. As a result,
the definitions in sys/cdefs.h have no effect. This breads the build as
follows:

In file included from adjfreq_linux.c:23:0:
../src/ntpd.h:448:8: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
 __dead void fatal(const char *, ...)
        ^~~~
../src/ntpd.h:450:8: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
 __dead void fatalx(const char *, ...)
        ^~~~

Refer the related musl FAQ about cdefs.h:

  http://wiki.musl-libc.org/wiki/FAQ#Q:_I.27m_trying_to_compile_something_against_musl_and_I_get_error_messages_about_sys.2Fcdefs.h

Keep the compiler attribute definition.

Remove also from noinst_HEADERS.

diff --git a/include/Makefile.am b/include/Makefile.am
index a552026..3a5a016 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,6 +1,5 @@
 noinst_HEADERS =
 noinst_HEADERS += machine/endian.h
-noinst_HEADERS += sys/cdefs.h
 noinst_HEADERS += sys/queue.h
 noinst_HEADERS += sys/socket.h
 noinst_HEADERS += sys/types.h
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
deleted file mode 100644
index 3dec43d..0000000
--- a/include/sys/cdefs.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Public domain
- * sys/cdefs.h compatibility shim
- */
-
-#include_next <sys/cdefs.h>
-
-#ifndef LIBCOMPAT_SYS_CDEFS_H
-#define LIBCOMPAT_SYS_CDEFS_H
-
-#if !defined(HAVE_ATTRIBUTE__DEAD) && !defined(__dead)
-#define __dead          __attribute__((__noreturn__))
-#define __pure          __attribute__((__const__))
-#endif
-
-#endif
diff --git a/include/sys/types.h b/include/sys/types.h
index 56aef0b..86821c7 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -14,6 +14,10 @@
 #include <_bsd_types.h>
 #endif
 
+#if !defined(HAVE_ATTRIBUTE__DEAD) && !defined(__dead)
+#define __dead		__attribute__((__noreturn__))
+#endif
+
 #if !defined(HAVE_ATTRIBUTE__BOUNDED__) && !defined(__bounded__)
 # define __bounded__(x, y, z)
 #endif
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -264,7 +264,7 @@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-noinst_HEADERS = machine/endian.h sys/cdefs.h sys/queue.h sys/socket.h \
+noinst_HEADERS = machine/endian.h sys/queue.h sys/socket.h \
 	sys/types.h sys/time.h sys/mman.h sys/wait.h err.h ifaddrs.h \
 	imsg.h md5.h sha2.h signal.h sha2_openbsd.h Makefile.in \
 	paths.h poll.h stdio.h stdlib.h string.h time.h tls.h unistd.h