Преглед изворни кода

Merge trunk revision 2853:
r2853 | asalkeld | 2010-05-18 21:34:53 -0700 (Tue, 18 May 2010) | 8 lines

add __attribute__((noreturn)) to functions that always exit.

we had some __attribute__((__noreturn__))
and some __attribute__((noreturn))

I made them all: __attribute__((noreturn))



git-svn-id: http://svn.fedorahosted.org/svn/corosync/branches/flatiron@2895 fd59a12c-fef9-0310-b244-a6a79926bd2f

Steven Dake пре 15 година
родитељ
комит
187511f6a6
10 измењених фајлова са 20 додато и 12 уклоњено
  1. 1 1
      exec/apidef.c
  2. 1 1
      exec/logsys.c
  3. 2 0
      exec/main.c
  4. 4 0
      exec/util.c
  5. 2 3
      exec/util.h
  6. 2 2
      include/corosync/coroipcs.h
  7. 5 2
      include/corosync/engine/coroapi.h
  8. 1 1
      test/testcpg.c
  9. 1 1
      test/testcpgzc.c
  10. 1 1
      test/testzcgc.c

+ 1 - 1
exec/apidef.c

@@ -86,7 +86,7 @@ typedef int (*typedef_tpg_groups_send_ok) (
 static inline void _corosync_public_exit_error (cs_fatal_error_t err,
 						const char *file,
 						unsigned int line)
-  __attribute__((__noreturn__));
+  __attribute__((noreturn));
 static inline void _corosync_public_exit_error (
 	cs_fatal_error_t err, const char *file, unsigned int line)
 {

+ 1 - 1
exec/logsys.c

@@ -729,7 +729,7 @@ static void log_printf_to_logs_wthread (
 	sem_post (&logsys_print_finished);
 }
 
-static void *logsys_worker_thread (void *data) __attribute__((__noreturn__));
+static void *logsys_worker_thread (void *data) __attribute__((noreturn));
 static void *logsys_worker_thread (void *data)
 {
 	struct record *rec;

+ 2 - 0
exec/main.c

@@ -917,6 +917,8 @@ static void corosync_sending_allowed_release (void *sending_allowed_private_data
 static int ipc_subsys_id = -1;
 
 
+static void ipc_fatal_error(const char *error_msg) __attribute__((noreturn));
+
 static void ipc_fatal_error(const char *error_msg) {
        _logsys_log_printf (
 		LOGSYS_ENCODE_RECID(LOGSYS_LEVEL_ERROR,

+ 4 - 0
exec/util.c

@@ -81,12 +81,16 @@ cs_time_t clust_time_now(void)
 	return time_now;
 }
 
+void _corosync_out_of_memory_error (void) __attribute__((noreturn));
 void _corosync_out_of_memory_error (void)
 {
 	assert (0==1);
 	exit (EXIT_FAILURE);
 }
 
+void _corosync_exit_error (
+	enum e_ais_done err, const char *file, unsigned int line)  __attribute__((noreturn));
+
 void _corosync_exit_error (
 	enum e_ais_done err, const char *file, unsigned int line)
 {

+ 2 - 3
exec/util.h

@@ -69,9 +69,8 @@ enum e_ais_done {
 extern int name_match(cs_name_t *name1, cs_name_t *name2);
 #define corosync_exit_error(err) _corosync_exit_error ((err), __FILE__, __LINE__)
 extern void _corosync_exit_error (enum e_ais_done err, const char *file,
-				  unsigned int line)
-  __attribute__((__noreturn__));
-void _corosync_out_of_memory_error (void) __attribute__((__noreturn__));
+				  unsigned int line) __attribute__((noreturn));
+void _corosync_out_of_memory_error (void) __attribute__((noreturn));
 extern char *getcs_name_t (cs_name_t *name);
 extern void setcs_name_t (cs_name_t *name, char *str);
 extern int cs_name_tisEqual (cs_name_t *str1, char *str2);

+ 2 - 2
include/corosync/coroipcs.h

@@ -69,7 +69,7 @@ struct coroipcs_init_state {
 	void (*poll_dispatch_add)(int fd, void *context);
 	void (*poll_dispatch_modify)(int fd, int events);
 	void (*poll_dispatch_destroy)(int fd, void *context);
-	void (*fatal_error)(const char *error_msg);
+	void (*fatal_error)(const char *error_msg) __attribute__ ((noreturn));
 	coroipcs_init_fn_lvalue (*init_fn_get)(unsigned int service);
 	coroipcs_exit_fn_lvalue (*exit_fn_get)(unsigned int service);
 	coroipcs_handler_fn_lvalue (*handler_fn_get)(unsigned int service, unsigned int id);
@@ -96,7 +96,7 @@ struct coroipcs_init_state_v2 {
 	void (*poll_dispatch_add)(int fd, void *context);
 	void (*poll_dispatch_modify)(int fd, int events);
 	void (*poll_dispatch_destroy)(int fd, void *context);
-	void (*fatal_error)(const char *error_msg);
+	void (*fatal_error)(const char *error_msg) __attribute__ ((noreturn));
 	coroipcs_init_fn_lvalue (*init_fn_get)(unsigned int service);
 	coroipcs_exit_fn_lvalue (*exit_fn_get)(unsigned int service);
 	coroipcs_handler_fn_lvalue (*handler_fn_get)(unsigned int service, unsigned int id);

+ 5 - 2
include/corosync/engine/coroapi.h

@@ -591,9 +591,12 @@ struct corosync_api_v1 {
 	/*
 	 * Error handling APIs
 	 */
-	void (*error_memory_failure) (void);
+	void (*error_memory_failure) (void) __attribute__ ((noreturn));
+
 #define corosync_fatal_error(err) api->fatal_error ((err), __FILE__, __LINE__)
-	void (*fatal_error) (cs_fatal_error_t err, const char *file, unsigned int line);
+	void (*fatal_error) (cs_fatal_error_t err,
+		const char *file,
+		unsigned int line) __attribute__ ((noreturn));
 
 	void (*shutdown_request) (void);
 

+ 1 - 1
test/testcpg.c

@@ -137,7 +137,7 @@ static cpg_callbacks_t callbacks = {
 	.cpg_confchg_fn =            ConfchgCallback,
 };
 
-static void sigintr_handler (int signum) __attribute__((__noreturn__));
+static void sigintr_handler (int signum) __attribute__((noreturn));
 static void sigintr_handler (int signum) {
 	exit (0);
 }

+ 1 - 1
test/testcpgzc.c

@@ -151,7 +151,7 @@ static cpg_callbacks_t callbacks = {
 	.cpg_confchg_fn =            ConfchgCallback,
 };
 
-static void sigintr_handler (int signum) __attribute__((__noreturn__));
+static void sigintr_handler (int signum) __attribute__((noreturn));
 static void sigintr_handler (int signum) {
 	exit (0);
 }

+ 1 - 1
test/testzcgc.c

@@ -151,7 +151,7 @@ static cpg_callbacks_t callbacks = {
 	.cpg_confchg_fn =            ConfchgCallback,
 };
 
-static void sigintr_handler (int signum) __attribute__((__noreturn__));
+static void sigintr_handler (int signum) __attribute__((noreturn));
 static void sigintr_handler (int signum) {
 	exit (0);
 }