[Git][NTPsec/ntpsec][master] 3 commits: Typo in comment

Eric S. Raymond gitlab at mg.gitlab.com
Fri Dec 2 07:36:44 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
143c3fae by Matt Selsky at 2016-12-02T01:58:26-05:00
Typo in comment

- - - - -
87e23bfc by Matt Selsky at 2016-12-02T01:58:26-05:00
Clean up function declarations in wafhelper probes

Fixes:
warning: function declaration isn't a prototype

- - - - -
2c2161fc by Eric S. Raymond at 2016-12-02T02:35:57-05:00
Isolate one of our platform dependencies.

- - - - -


14 changed files:

- include/ntpd.h
- ntpd/ntp_io.c
- + ntpd/ntp_packetstamp.c
- ntpd/wscript
- pylib/statfiles.py
- wafhelpers/check_multicast.py
- wafhelpers/check_openssl.py
- wafhelpers/check_pthread.py
- wafhelpers/check_sizeof.py
- wafhelpers/check_sockaddr.py
- wafhelpers/check_structfield.py
- wafhelpers/check_type.py
- wafhelpers/check_vsprintfm.py
- wafhelpers/probes.py


Changes:

=====================================
include/ntpd.h
=====================================
--- a/include/ntpd.h
+++ b/include/ntpd.h
@@ -245,6 +245,10 @@ extern	char *	fstostr(time_t);	/* NTP timescale seconds */
 void packet_dump(char *, size_t, struct pkt *, size_t);
 size_t packet_undump(char *, int len, char *);
 
+/* packetstamp.c */
+extern void	enable_packetstamps(int, sockaddr_u *);
+extern l_fp	fetch_packetstamp(struct recvbuf *, struct msghdr *, l_fp);
+
 /*
  * Signals we catch for debugging.
  */


=====================================
ntpd/ntp_io.c
=====================================
--- a/ntpd/ntp_io.c
+++ b/ntpd/ntp_io.c
@@ -1,6 +1,5 @@
 /*
- * ntp_io.c - input/output routines for ntpd.	The socket-opening code
- *		   was shamelessly stolen from ntpd.
+ * ntp_io.c - input/output routines for ntpd.
  */
 
 #include <config.h>
