[Git][NTPsec/ntpsec][master] 5 commits: ntptime: Add attribute noreturn;

Gary E. Miller gitlab at mg.gitlab.com
Fri Apr 14 23:17:37 UTC 2017


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


Commits:
08ac521d by Gary E. Miller at 2017-04-14T16:00:27-07:00
ntptime: Add attribute noreturn;

- - - - -
721dd255 by Gary E. Miller at 2017-04-14T16:04:35-07:00
ntpdmain() mark as attribute noreturn

- - - - -
f7e50d96 by Gary E. Miller at 2017-04-14T16:11:54-07:00
ppscheck(): mark attribute noreturn

- - - - -
61fba07e by Gary E. Miller at 2017-04-14T16:14:40-07:00
jitter(): Mark attribute noreturn

- - - - -
1aa5d7bd by Gary E. Miller at 2017-04-14T16:16:33-07:00
waf: use -Wsuggest-attribute=noreturn by default if available.

- - - - -


7 changed files:

- ntpd/ntpd.c
- ntpfrob/jitter.c
- ntpfrob/main.c
- ntpfrob/ntpfrob.h
- ntpfrob/pps-api.c
- ntptime/ntptime.c
- wafhelpers/configure.py


Changes:

=====================================
ntpd/ntpd.c
=====================================
--- a/ntpd/ntpd.c
+++ b/ntpd/ntpd.c
@@ -108,7 +108,7 @@ static	void	no_debug	(int);
 static int	saved_argc;
 static char **	saved_argv;
 
-int		ntpdmain		(int, char **);
+int		ntpdmain(int, char **) __attribute__((noreturn));
 static void	mainloop		(void)
 			__attribute__	((__noreturn__));
 static void	set_process_priority	(void);
@@ -910,7 +910,6 @@ ntpdmain(
 	
 	mainloop();
         /* unreachable, mainloop() never returns */
-	return 1;
 }
 
 /*


=====================================
ntpfrob/jitter.c
=====================================
--- a/ntpfrob/jitter.c
+++ b/ntpfrob/jitter.c
@@ -135,6 +135,7 @@ void jitter(const iomode mode)
 	}
 
 	exit(0);
+        /* never returns */
 }
 
 /* end */


=====================================
ntpfrob/main.c
=====================================
--- a/ntpfrob/main.c
+++ b/ntpfrob/main.c
@@ -51,7 +51,7 @@ main(int argc, char **argv)
 		    break;
 		case 'c':
 		    jitter(mode);
-		    exit(0);
+                    /* never returns */
 		    break;
 		case 'e':
 		    precision(mode);
@@ -63,6 +63,7 @@ main(int argc, char **argv)
 		case 'p':
 #ifdef HAVE_SYS_TIMEPPS_H
 		    ppscheck(optarg);
+                    /* never returns */
 #else
 		    fputs("ntpfrob: no PPS kernel interface.\n", stderr);
 		    exit(0);


=====================================
ntpfrob/ntpfrob.h
=====================================
--- a/ntpfrob/ntpfrob.h
+++ b/ntpfrob/ntpfrob.h
@@ -8,8 +8,8 @@ typedef enum {plain_text, raw, json} iomode;
 
 extern void bumpclock(int);
 extern void get_clocktime(l_fp *now);
-extern void jitter(const iomode mode);
-extern void ppscheck(const char *device);
+extern void jitter(const iomode mode) __attribute__((noreturn));
+extern void ppscheck(const char *device) __attribute__((noreturn));
 extern void precision(const iomode mode);
 extern void stepback(void);
 extern void tickadj(const bool mode, const int tick);


=====================================
ntpfrob/pps-api.c
=====================================
--- a/ntpfrob/pps-api.c
+++ b/ntpfrob/pps-api.c
@@ -119,6 +119,7 @@ void ppscheck(const char *device)
 		oldc = pi.clear_sequence;
 	}
 #endif /* HAVE_SYS_TIMEPPS_H */
+        /* either way, never returns */
 }
 
 /* end */


=====================================
ntptime/ntptime.c
=====================================
--- a/ntptime/ntptime.c
+++ b/ntptime/ntptime.c
@@ -78,7 +78,7 @@ const char *	snprintb	(size_t, char *, u_int, const char *);
 const char *	timex_state	(int);
 
 #ifdef SIGSYS
-void pll_trap		(int);
+void pll_trap(int) __attribute__((noreturn));
 
 static struct sigaction newsigsys;	/* new sigaction status */
 static struct sigaction sigsys;		/* current sigaction status */


=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -275,6 +275,8 @@ def cmd_configure(ctx, config):
         ('w_packed', '-Wpacked'),
         ('w_pointer_arith', '-Wpointer-arith'),
         ('w_shadow', '-Wshadow'),
+        # fails on clang
+        ('w_suggest_attribute_noreturn', "-Wsuggest-attribute=noreturn"),
         ('w_write_strings', '-Wwrite-strings'),
         ]
 
@@ -319,8 +321,6 @@ def cmd_configure(ctx, config):
             # fails on clang
             ('w_suggest_attribute_const', "-Wsuggest-attribute=const"),
             # fails on clang
-            ('w_suggest_attribute_noreturn', "-Wsuggest-attribute=noreturn"),
-            # fails on clang
             ('w_suggest_attribute_pure', "-Wsuggest-attribute=pure"),
             ]
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/ce6249ec256ffce3d7831046dcdc10702d396bc9...1aa5d7bd2fd412d020f6f344f0618c7dfd9da9c0

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/ce6249ec256ffce3d7831046dcdc10702d396bc9...1aa5d7bd2fd412d020f6f344f0618c7dfd9da9c0
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/4d14a3ee/attachment.html>


More information about the vc mailing list