[Git][NTPsec/ntpsec][master] FALLTHRU: fix issue #295, warnings on implicit fallthrough
Gary E. Miller
gitlab at mg.gitlab.com
Wed May 10 23:19:59 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
26c67df5 by Gary E. Miller at 2017-05-10T16:17:16-07:00
FALLTHRU: fix issue #295, warnings on implicit fallthrough
It ain't pretty but it works. There is nothing you can do positive for
one compiler that another does not warn on. So a #define dependent on
compiler is used.
The gcc magic comments do not seem to work, but the
__attribute__((fallthrough)) does, if JUST before the next case.
- - - - -
2 changed files:
- include/ntpd.h
- ntpd/ntp_loopfilter.c
Changes:
=====================================
include/ntpd.h
=====================================
--- a/include/ntpd.h
+++ b/include/ntpd.h
@@ -53,7 +53,7 @@
#ifdef __clang__
# define FALLTHRU
#elif defined __GNUC__
-# define FALLTHRU /* @fallthrough@ */
+# define FALLTHRU __attribute__ ((fallthrough));
#else
# define FALLTHRU
#endif
=====================================
ntpd/ntp_loopfilter.c
=====================================
--- a/ntpd/ntp_loopfilter.c
+++ b/ntpd/ntp_loopfilter.c
@@ -608,20 +608,18 @@ local_clock(
return (0);
clock_frequency = direct_freq(fp_offset);
- FALLTHRU
- /* FALLTHRU to EVNT_SPIK */
/*
* In SPIK state we ignore succeeding outliers until
* either an inlier is found or the stepout threshold is
* exceeded.
*/
+ /* FALLTHRU to EVNT_SPIK */
+ FALLTHRU
case EVNT_SPIK:
if (mu < clock_minstep)
return (0);
- /* falls through to default */
-
/*
* We get here by default in NSET and FSET states and
* from above in FREQ or SPIK states.
@@ -645,6 +643,8 @@ local_clock(
* step threshold is always suppressed, even with a
* long time constant.
*/
+ /* FALLTHRU to default */
+ FALLTHRU
default:
snprintf(tbuf, sizeof(tbuf), "%+.6f s",
fp_offset);
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/26c67df5d19cf92d2bbb5c422ca22e58c151765d
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/26c67df5d19cf92d2bbb5c422ca22e58c151765d
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/20170510/2409b34c/attachment.html>
More information about the vc
mailing list