@@ -98,35 +97,6 @@ struct nic_rule_tag {
  */
 nic_rule *nic_rule_list;
 
-
-#if defined(SO_BINTIME) && defined(SCM_BINTIME) && defined(CMSG_FIRSTHDR)
-#  define USE_PACKET_TIMESTAMP
-#  define USE_SCM_BINTIME
-#  ifdef OVERRIDE_BINTIME_CTLMSGBUF_SIZE
-#   define CMSG_BUFSIZE OVERRIDE_BINTIME_CTLMSGBUF_SIZE
-#  else
-#   define CMSG_BUFSIZE  1536 /* moderate default */
-#  endif
-#elif defined(SO_TIMESTAMPNS) && defined(SCM_TIMESTAMPNS) && defined(CMSG_FIRSTHDR)
-#  define USE_PACKET_TIMESTAMP
-#  define USE_SCM_TIMESTAMPNS
-#  ifdef OVERRIDE_TIMESTAMPNS_CTLMSGBUF_SIZE
-#   define CMSG_BUFSIZE OVERRIDE_TIMESTAMPNS_CTLMSGBUF_SIZE
-#  else
-#   define CMSG_BUFSIZE  1536 /* moderate default */
-#  endif
-#elif defined(SO_TIMESTAMP) && defined(SCM_TIMESTAMP) && defined(CMSG_FIRSTHDR)
-#  define USE_PACKET_TIMESTAMP
-#  define USE_SCM_TIMESTAMP
-#  ifdef OVERRIDE_TIMESTAMP_CTLMSGBUF_SIZE
-#   define CMSG_BUFSIZE OVERRIDE_TIMESTAMP_CTLMSGBUF_SIZE
-#  else
-#   define CMSG_BUFSIZE  1536 /* moderate default */
-#  endif
-#else
-/* fill in for old/other timestamp interfaces */
-#endif
-
 /*
  * This code is a remnant from when ntpd did asynchronous input using
  * the SIGIO facility.  Most of that complexity is gone now.
@@ -2921,43 +2891,10 @@ open_socket(
 		return INVALID_SOCKET;
 	}
 
-#ifdef USE_SCM_TIMESTAMP
-	{
-		if (setsockopt(fd, SOL_SOCKET, SO_TIMESTAMP,
-			       (char*)&on, sizeof(on)))
-			msyslog(LOG_DEBUG,
-				"setsockopt SO_TIMESTAMP on fails on address %s: %m",
-				socktoa(addr));
-		else
-			DPRINTF(4, ("setsockopt SO_TIMESTAMP enabled on fd %d address %s\n",
-				    fd, socktoa(addr)));
-	}
-#endif
-#ifdef USE_SCM_TIMESTAMPNS
-	{
-		if (setsockopt(fd, SOL_SOCKET, SO_TIMESTAMPNS,
-			       (char*)&on, sizeof(on)))
-			msyslog(LOG_DEBUG,
-				"setsockopt SO_TIMESTAMPNS on fails on address %s: %m",
-				socktoa(addr));
-		else
-			DPRINTF(4, ("setsockopt SO_TIMESTAMPNS enabled on fd %d address %s\n",
-				    fd, socktoa(addr)));
-	}
-#endif
-#ifdef USE_SCM_BINTIME
-	{
-		if (setsockopt(fd, SOL_SOCKET, SO_BINTIME,
-			       (char*)&on, sizeof(on)))
-			msyslog(LOG_DEBUG,
-				"setsockopt SO_BINTIME on fails on address %s: %m",
-				socktoa(addr));
-		else
-			DPRINTF(4, ("setsockopt SO_BINTIME enabled on fd %d address %s\n",
-				    fd, socktoa(addr)));
-	}
-#endif
-
+#ifdef USE_PACKET_TIMESTAMP
+	enable_packetstamps(fd);
+#endif /* USE_PACKET_TIMESTAMP */
+	
 	DPRINTF(4, ("bind(%d) AF_INET%s, addr %s%%%d#%d, flags 0x%x\n",
 		   fd, IS_IPV6(addr) ? "6" : "", socktoa(addr),
 		   SCOPE(addr), SRCPORT(addr), interf->flags));
@@ -3143,130 +3080,6 @@ read_refclock_packet(
 }
 #endif	/* REFCLOCK */
 
-
-#ifdef USE_PACKET_TIMESTAMP
-/*
- * extract timestamps from control message buffer
- */
-static l_fp
-fetch_timestamp(
-	struct recvbuf *	rb,
-	struct msghdr *		msghdr,
-	l_fp			ts
-	)
-{
-	struct cmsghdr *	cmsghdr;
-#ifdef USE_SCM_BINTIME
-	struct bintime *	btp;
-#endif
-#ifdef USE_SCM_TIMESTAMPNS
-	struct timespec *	tsp;
-#endif
-#ifdef USE_SCM_TIMESTAMP
-	struct timeval *	tvp;
-#endif
-	unsigned long		ticks;
-	double			fuzz;
-	l_fp			lfpfuzz;
-	l_fp			nts;
-#ifdef ENABLE_DEBUG_TIMING
-	l_fp			dts;
-#endif
-
-#ifndef ENABLE_DEBUG_TIMING
-	UNUSED_ARG(rb);
-#endif
-
-	cmsghdr = CMSG_FIRSTHDR(msghdr);
-	while (cmsghdr != NULL) {
-		switch (cmsghdr->cmsg_type)
-		{
-#ifdef USE_SCM_BINTIME
-		case SCM_BINTIME:
-#endif  /* USE_SCM_BINTIME */
-#ifdef USE_SCM_TIMESTAMPNS
-		case SCM_TIMESTAMPNS:
-#endif	/* USE_SCM_TIMESTAMPNS */
-#ifdef USE_SCM_TIMESTAMP
-		case SCM_TIMESTAMP:
-#endif	/* USE_SCM_TIMESTAMP */
-#if defined(USE_SCM_BINTIME) || defined (USE_SCM_TIMESTAMPNS) || defined(USE_SCM_TIMESTAMP)
-			switch (cmsghdr->cmsg_type)
-			{
-#ifdef USE_SCM_BINTIME
-			case SCM_BINTIME:
-				btp = (struct bintime *)CMSG_DATA(cmsghdr);
-				/*
-				 * bintime documentation is at http://phk.freebsd.dk/pubs/timecounter.pdf
-				 */
-				nts.l_i = btp->sec + JAN_1970;
-				nts.l_uf = (uint32_t)(btp->frac >> 32);
-				if (sys_tick > measured_tick &&
-				    sys_tick > 1e-9) {
-					ticks = (unsigned long)(nts.l_uf / (unsigned long)(sys_tick * FRAC));
-					nts.l_uf = (unsigned long)(ticks * (unsigned long)(sys_tick * FRAC));
-				}
-                                DPRINTF(4, ("fetch_timestamp: system bintime network time stamp: %ld.%09lu\n",
-                                            (long)btp->sec, (unsigned long)((nts.l_uf / FRAC) * 1e9)));
-				break;
-#endif  /* USE_SCM_BINTIME */
-#ifdef USE_SCM_TIMESTAMPNS
-			case SCM_TIMESTAMPNS:
-				tsp = (struct timespec *)CMSG_DATA(cmsghdr);
-				if (sys_tick > measured_tick &&
-				    sys_tick > 1e-9) {
-					ticks = (unsigned long)((tsp->tv_nsec * 1e-9) /
-						       sys_tick);
-					tsp->tv_nsec = (long)(ticks * 1e9 *
-							      sys_tick);
-				}
-				DPRINTF(4, ("fetch_timestamp: system nsec network time stamp: %ld.%09ld\n",
-					    tsp->tv_sec, tsp->tv_nsec));
-				nts = tspec_stamp_to_lfp(*tsp);
-				break;
-#endif	/* USE_SCM_TIMESTAMPNS */
-#ifdef USE_SCM_TIMESTAMP
-			case SCM_TIMESTAMP:
-				tvp = (struct timeval *)CMSG_DATA(cmsghdr);
-				if (sys_tick > measured_tick &&
-				    sys_tick > 1e-6) {
-					ticks = (unsigned long)((tvp->tv_usec * 1e-6) /
-						       sys_tick);
-					tvp->tv_usec = (long)(ticks * 1e6 *
-							      sys_tick);
-				}
-				DPRINTF(4, ("fetch_timestamp: system usec network time stamp: %jd.%06ld\n",
-					    (intmax_t)tvp->tv_sec, (long)tvp->tv_usec));
-				nts = tspec_stamp_to_lfp(tval_to_tspec(*tvp));
-				break;
-#endif  /* USE_SCM_TIMESTAMP */
-			}
-			fuzz = ntp_random() * 2. / FRAC * sys_fuzz;
-			DTOLFP(fuzz, &lfpfuzz);
-			L_ADD(&nts, &lfpfuzz);
-#ifdef ENABLE_DEBUG_TIMING
-			dts = ts;
-			L_SUB(&dts, &nts);
-			collect_timing(rb, "input processing delay", 1,
-				       &dts);
-			DPRINTF(4, ("fetch_timestamp: timestamp delta: %s (incl. fuzz)\n",
-				    lfptoa(&dts, 9)));
-#endif	/* ENABLE_DEBUG_TIMING */
-			ts = nts;  /* network time stamp */
-			break;
-#endif	/* USE_SCM_BINTIME || USE_SCM_TIMESTAMPNS || USE_SCM_TIMESTAMP */
-
-		default:
-			DPRINTF(4, ("fetch_timestamp: skipping control message 0x%x\n",
-				    cmsghdr->cmsg_type));
-		}
-		cmsghdr = CMSG_NXTHDR(msghdr, cmsghdr);
-	}
-	return ts;
-}
-#endif	/* USE_PACKET_TIMESTAMP */
-
-
 /*
  * Routine to read the network NTP packets for a specific interface
  * Return the number of bytes read. That way we know if we should
@@ -3399,7 +3212,7 @@ read_network_packet(
 	rb->fd = fd;
 #ifdef USE_PACKET_TIMESTAMP
 	/* pick up a network time stamp if possible */
-	ts = fetch_timestamp(rb, &msghdr, ts);
+	ts = fetch_packetstamp(rb, &msghdr, ts);
 #endif
 	rb->recv_time = ts;
 	rb->receiver = receive;


=====================================
ntpd/ntp_packetstamp.c
=====================================
--- /dev/null
+++ b/ntpd/ntp_packetstamp.c
@@ -0,0 +1,219 @@
+/*
+ * ntp_packetstamp.c - grubby platform-dependent details of packet timestamps
+ *
+ * One of our serious platform dependencies (things POSIX doesn't
+ * specify a facility for) is isolated here.
+ */
+#include <config.h>
+
+#ifdef HAVE_SYS_IOCTL_H
+# include <sys/ioctl.h>
+#endif
+#ifdef HAVE_SYS_SOCKIO_H	/* UXPV: SIOC* #defines (Frank Vance <fvance at waii.com>) */
+# include <sys/sockio.h>
+#endif
+
+#include "ntp_machine.h"
+#include "ntpd.h"
+#include "ntp_stdlib.h"
+#include "ntp_assert.h"
+#include "timespecops.h"
+
+#if defined(SO_BINTIME) && defined(SCM_BINTIME) && defined(CMSG_FIRSTHDR)
+#  define USE_PACKET_TIMESTAMP
+#  define USE_SCM_BINTIME
+#  ifdef OVERRIDE_BINTIME_CTLMSGBUF_SIZE
+#   define CMSG_BUFSIZE OVERRIDE_BINTIME_CTLMSGBUF_SIZE
+#  else
+#   define CMSG_BUFSIZE  1536 /* moderate default */
+#  endif
+#elif defined(SO_TIMESTAMPNS) && defined(SCM_TIMESTAMPNS) && defined(CMSG_FIRSTHDR)
+#  define USE_PACKET_TIMESTAMP
+#  define USE_SCM_TIMESTAMPNS
+#  ifdef OVERRIDE_TIMESTAMPNS_CTLMSGBUF_SIZE
+#   define CMSG_BUFSIZE OVERRIDE_TIMESTAMPNS_CTLMSGBUF_SIZE
+#  else
+#   define CMSG_BUFSIZE  1536 /* moderate default */
+#  endif
+#elif defined(SO_TIMESTAMP) && defined(SCM_TIMESTAMP) && defined(CMSG_FIRSTHDR)
+#  define USE_PACKET_TIMESTAMP
+#  define USE_SCM_TIMESTAMP
+#  ifdef OVERRIDE_TIMESTAMP_CTLMSGBUF_SIZE
+#   define CMSG_BUFSIZE OVERRIDE_TIMESTAMP_CTLMSGBUF_SIZE
+#  else
+#   define CMSG_BUFSIZE  1536 /* moderate default */
+#  endif
+#else
+/* fill in for old/other timestamp interfaces */
+#endif
+
+void
+enable_packetstamps(
+    int fd,
+    sockaddr_u *	addr
+    )
+{
+	const int	on = 1;
+
+#ifdef USE_SCM_TIMESTAMP
+	{
+		if (setsockopt(fd, SOL_SOCKET, SO_TIMESTAMP,
+			       (char*)&on, sizeof(on)))
+			msyslog(LOG_DEBUG,
+				"setsockopt SO_TIMESTAMP on fails on address %s: %m",
+				socktoa(addr));
+		else
+			DPRINTF(4, ("setsockopt SO_TIMESTAMP enabled on fd %d address %s\n",
+				    fd, socktoa(addr)));
+	}
+#endif
+#ifdef USE_SCM_TIMESTAMPNS
+	{
+		if (setsockopt(fd, SOL_SOCKET, SO_TIMESTAMPNS,
+			       (char*)&on, sizeof(on)))
+			msyslog(LOG_DEBUG,
+				"setsockopt SO_TIMESTAMPNS on fails on address %s: %m",
+				socktoa(addr));
+		else
+			DPRINTF(4, ("setsockopt SO_TIMESTAMPNS enabled on fd %d address %s\n",
+				    fd, socktoa(addr)));
+	}
+#endif
+#ifdef USE_SCM_BINTIME
+	{
+		if (setsockopt(fd, SOL_SOCKET, SO_BINTIME,
+			       (char*)&on, sizeof(on)))
+			msyslog(LOG_DEBUG,
+				"setsockopt SO_BINTIME on fails on address %s: %m",
+				socktoa(addr));
+		else
+			DPRINTF(4, ("setsockopt SO_BINTIME enabled on fd %d address %s\n",
+				    fd, socktoa(addr)));
+	}
+#endif
+}
+
+
+#ifdef USE_PACKET_TIMESTAMP
+/*
+ * extract timestamps from control message buffer
+ */
+l_fp
+fetch_packetstamp(
+	struct recvbuf *	rb,
+	struct msghdr *		msghdr,
+	l_fp			ts
+	)
+{
+	struct cmsghdr *	cmsghdr;
+#ifdef USE_SCM_BINTIME
+	struct bintime *	btp;
+#endif
+#ifdef USE_SCM_TIMESTAMPNS
+	struct timespec *	tsp;
+#endif
+#ifdef USE_SCM_TIMESTAMP
+	struct timeval *	tvp;
+#endif
+	unsigned long		ticks;
+	double			fuzz;
+	l_fp			lfpfuzz;
+	l_fp			nts;
+#ifdef ENABLE_DEBUG_TIMING
+	l_fp			dts;
+#endif
+
+#ifndef ENABLE_DEBUG_TIMING
+	UNUSED_ARG(rb);
+#endif
+
+	cmsghdr = CMSG_FIRSTHDR(msghdr);
+	while (cmsghdr != NULL) {
+		switch (cmsghdr->cmsg_type)
+		{
+#ifdef USE_SCM_BINTIME
+		case SCM_BINTIME:
+#endif  /* USE_SCM_BINTIME */
+#ifdef USE_SCM_TIMESTAMPNS
+		case SCM_TIMESTAMPNS:
+#endif	/* USE_SCM_TIMESTAMPNS */
+#ifdef USE_SCM_TIMESTAMP
+		case SCM_TIMESTAMP:
+#endif	/* USE_SCM_TIMESTAMP */
+#if defined(USE_SCM_BINTIME) || defined (USE_SCM_TIMESTAMPNS) || defined(USE_SCM_TIMESTAMP)
+			switch (cmsghdr->cmsg_type)
+			{
+#ifdef USE_SCM_BINTIME
+			case SCM_BINTIME:
+				btp = (struct bintime *)CMSG_DATA(cmsghdr);
+				/*
+				 * bintime documentation is at http://phk.freebsd.dk/pubs/timecounter.pdf
+				 */
+				nts.l_i = btp->sec + JAN_1970;
+				nts.l_uf = (uint32_t)(btp->frac >> 32);
+				if (sys_tick > measured_tick &&
+				    sys_tick > 1e-9) {
+					ticks = (unsigned long)(nts.l_uf / (unsigned long)(sys_tick * FRAC));
+					nts.l_uf = (unsigned long)(ticks * (unsigned long)(sys_tick * FRAC));
+				}
+                                DPRINTF(4, ("fetch_timestamp: system bintime network time stamp: %ld.%09lu\n",
+                                            (long)btp->sec, (unsigned long)((nts.l_uf / FRAC) * 1e9)));
+				break;
+#endif  /* USE_SCM_BINTIME */
+#ifdef USE_SCM_TIMESTAMPNS
+			case SCM_TIMESTAMPNS:
+				tsp = (struct timespec *)CMSG_DATA(cmsghdr);
+				if (sys_tick > measured_tick &&
+				    sys_tick > 1e-9) {
+					ticks = (unsigned long)((tsp->tv_nsec * 1e-9) /
+						       sys_tick);
+					tsp->tv_nsec = (long)(ticks * 1e9 *
+							      sys_tick);
+				}
+				DPRINTF(4, ("fetch_timestamp: system nsec network time stamp: %ld.%09ld\n",
+					    tsp->tv_sec, tsp->tv_nsec));
+				nts = tspec_stamp_to_lfp(*tsp);
+				break;
+#endif	/* USE_SCM_TIMESTAMPNS */
+#ifdef USE_SCM_TIMESTAMP
+			case SCM_TIMESTAMP:
+				tvp = (struct timeval *)CMSG_DATA(cmsghdr);
+				if (sys_tick > measured_tick &&
+				    sys_tick > 1e-6) {
+					ticks = (unsigned long)((tvp->tv_usec * 1e-6) /
+						       sys_tick);
+					tvp->tv_usec = (long)(ticks * 1e6 *
+							      sys_tick);
+				}
+				DPRINTF(4, ("fetch_timestamp: system usec network time stamp: %jd.%06ld\n",
+					    (intmax_t)tvp->tv_sec, (long)tvp->tv_usec));
+				nts = tspec_stamp_to_lfp(tval_to_tspec(*tvp));
+				break;
+#endif  /* USE_SCM_TIMESTAMP */
+			}
+			fuzz = ntp_random() * 2. / FRAC * sys_fuzz;
+			DTOLFP(fuzz, &lfpfuzz);
+			L_ADD(&nts, &lfpfuzz);
+#ifdef ENABLE_DEBUG_TIMING
+			dts = ts;
+			L_SUB(&dts, &nts);
+			collect_timing(rb, "input processing delay", 1,
+				       &dts);
+			DPRINTF(4, ("fetch_timestamp: timestamp delta: %s (incl. fuzz)\n",
+				    lfptoa(&dts, 9)));
+#endif	/* ENABLE_DEBUG_TIMING */
+			ts = nts;  /* network time stamp */
+			break;
+#endif	/* USE_SCM_BINTIME || USE_SCM_TIMESTAMPNS || USE_SCM_TIMESTAMP */
+
+		default:
+			DPRINTF(4, ("fetch_timestamp: skipping control message 0x%x\n",
+				    cmsghdr->cmsg_type));
+		}
+		cmsghdr = CMSG_NXTHDR(msghdr, cmsghdr);
+	}
+	return ts;
+}
+#endif	/* USE_PACKET_TIMESTAMP */
+
+// end


=====================================
ntpd/wscript
=====================================
--- a/ntpd/wscript
+++ b/ntpd/wscript
@@ -103,6 +103,7 @@ def build(ctx):
 		"ntp_config.c",
 		"ntp_io.c",
 		"ntp_loopfilter.c",
+		"ntp_packetstamp.c",
 		"ntp_peer.c",
 		"ntp_proto.c",
 		"ntp_sandbox.c",


=====================================
pylib/statfiles.py
=====================================
--- a/pylib/statfiles.py
+++ b/pylib/statfiles.py
@@ -208,7 +208,7 @@ def iso_to_posix(s):
     else:
         t = time.strptime(s, "%Y-%m-%dT%H:%M:%S")
         t.m_isdst = 0
-        # don't use time.mktime() as taht is local tz
+        # don't use time.mktime() as that is local tz
         return  calendar.timegm(t)
 
 def posix_to_iso(t):


=====================================
wafhelpers/check_multicast.py
=====================================
--- a/wafhelpers/check_multicast.py
+++ b/wafhelpers/check_multicast.py
@@ -3,7 +3,7 @@ def check_multicast(ctx):
         ctx.check_cc(
                 fragment="""
 #include <netinet/in.h>
-int main() {
+int main(void) {
         struct ip_mreq ipmr;
         ipmr.imr_interface.s_addr = 0;
         return 0;


=====================================
wafhelpers/check_openssl.py
=====================================
--- a/wafhelpers/check_openssl.py
+++ b/wafhelpers/check_openssl.py
@@ -1,7 +1,7 @@
 # Versions older than 0.9.7d were deemed incompatible in NTP Classic.
 OPENSSL_FRAG = """
 %s
-int main () {
+int main(void) {
 #if OPENSSL_VERSION_NUMBER < 0x0090704fL
 #error OpenSSL is too old.
 #endif


=====================================
wafhelpers/check_pthread.py
=====================================
--- a/wafhelpers/check_pthread.py
+++ b/wafhelpers/check_pthread.py
@@ -2,7 +2,7 @@ from wafhelpers.tool import check_sanity
 
 PTHREAD_FRAG = """
 #include <pthread.h>
-int main() {
+int main(void) {
 	pthread_mutex_t mutex;
 	pthread_mutex_init(&mutex, NULL);
 	pthread_mutex_destroy(&mutex);


=====================================
wafhelpers/check_sizeof.py
=====================================
--- a/wafhelpers/check_sizeof.py
+++ b/wafhelpers/check_sizeof.py
@@ -4,7 +4,7 @@ from waflib import Errors
 SIZE_FRAG = """
 %s
 #include <stdio.h>
-int main () {
+int main(void) {
 	printf("%%lu", sizeof(%s));
 	return 0;
 }
@@ -38,7 +38,7 @@ def check_sizeof_host(ctx, header, sizeof, mandatory=True):
 SIZE_FRAG_CROSS = """
 %s
 #include <sys/stat.h>
-int main () {
+int main(void) {
   static int test_array [1 - 2 * !(((long int) (sizeof (%s))) <= %d)];
   test_array [0] = 0;
   return test_array[0];


=====================================
wafhelpers/check_sockaddr.py
=====================================
--- a/wafhelpers/check_sockaddr.py
+++ b/wafhelpers/check_sockaddr.py
@@ -10,7 +10,7 @@ struct sockaddr_storage n;
 SA_LEN_FRAG = """
 #include <sys/types.h>
 #include <sys/socket.h>
-int main () {
+int main(void) {
   extern struct sockaddr *ps;
   return ps->sa_len;
 }


=====================================
wafhelpers/check_structfield.py
=====================================
--- a/wafhelpers/check_structfield.py
+++ b/wafhelpers/check_structfield.py
@@ -4,7 +4,7 @@ TYPE_FRAG = """
 #include <stdint.h>
 #include <sys/types.h>
 %s
-int main () {
+int main(void) {
         struct %s x;
         if (sizeof (x.%s))
                 return 0;


=====================================
wafhelpers/check_type.py
=====================================
--- a/wafhelpers/check_type.py
+++ b/wafhelpers/check_type.py
@@ -1,7 +1,7 @@
 from waflib.Configure import conf
 
 TYPE_FRAG = """
-int main () {
+int main(void) {
         if (sizeof (%s))
                 return 0;
         return 0;


=====================================
wafhelpers/check_vsprintfm.py
=====================================
--- a/wafhelpers/check_vsprintfm.py
+++ b/wafhelpers/check_vsprintfm.py
@@ -19,7 +19,7 @@ int call_vsnprintf(char *dst, size_t sz, const char *fmt,...)
         return rc;
 }
 
-int main()
+int main(void)
 {
         char    sbuf[512];
         char    pbuf[512];
@@ -38,7 +38,7 @@ def check_vsprintfm(ctx):
         ctx.check_cc(
                 fragment='''
 #include <features.h>
-int main()
+int main(void)
 {
 #ifndef __GLIBC__
 # error __GLIBC__ is not defined


=====================================
wafhelpers/probes.py
=====================================
--- a/wafhelpers/probes.py
+++ b/wafhelpers/probes.py
@@ -8,7 +8,7 @@ def probe_header_with_prerequisites(ctx, header, prerequisites, use=None):
         src = ""
         for hdr in prerequisites + [header]:
                 src += "#include <%s>\n" % hdr
-        src += "int main() { return 0; }\n"
+        src += "int main(void) { return 0; }\n"
         have_name = "HAVE_%s" % header.replace(".", "_").replace("/", "_").upper()
         ctx.check_cc(
                 fragment=src,
@@ -24,7 +24,7 @@ def probe_function_with_prerequisites(ctx, function, prerequisites, use=None):
         src = ""
         for hdr in prerequisites:
                 src += "#include <%s>\n" % hdr
-        src += """int main() {
+        src += """int main(void) {
         void *p = (void*)(%s);
         return (int)p;
 }



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/fca87976136f2256c970e950b3d7ffa51dcc849f...2c2161fcbf43639526d6bb518718695673733f98
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161202/05d7adf7/attachment.html>


More information about the vc mailing list