[Git][NTPsec/ntpsec][master] 7 commits: ntp_util: add missing prototype.

Gary E. Miller gitlab at mg.gitlab.com
Thu Apr 6 21:37:52 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
ced7bbd6 by Gary E. Miller at 2017-04-06T14:13:59-07:00
ntp_util: add missing prototype.

- - - - -
06581c2f by Gary E. Miller at 2017-04-06T14:16:06-07:00
ntp_config: add missing prototype.

- - - - -
78bc12b5 by Gary E. Miller at 2017-04-06T14:26:24-07:00
tests/calendar: add missing prototype.

- - - - -
2feac404 by Gary E. Miller at 2017-04-06T14:26:45-07:00
tests/authkeys: add missing prototypes.

- - - - -
d4965060 by Gary E. Miller at 2017-04-06T14:28:14-07:00
tests/lfpfunc: add missing prototype.

- - - - -
d00dc745 by Gary E. Miller at 2017-04-06T14:35:49-07:00
tests/sockaddrtest: add missing prototypes.

- - - - -
03f160b6 by Gary E. Miller at 2017-04-06T14:37:01-07:00
-Wmissing-prototypes: no more warnings, now on by default.

- - - - -


7 changed files:

- ntpd/ntp_config.c
- ntpd/ntp_util.c
- tests/common/sockaddrtest.c
- tests/libntp/authkeys.c
- tests/libntp/calendar.c
- tests/libntp/lfpfunc.c
- wafhelpers/configure.py


Changes:

=====================================
ntpd/ntp_config.c
=====================================
--- a/ntpd/ntp_config.c
+++ b/ntpd/ntp_config.c
@@ -82,6 +82,8 @@
 #define REFCLOCKUNIT(srcadr)	(SRCADR(srcadr) & 0xff)
 
 
+static bool getaddrinfo_now(char *, sockaddr_u *);
+
 /* list of servers from command line for config_peers() */
 int	cmdline_server_count = 0;
 char **	cmdline_servers;
@@ -1463,6 +1465,7 @@ free_config_monitor(
 	FREE_FILEGEN_FIFO(ptree->filegen_opts);
 }
 
