[Git][NTPsec/ntpsec][master] Address Gitlab issue #8: Clang warnings on OSX 10.11.2.

Eric S. Raymond gitlab at mg.gitlab.com
Mon Nov 23 12:42:34 UTC 2015


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


Commits:
891bc962 by Eric S. Raymond at 2015-11-23T07:42:17Z
Address Gitlab issue #8: Clang warnings on OSX 10.11.2.

- - - - -


5 changed files:

- ntpd/ntp_loopfilter.c
- ntpd/ntp_sandbox.c
- ntpd/ntp_timer.c
- ntpfrob/tickadj.c
- tests/libntp/tstotv.c


Changes:

=====================================
ntpd/ntp_loopfilter.c
=====================================
--- a/ntpd/ntp_loopfilter.c
+++ b/ntpd/ntp_loopfilter.c
@@ -180,6 +180,7 @@ static sigjmp_buf env;		/* environment var. for pll_trap() */
 #endif /* SIGSYS */
 #endif /* HAVE_KERNEL_PLL */
 
+#ifdef HAVE_KERNEL_PLL
 static void
 sync_status(const char *what, int ostatus, int nstatus)
 {
@@ -189,6 +190,7 @@ sync_status(const char *what, int ostatus, int nstatus)
 	snprintf(tbuf, sizeof(tbuf), "%s status: %s -> %s", what, obuf, nbuf);
 	report_event(EVNT_KERN, NULL, tbuf);
 }
+#endif /* HAVE_KERNEL_PLL */
 
 /*
  * file_name - return pointer to non-relative portion of this C file pathname
@@ -440,7 +442,9 @@ local_clock(
 {
 	int	rval;		/* return code */
 	int	osys_poll;	/* old system poll */
+#ifdef HAVE_KERNEL_PLL
 	int	ntp_adj_ret;	/* returned by ntp_adjtime */
+#endif /* HAVE_KERNEL_PLL */
 	double	mu;		/* interval since last update */
 	double	clock_frequency; /* clock frequency */
 	double	dtemp, etemp;	/* double temps */


=====================================
ntpd/ntp_sandbox.c
=====================================
--- a/ntpd/ntp_sandbox.c
+++ b/ntpd/ntp_sandbox.c
@@ -54,6 +54,9 @@ bool sandbox(const bool droproot,
 	     const char *chrootdir,
 	     bool want_dynamic_interface_tracking)
 {
+#ifndef HAVE_LINUX_CAPABILITY
+	UNUSED_ARG(want_dynamic_interface_tracking);
+#endif /* HAVE_LINUX_CAPABILITY */
 	bool nonroot = false;
 # ifdef ENABLE_DROPROOT
 	if (droproot) {


=====================================
ntpd/ntp_timer.c
=====================================
--- a/ntpd/ntp_timer.c
+++ b/ntpd/ntp_timer.c
@@ -584,7 +584,7 @@ check_leapsec(
 			const char *leapmsg = NULL;
 			if (lsdata.warped < 0) {
 				if (clock_max_back > 0.0 &&
-				    clock_max_back < fabs(lsdata.warped)) {
+				    clock_max_back < abs(lsdata.warped)) {
 					step_systime(lsdata.warped);
 					leapmsg = leapmsg_p_step;
 				} else {
@@ -592,7 +592,7 @@ check_leapsec(
 				}
 			} else 	if (lsdata.warped > 0) {
 				if (clock_max_fwd > 0.0 &&
-				    clock_max_fwd < fabs(lsdata.warped)) {
+				    clock_max_fwd < abs(lsdata.warped)) {
 					step_systime(lsdata.warped);
 					leapmsg = leapmsg_n_step;
 				} else {


=====================================
ntpfrob/tickadj.c
=====================================
--- a/ntpfrob/tickadj.c
+++ b/ntpfrob/tickadj.c
@@ -31,6 +31,7 @@ void tickadj(const iomode mode, const int newtick)
 	UNUSED_ARG(mode);
 
 #ifndef HAVE_ADJTIMEX
+	UNUSED_ARG(newtick);
 	fputs("ntpfrob: \n", stderr);
 	exit(1);
 #else


=====================================
tests/libntp/tstotv.c
=====================================
--- a/tests/libntp/tstotv.c
+++ b/tests/libntp/tstotv.c
@@ -19,7 +19,10 @@ static bool IsEqual(const struct timeval *expected, const struct timeval *actual
 		// Success
 		return true;
 	} else {
-		printf("Expected: %ld.%ld but was %ld.%ld\n", expected->tv_sec, expected->tv_usec, actual->tv_sec, actual->tv_usec);
+		/* long cast iscrequired on Darwin */
+		printf("Expected: %ld.%ld but was %ld.%ld\n",
+		       expected->tv_sec, expected->tv_usec,
+		       actual->tv_sec, (long)actual->tv_usec);
 		return false;
 	}
 }



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/891bc962be6189a4fb9b9949a800e96a7bf7120c
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20151123/e70bbc87/attachment.html>


More information about the vc mailing list