[Git][NTPsec/ntpsec][master] 2 commits: Contain some macro ugliness to its only call site.

Eric S. Raymond gitlab at mg.gitlab.com
Tue Dec 27 21:54:59 UTC 2016


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


Commits:
26c307e4 by Eric S. Raymond at 2016-12-27T16:54:34-05:00
Contain some macro ugliness to its only call site.

- - - - -
5c18650e by Eric S. Raymond at 2016-12-27T16:54:34-05:00
Add a build-test step to make-tarball.

- - - - -


3 changed files:

- devel/make-tarball
- include/ntp_fp.h
- libntp/dolfptoa.c


Changes:

=====================================
devel/make-tarball
=====================================
--- a/devel/make-tarball
+++ b/devel/make-tarball
@@ -2,7 +2,8 @@
 #
 # Make a release tarball from current head.  If you give an argument, it
 # will override the version normally taken from ../VERSION.  Produces
-# a file named ntpsec-$V.tar.gz.
+# a file named ntpsec-$V.tar.gz.  The name of this tarball is echoed to
+# standard output as part of the success message.
 #
 # The tricky part is that it has to include the autorevision cache file,
 # which can't be checked into the repo or there'd be an infinite loop.
@@ -17,10 +18,8 @@ then
     exit 1
 fi
 
-if [ -r ../wafhelpers/.autorevision-cache ]
+if [ ! -r ../wafhelpers/.autorevision-cache ]
 then
-    echo "Autorevision cache file exists, OK"
-else
     echo "Autorevision cache file does not exist, waf build and try again"
     exit 1
 fi
@@ -34,11 +33,26 @@ else
     V=`cat ../VERSION`
 fi
 
+# Build the tarball
 rm -fr .tmp
 (cd ..; git ls-files; echo "wafhelpers/.autorevision-cache") >MANIFEST
 (cd ..; tar --transform="s:^:ntpsec-${V}/:" -T devel/MANIFEST -czf ntpsec-${V}.tar.gz)
 rm MANIFEST
 mv ../ntpsec-${V}.tar.gz .
 
+
+# Test-build from it, bailing out if we fail
+set -e
+mkdir .tmp
+cd .tmp
+tar -xzf ../ntpsec-${V}.tar.gz
+cd ntpsec-${V}
+./waf configure --refclock=all --enable-crypto --enable-doc
+./waf build
+cd ../..
+rm -fr .tmp
+
+echo ""
+echo "Success: " ntpsec-${V}.tar.gz
 # end
 


=====================================
include/ntp_fp.h
=====================================
--- a/include/ntp_fp.h
+++ b/include/ntp_fp.h
@@ -146,19 +146,6 @@ typedef uint32_t u_fp;
 		(v_i) = ~(v_i) + ((v_f) == 0); \
 	} while (false)
 
-#define M_ADD(r_i, r_f, a_i, a_f)	/* r += a */ \
-	do { \
-		uint32_t add_t = (r_f); \
-		(r_f) += (a_f); \
-		(r_i) += (a_i) + ((uint32_t)(r_f) < add_t); \
-	} while (false)
-
-#define	M_LSHIFT(v_i, v_f)		/* v <<= 1 */ \
-	do { \
-		(v_i) = ((uint32_t)(v_i) << 1) | ((uint32_t)(v_f) >> 31);	\
-		(v_f) = ((uint32_t)(v_f) << 1); \
-	} while (false)
-
 #define	M_ISNEG(v_i)			/* v < 0 */ \
 	(((v_i) & 0x80000000) != 0)
 


=====================================
libntp/dolfptoa.c
=====================================
--- a/libntp/dolfptoa.c
+++ b/libntp/dolfptoa.c
@@ -75,7 +75,21 @@ dolfptoa(
 	 */
 	for (/*NOP*/;  dec > 0 && fpv != 0;  dec--)  {
 		uint32_t digit, tmph, tmpl;
-		
+
+		/* FIXME - get rid of this ugly kludge! */
+#define M_ADD(r_i, r_f, a_i, a_f)	/* r += a */ \
+		do { \
+			uint32_t add_t = (r_f); \
+			(r_f) += (a_f); \
+			(r_i) += (a_i) + ((uint32_t)(r_f) < add_t); \
+		} while (false)
+
+#define	M_LSHIFT(v_i, v_f)		/* v <<= 1 */ \
+		do { \
+			(v_i) = ((uint32_t)(v_i) << 1) | ((uint32_t)(v_f) >> 31);	\
+			(v_f) = ((uint32_t)(v_f) << 1); \
+		} while (false)
+
 		/*
 		 * The scheme here is to multiply the fraction
 		 * (0.1234...) by ten.  This moves a junk of BCD into
@@ -89,6 +103,8 @@ dolfptoa(
 		M_LSHIFT(digit, fpv);
 		M_LSHIFT(digit, fpv);
 		M_ADD(digit, fpv, tmph, tmpl);
+#undef M_ADD
+#undef M_SHIFT
 		*cpend++ = (uint8_t)digit;
 	}
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/2dbf27fb1008e1d3ae77fa5e8eb61d6ed7908566...5c18650ea39879cab6c426c843557a6d47de466f
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20161227/2219350c/attachment.html>


More information about the vc mailing list