[Git][NTPsec/ntpsec][master] 3 commits: magnavox: fix last two compare of double to a number.

Gary E. Miller gitlab at mg.gitlab.com
Sun Apr 23 00:06:10 UTC 2017


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


Commits:
b469cd8c by Gary E. Miller at 2017-04-22T16:57:16-07:00
magnavox: fix last two compare of double to a number.

- - - - -
c9882a26 by Gary E. Miller at 2017-04-22T17:00:55-07:00
waf: -Wfloat-equal warning always on, no warnings now.

- - - - -
d573858c by Gary E. Miller at 2017-04-22T17:03:45-07:00
waf: comment out: -Wbad-function-cast

ntpd casts long<->double all the time, too many false positive.

- - - - -


2 changed files:

- ntpd/refclock_magnavox.c
- wafhelpers/configure.py


Changes:

=====================================
ntpd/refclock_magnavox.c
=====================================
--- a/ntpd/refclock_magnavox.c
+++ b/ntpd/refclock_magnavox.c
@@ -58,6 +58,7 @@
  */
 #define INTERVAL	1	/* Interval between position measurements (s) */
 #define AVGING_TIME	24	/* Number of hours to average */
+/* central meridian is +/- 180 degrees, so -9999 is well out of range */
 #define NOT_INITIALIZED	-9999.	/* initial pivot longitude */
 
 /* records transmitted from extern CDU to MX 4200 */
@@ -521,7 +522,7 @@ mx4200_ref(
 	 * "000" Initialization/Mode Control - Part A
 	 * Fix to our averaged position.
 	 */
-	if (up->central_meridian != NOT_INITIALIZED) {
+	if (up->central_meridian < NOT_INITIALIZED) {
 		up->avg_lon += up->central_meridian;
 		if (up->avg_lon < -180.0) up->avg_lon += 360.0;
 		if (up->avg_lon >  180.0) up->avg_lon -= 360.0;
@@ -1278,7 +1279,7 @@ mx4200_parse_p(
 	 * Normalize longitude to near 0 degrees.
 	 * Assume all data are clustered around first reading.
 	 */
-	if (up->central_meridian == NOT_INITIALIZED) {
+	if (up->central_meridian < (NOT_INITIALIZED - 1.0)) {
 		up->central_meridian = lon;
 		mx4200_debug(peer,
 		    "mx4200_receive: central meridian =  %.9f \n",


=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -264,6 +264,7 @@ def cmd_configure(ctx, config):
         ('w_cast_align', "-Wcast-align"),
         ('w_cast_qual', "-Wcast-qual"),
         ('w_disabled_optimization', "-Wdisabled-optimization"),
+        ('w_float_equal', "-Wfloat-equal"),
         ('w_format', '-Wformat'),
         ('w_format_security', '-Wformat-security'),
         # fails on OpenBSD 6
@@ -309,8 +310,7 @@ def cmd_configure(ctx, config):
         ctx.env.CFLAGS = [
             # "-Wall",                # for masochists
             # "-Waggregate-return",   # breaks ldiv(), ntpcal_daysplit(),  etc.
-            "-Wbad-function-cast",
-            "-Wfloat-equal",          # Not Ready For Prime Time
+            # "-Wbad-function-cast",  # ntpd casts long<->double a lot
             # "-Wformat-nonliteral",  # complains about a used feature
             "-Wmissing-format-attribute",
             # "-Wnested-externs",     # incompatible w/ Unity...
@@ -325,7 +325,7 @@ def cmd_configure(ctx, config):
             # fails on clang, lot's of false positives and Unity complaints
             # ('w_suggest_attribute_const', "-Wsuggest-attribute=const"),
             # fails on clang, lot's of false positives and Unity complaints
-            #('w_suggest_attribute_pure', "-Wsuggest-attribute=pure"),
+            # ('w_suggest_attribute_pure', "-Wsuggest-attribute=pure"),
             ]
 
     ctx.env.CFLAGS = [
@@ -403,6 +403,8 @@ int main(int argc, char **argv) {
     # should be before other -Wformat-* in CFLAGS
     if ctx.env.HAS_w_format:
         ctx.env.CFLAGS = ['-Wformat'] + ctx.env.CFLAGS
+    if ctx.env.HAS_w_float_equal:
+        ctx.env.CFLAGS = ['-Wfloat-equal'] + ctx.env.CFLAGS
     if ctx.env.HAS_w_init_self:
         ctx.env.CFLAGS = ['-Winit-self'] + ctx.env.CFLAGS
     if ctx.env.HAS_w_inline:



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/3fa67c084e9972496a6af7092181f87e7db5b4fa...d573858c2ace9c2b824f53645710554fd41d6883

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/3fa67c084e9972496a6af7092181f87e7db5b4fa...d573858c2ace9c2b824f53645710554fd41d6883
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/20170423/6a2cfd71/attachment.html>


More information about the vc mailing list