[Git][NTPsec/ntpsec][master] 2 commits: refclock_jjy: fix last discards const issue.

Gary E. Miller gitlab at mg.gitlab.com
Fri Apr 14 17:54:36 UTC 2017


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


Commits:
56caa9ba by Gary E. Miller at 2017-04-14T10:32:43-07:00
refclock_jjy: fix last discards const issue.

- - - - -
61980b1b by Gary E. Miller at 2017-04-14T10:36:46-07:00
waf: use -Wcast-qual and -Wcast-align always, if available.

- - - - -


2 changed files:

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


Changes:

=====================================
ntpd/refclock_jjy.c
=====================================
--- a/ntpd/refclock_jjy.c
+++ b/ntpd/refclock_jjy.c
@@ -4073,7 +4073,8 @@ static int
 modem_init_resp00 ( struct peer *peer, struct refclockproc *pp, struct jjyunit *up )
 {
 
-	char	*pCmd, cBuf [ 46 ] ;
+	const char *pCmd;
+	char	cBuf [ 46 ] ;
 	int	iCmdLen ;
 	int	iErrorCorrection, iSpeakerSwitch, iSpeakerVolume ;
 	int	iNextModemState = STAY_MODEM_STATE ;
@@ -4110,8 +4111,9 @@ modem_init_resp00 ( struct peer *peer, struct refclockproc *pp, struct jjyunit *
 			iSpeakerVolume = 2 ;
 		}
 
+		snprintf(cBuf, sizeof(cBuf), "ATM%dL%d\r\n",
+                         iSpeakerSwitch, iSpeakerVolume ) ;
 		pCmd = cBuf ;
-		snprintf( pCmd, sizeof(cBuf), "ATM%dL%d\r\n", iSpeakerSwitch, iSpeakerVolume ) ;
 		break ;
 
 	case 3 :
@@ -4139,8 +4141,8 @@ modem_init_resp00 ( struct peer *peer, struct refclockproc *pp, struct jjyunit *
 			iErrorCorrection = 3 ;
 		}
 
+		snprintf(cBuf, sizeof(cBuf), "AT\\N%d\r\n", iErrorCorrection);
 		pCmd = cBuf ;
-		snprintf( pCmd, sizeof(cBuf), "AT\\N%d\r\n", iErrorCorrection ) ;
 		break ;
 
 	case 7 :


=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -258,6 +258,8 @@ def cmd_configure(ctx, config):
         ('gnu99', '-std=gnu99'),
         # this quiets most of macOS warnings on -fpie
         ('unused', '-Qunused-arguments'),
+        ('w_cast_align', "-Wcast-align"),
+        ('w_cast_qual', "-Wcast-qual"),
         ('w_disabled_optimizaation', "-Wdisabled-optimization"),
         ('w_format', '-Wformat'),
         # fails on OpenBSD 6
@@ -299,8 +301,6 @@ def cmd_configure(ctx, config):
             #"-Wsuggest-attribute=const", # fails build
             #"-Waggregate-return",    # breaks ldiv(), ntpcal_daysplit(),  etc.
             "-Wbad-function-cast",
-            "-Wcast-align",
-            "-Wcast-qual",
             "-Wdisabled-optimization",
             "-Wfloat-equal",          # Not Ready For Prime Time
             "-Wformat-nonliteral",    # needs -Wformat
@@ -399,6 +399,10 @@ int main(int argc, char **argv) {
         ctx.env.CFLAGS = ['-Wimplicit-function-declaration'] + ctx.env.CFLAGS
     if ctx.env.HAS_w_disabled_optimization:
         ctx.env.CFLAGS = ['-Wdisabled-optimization'] + ctx.env.CFLAGS
+    if ctx.env.HAS_w_cast_align:
+        ctx.env.CFLAGS = ['-Wcast-align'] + ctx.env.CFLAGS
+    if ctx.env.HAS_w_cast_qual:
+        ctx.env.CFLAGS = ['-Wcast-qual'] + ctx.env.CFLAGS
     if ctx.env.HAS_w_shadow:
         ctx.env.CFLAGS = ['-Wshadow'] + ctx.env.CFLAGS
     if ctx.env.HAS_w_sign_conversion:



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/ae83fd9e22f89a68519c598b9c8c8fdb960c34b0...61980b1b36dc1f36018a9c18009544882ab7ffc0

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/ae83fd9e22f89a68519c598b9c8c8fdb960c34b0...61980b1b36dc1f36018a9c18009544882ab7ffc0
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/20170414/4a4827ef/attachment.html>


More information about the vc mailing list