+static
 bool getaddrinfo_now(char *hname, sockaddr_u *peeraddrp)
 {
 	int a_info;


=====================================
ntpd/ntp_util.c
=====================================
--- a/ntpd/ntp_util.c
+++ b/ntpd/ntp_util.c
@@ -45,6 +45,7 @@ static bool have_leapfile = false;
 char *stats_drift_file;			/* frequency file name */
 static double wander_resid;		/* last frequency update */
 double	wander_threshold = 1e-7;	/* initial frequency threshold */
+static char *timespec_to_MJDtime(const struct timespec *);
 
 /*
  * Statistics file stuff
@@ -349,7 +350,7 @@ stats_config(
 /* timespec_to_MJDtime
  */
 
-char *
+static char *
 timespec_to_MJDtime(const struct timespec *time)
 {
 	char *buf;


=====================================
tests/common/sockaddrtest.c
=====================================
--- a/tests/common/sockaddrtest.c
+++ b/tests/common/sockaddrtest.c
@@ -1,11 +1,9 @@
-#ifndef GUARD_TESTS_SOCKADDRTEST_H
-#define GUARD_TESTS_SOCKADDRTEST_H
-
 #include <inttypes.h>
 
 #include "config.h"
 
 #include "ntp.h"
+#include "sockaddrtest.h"
 
 bool IsEqualS(const sockaddr_u *expected, const sockaddr_u *actual) {
 	if (AF(expected) != AF(actual)) {
@@ -75,6 +73,3 @@ sockaddr_u CreateSockaddr4(const char* address, unsigned int port) {
 	SET_PORT(&s, port);
 	return s;
 }
-
-
-#endif // GUARD_TESTS_SOCKADDRTEST_H


=====================================
tests/libntp/authkeys.c
=====================================
--- a/tests/libntp/authkeys.c
+++ b/tests/libntp/authkeys.c
@@ -37,7 +37,10 @@ TEST_TEAR_DOWN(authkeys) {}
 static const int KEYTYPE = NID_md5;
 
 
-void AddTrustedKey(keyid_t keyno) {
+static void AddTrustedKey(keyid_t);
+static void AddUntrustedKey(keyid_t);
+
+static void AddTrustedKey(keyid_t keyno) {
 	/*
 	 * We need to add a MD5-key in addition to setting the
 	 * trust, because authhavekey() requires type != 0.
@@ -47,7 +50,7 @@ void AddTrustedKey(keyid_t keyno) {
 	authtrust(keyno, true);
 }
 
-void AddUntrustedKey(keyid_t keyno) {
+static void AddUntrustedKey(keyid_t keyno) {
 	authtrust(keyno, false);
 }
 


=====================================
tests/libntp/calendar.c
=====================================
--- a/tests/libntp/calendar.c
+++ b/tests/libntp/calendar.c
@@ -17,7 +17,11 @@ TEST_TEAR_DOWN(calendar) {}
 
 #define TEST_ASSERT_GREATER_THAN(a, b) TEST_ASSERT_TRUE(a > b)
 
-int leapdays(int year) {
+static int leapdays(int);
+static bool IsEqualCA(const struct calendar *, const struct calendar *);
+static const char *DateToString(const struct calendar *);
+
+static int leapdays(int year) {
 	if (year % 400 == 0)
 		return 1;
 	if (year % 100 == 0)
@@ -28,6 +32,7 @@ int leapdays(int year) {
 }
 
 
+static
 bool IsEqualCA(const struct calendar *expected, const struct calendar *actual) {
 	if (expected->year == actual->year &&
 	    (!expected->yearday || expected->yearday == actual->yearday) &&
@@ -45,14 +50,15 @@ bool IsEqualCA(const struct calendar *expected, const struct calendar *actual) {
 }
 
 
-const char *DateToString(const struct calendar *cal) {
+static const char *DateToString(const struct calendar *cal) {
 	char *str = malloc(255);
 	snprintf(str, 255, "%hu-%u-%u(%u)\n", cal->year, (u_int)cal->month, (u_int)cal->monthday, cal->yearday);
 	return str;
 }
 
 
-bool IsEqualDate(const struct calendar *expected, const struct calendar *actual) {
+static bool IsEqualDate(const struct calendar *expected,
+                        const struct calendar *actual) {
 	if (expected->year == actual->year &&
 	    (!expected->yearday || expected->yearday == actual->yearday) &&
 	    expected->month == actual->month &&


=====================================
tests/libntp/lfpfunc.c
=====================================
--- a/tests/libntp/lfpfunc.c
+++ b/tests/libntp/lfpfunc.c
@@ -9,6 +9,8 @@
 #include <float.h>
 #include <math.h>
 
+static double eps(double);
+
 TEST_GROUP(lfpfunc);
 
 TEST_SETUP(lfpfunc) {}
@@ -161,7 +163,7 @@ static const size_t addsub_tot = (sizeof(addsub_tab)/sizeof(addsub_tab[0][0]));
 // '1'-bit of the l_fp value, the roundtrip *will* create truncation
 // errors. This is an inherent property caused by the 54-bit mantissa of
 // the 'double' type.
-double
+static double
 eps(double d)
 {
 	return fmax(ldexp(1.0, -31), ldexp(fabs(d), -53));


=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -279,7 +279,6 @@ def cmd_configure(ctx, config):
         # turn on some annoying warnings
         ctx.env.CFLAGS += [
             "-Wfloat-equal",          # Not Ready For Prime Time
-            "-Wmissing-prototypes",   # Not Ready For Prime Time
             "-Wmissing-declarations", # Not Ready For Primt Time
             "-Wsign-conversion",      # fails on Solaris and OpenBSD 6
         ]
@@ -294,6 +293,7 @@ def cmd_configure(ctx, config):
         "-O1",
         "-Wall",
         "-Wextra",
+        "-Wmissing-prototypes",
         "-Wshadow",
         "-Wstrict-prototypes",
         "-Wundef",



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/e624af47cfcf1c31f7eb3355451795feadefb286...03f160b61829ce18eef9384ec6d2c5cefea3637a
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170406/14b39f9e/attachment.html>


More information about the vc mailing list