tools: Adopt __noreturn from kernel sources

To have a more compact way to specify that a function doesn't return,
instead of the open coded:

	__attribute__((noreturn))

And use it instead of the tools/perf/ specific variation, NORETURN.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-l0y144qzixcy5t4c6i7pdiqj@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2017-06-16 11:39:15 -03:00
parent 36ce565114
commit 6c3466435b
4 changed files with 11 additions and 10 deletions

View file

@ -11,20 +11,18 @@
#include <stddef.h>
#include <stdlib.h>
#include <stdarg.h>
#include <linux/compiler.h>
#include <linux/types.h>
#ifdef __GNUC__
#define NORETURN __attribute__((__noreturn__))
#else
#define NORETURN
#ifndef __GNUC__
#ifndef __attribute__
#define __attribute__(x)
#endif
#endif
/* General helper functions */
void usage(const char *err) NORETURN;
void die(const char *err, ...) NORETURN __attribute__((format (printf, 1, 2)));
void usage(const char *err) __noreturn;
void die(const char *err, ...) __noreturn __attribute__((format (printf, 1, 2)));
int error(const char *err, ...) __attribute__((format (printf, 1, 2)));
void warning(const char *err, ...) __attribute__((format (printf, 1, 2)));