[Git][NTPsec/ntpsec][master] Address GitLab issue #296: compiler warning (gcc 7.0.1): lfpfunc.c

Eric S. Raymond gitlab at mg.gitlab.com
Sun May 7 13:21:16 UTC 2017


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


Commits:
e8455cce by Eric S. Raymond at 2017-05-07T09:19:44-04:00
Address GitLab issue #296: compiler warning (gcc 7.0.1): lfpfunc.c

Simplify some tests so they don't throw compiler warnings.

- - - - -


1 changed file:

- tests/libntp/lfpfunc.c


Changes:

=====================================
tests/libntp/lfpfunc.c
=====================================
--- a/tests/libntp/lfpfunc.c
+++ b/tests/libntp/lfpfunc.c
@@ -93,16 +93,6 @@ static int l_fp_signum(const l_fp first)
 	return (lfpuint(first) || lfpfrac(first));
 }
 
-static void l_fp_swap(l_fp * first, l_fp *second)
-{
-	l_fp temp = *second;
-
-	*second = *first;
-	*first = temp;
-
-	return;
-}
-
 //----------------------------------------------------------------------
 // testing the relational macros works better with proper predicate
 // formatting functions; it slows down the tests a bit, but makes for
@@ -302,9 +292,9 @@ TEST(lfpfunc, SignedRelOps) {
 
 		switch (cmp) {
 		case -1:
-			//printf("op1:%d %d, op2:%d %d\n",lfpfrac(op1),lfpuint(op1),lfpfrac(op2),lfpuint(op2));
-			l_fp_swap(&op1, &op2);
-			//printf("op1:%d %d, op2:%d %d\n",lfpfrac(op1),lfpuint(op1),lfpfrac(op2),lfpuint(op2));
+			TEST_ASSERT_TRUE (l_isgt(op2, op1));
+			TEST_ASSERT_FALSE(l_isgt(op1, op2));
+			break;
 		case 1:
 			TEST_ASSERT_TRUE (l_isgt(op1, op2));
 			TEST_ASSERT_FALSE(l_isgt(op2, op1));
@@ -315,6 +305,7 @@ TEST(lfpfunc, SignedRelOps) {
 			break;
 		default:
 			TEST_FAIL_MESSAGE("unexpected UCMP result: ");
+			break;
 		}
 	}
 
@@ -332,9 +323,9 @@ TEST(lfpfunc, UnsignedRelOps) {
 
 		switch (cmp) {
 		case -1:
-			//printf("op1:%d %d, op2:%d %d\n",lfpfrac(op1),lfpuint(op1),lfpfrac(op2),lfpuint(op2));
-			l_fp_swap(&op1, &op2);
-			//printf("op1:%d %d, op2:%d %d\n",lfpfrac(op1),lfpuint(op1),lfpfrac(op2),lfpuint(op2));
+			TEST_ASSERT_TRUE (l_isgtu(op2, op1));
+			TEST_ASSERT_FALSE(l_isgtu(op1, op2));
+			break;
 		case 1:
 			TEST_ASSERT_TRUE (l_isgtu(op1, op2));
 			TEST_ASSERT_FALSE(l_isgtu(op2, op1));



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/e8455cce88feb720d6f4fe6b0d86282d0bc6d50d

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/e8455cce88feb720d6f4fe6b0d86282d0bc6d50d
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170507/eaebea9c/attachment.html>


More information about the vc mailing list