mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Vladislav Valtchev (VMware)" <vladislav.valtchev@gmail.com>
To: rostedt@goodmis.org
Cc: linux-kernel@vger.kernel.org, y.karadz@gmail.com,
	"Vladislav Valtchev (VMware)" <vladislav.valtchev@gmail.com>
Subject: [PATCH 10/11] trace-cmd: Making the "die" functions noreturn
Date: Thu, 23 Nov 2017 18:33:34 +0200	[thread overview]
Message-ID: <20171123163335.19078-11-vladislav.valtchev@gmail.com> (raw)
In-Reply-To: <20171123163335.19078-1-vladislav.valtchev@gmail.com>

This patch makes all the "die" functions in trace-cmd noreturn in order we to be
able to use them in negative code paths inside non-void functions, without
getting compiler warnings and, clearly, without work-arounds like non-sense
return statements after a die().

Signed-off-by: Vladislav Valtchev (VMware) <vladislav.valtchev@gmail.com>
---
 trace-cmd.h   | 2 ++
 trace-local.h | 6 +++---
 trace-util.c  | 8 +++-----
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/trace-cmd.h b/trace-cmd.h
index 3fb6aab..6fd34d7 100644
--- a/trace-cmd.h
+++ b/trace-cmd.h
@@ -23,6 +23,8 @@
 #include "event-parse.h"
 
 #define ARRAY_SIZE(_a) (sizeof(_a) / sizeof((_a)[0]))
+#define __weak __attribute__((weak))
+#define __noreturn __attribute__((noreturn))
 
 #define TRACECMD_ERR_MSK	((unsigned long)(-1) & ~((1UL << 14) - 1))
 #define TRACECMD_ISERR(ptr)	((unsigned long)(ptr) > TRACECMD_ERR_MSK)
diff --git a/trace-local.h b/trace-local.h
index cb47e78..a06dc9b 100644
--- a/trace-local.h
+++ b/trace-local.h
@@ -212,9 +212,9 @@ void show_instance_file(struct buffer_instance *instance, const char *name);
 int count_cpus(void);
 
 /* No longer in event-utils.h */
-void die(const char *fmt, ...); /* Can be overriden */
+void __noreturn die(const char *fmt, ...); /* Can be overriden */
 void *malloc_or_die(unsigned int size); /* Can be overridden */
-void __die(const char *fmt, ...);
-void __vdie(const char *fmt, va_list ap);
+void __noreturn __die(const char *fmt, ...);
+void __noreturn _vdie(const char *fmt, va_list ap);
 
 #endif /* __TRACE_LOCAL_H */
diff --git a/trace-util.c b/trace-util.c
index 45fa95a..0f53e16 100644
--- a/trace-util.c
+++ b/trace-util.c
@@ -1613,7 +1613,7 @@ void tracecmd_put_tracing_file(char *name)
 	free(name);
 }
 
-void __vdie(const char *fmt, va_list ap)
+void __noreturn __vdie(const char *fmt, va_list ap)
 {
 	int ret = errno;
 
@@ -1629,7 +1629,7 @@ void __vdie(const char *fmt, va_list ap)
 	exit(ret);
 }
 
-void __die(const char *fmt, ...)
+void __noreturn __die(const char *fmt, ...)
 {
 	va_list ap;
 
@@ -1638,9 +1638,7 @@ void __die(const char *fmt, ...)
 	va_end(ap);
 }
 
-#define __weak __attribute__((weak))
-
-void __weak die(const char *fmt, ...)
+void __weak __noreturn die(const char *fmt, ...)
 {
 	va_list ap;
 
-- 
2.14.1

  parent reply	other threads:[~2017-11-23 16:34 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-23 16:33 [PATCH 00/11] trace-cmd: Refactoring trace_record() Vladislav Valtchev (VMware)
2017-11-23 16:33 ` [PATCH 01/11] trace-cmd: Extract trace_stop() from trace_record() Vladislav Valtchev (VMware)
2017-11-23 16:33 ` [PATCH 02/11] trace-cmd: Extract trace_restart() " Vladislav Valtchev (VMware)
2017-11-23 16:33 ` [PATCH 03/11] trace-cmd: Extract trace_reset() " Vladislav Valtchev (VMware)
2017-11-23 16:33 ` [PATCH 04/11] trace-cmd: Extract parse_record_options() " Vladislav Valtchev (VMware)
2017-11-28 16:48   ` Steven Rostedt
2017-11-28 18:17     ` Vladislav Valtchev
2017-11-28 18:30       ` Steven Rostedt
2017-11-28 18:57         ` Vladislav Valtchev
2017-11-28 19:15           ` Steven Rostedt
2017-11-29 14:53       ` Steven Rostedt
2017-11-29 15:18         ` Vladislav Valtchev
2017-11-23 16:33 ` [PATCH 05/11] trace-cmd: Rename trace_profile() to trace_profile_int() Vladislav Valtchev (VMware)
2017-11-28 17:05   ` Steven Rostedt
2017-11-28 19:00     ` Vladislav Valtchev
2017-11-23 16:33 ` [PATCH 06/11] trace-cmd: Replacing cmd flags w/ a trace_cmd enum Vladislav Valtchev (VMware)
2017-11-23 16:33 ` [PATCH 07/11] trace-cmd: Extracting record_trace() Vladislav Valtchev (VMware)
2017-11-23 16:33 ` [PATCH 08/11] trace-cmd: Making start,extract,stream,profile separate funcs Vladislav Valtchev (VMware)
2017-11-28 17:14   ` Steven Rostedt
2017-11-28 18:34     ` Vladislav Valtchev
2017-11-28 19:35       ` Steven Rostedt
2017-11-29 10:03         ` Vladislav Valtchev
2017-11-29 12:48           ` Steven Rostedt
2017-11-23 16:33 ` [PATCH 09/11] trace-cmd: Consolidate ARRAY_SIZE() in trace-cmd.h Vladislav Valtchev (VMware)
2017-11-28 17:16   ` Steven Rostedt
2017-11-23 16:33 ` Vladislav Valtchev (VMware) [this message]
2017-11-23 16:33 ` [PATCH 11/11] trace-cmd: Introducing get_trace_cmd_type() Vladislav Valtchev (VMware)
2017-11-28 17:17   ` Steven Rostedt
2017-11-28 18:32     ` Steven Rostedt
2017-11-28 19:04       ` Vladislav Valtchev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171123163335.19078-11-vladislav.valtchev@gmail.com \
    --to=vladislav.valtchev@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=y.karadz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®