libselinux/utils: fix all the noreturn errors

When building with clang, multiple noreturn issues arise,
for instance:

selabel_partial_match.c:11:1: error: function 'usage' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]

Fix these.

Signed-off-by: William Roberts <william.c.roberts@intel.com>
This commit is contained in:
William Roberts 2016-11-01 14:23:10 -07:00 committed by Stephen Smalley
parent 4c519cd730
commit e4f2bcce24
14 changed files with 14 additions and 14 deletions

View file

@ -43,7 +43,7 @@ static char buf[DEF_BUF_SIZE];
/* selinuxfs mount point */ /* selinuxfs mount point */
extern char *selinux_mnt; extern char *selinux_mnt;
static __attribute__((__format__(printf,1,2))) void die(const char *msg, ...) static __attribute__((__format__(printf,1,2),__noreturn__)) void die(const char *msg, ...)
{ {
va_list args; va_list args;

View file

@ -9,7 +9,7 @@
#include <selinux/selinux.h> #include <selinux/selinux.h>
#include <selinux/get_context_list.h> #include <selinux/get_context_list.h>
static void usage(const char *name, const char *detail, int rc) static __attribute__ ((__noreturn__)) void usage(const char *name, const char *detail, int rc)
{ {
fprintf(stderr, "usage: %s [-l level] user [context]\n", name); fprintf(stderr, "usage: %s [-l level] user [context]\n", name);
if (detail) if (detail)

View file

@ -9,7 +9,7 @@
#include <selinux/selinux.h> #include <selinux/selinux.h>
#include <selinux/get_context_list.h> #include <selinux/get_context_list.h>
static void usage(const char *name, const char *detail, int rc) static __attribute__ ((__noreturn__)) void usage(const char *name, const char *detail, int rc)
{ {
fprintf(stderr, "usage: %s [-l level] [-s service] user [fromcon]\n", name); fprintf(stderr, "usage: %s [-l level] [-s service] user [fromcon]\n", name);
if (detail) if (detail)

View file

@ -6,7 +6,7 @@
#include <string.h> #include <string.h>
#include <selinux/selinux.h> #include <selinux/selinux.h>
static void usage(const char *progname) static __attribute__ ((__noreturn__)) void usage(const char *progname)
{ {
fprintf(stderr, "usage: %s -a or %s boolean...\n", progname, progname); fprintf(stderr, "usage: %s -a or %s boolean...\n", progname, progname);
exit(1); exit(1);

View file

@ -12,7 +12,7 @@
#include <limits.h> #include <limits.h>
#include <stdlib.h> #include <stdlib.h>
static void usage(const char *progname) static __attribute__ ((__noreturn__)) void usage(const char *progname)
{ {
fprintf(stderr, fprintf(stderr,
"usage: %s [-N] [-n] [-f file_contexts] [ -P policy_root_path ] [-p prefix] [-Vq] path...\n", "usage: %s [-N] [-n] [-f file_contexts] [ -P policy_root_path ] [-p prefix] [-Vq] path...\n",

View file

@ -8,7 +8,7 @@
static size_t digest_len; static size_t digest_len;
static void usage(const char *progname) static __attribute__ ((__noreturn__)) void usage(const char *progname)
{ {
fprintf(stderr, fprintf(stderr,
"usage: %s -b backend [-d] [-v] [-B] [-i] [-f file]\n\n" "usage: %s -b backend [-d] [-v] [-B] [-i] [-f file]\n\n"

View file

@ -6,7 +6,7 @@
#include <selinux/selinux.h> #include <selinux/selinux.h>
#include <selinux/label.h> #include <selinux/label.h>
static void usage(const char *progname) static __attribute__ ((__noreturn__)) void usage(const char *progname)
{ {
fprintf(stderr, fprintf(stderr,
"usage: %s -b backend [-v] [-r] -k key [-t type] [-f file]\n\n" "usage: %s -b backend [-v] [-r] -k key [-t type] [-f file]\n\n"

View file

@ -7,7 +7,7 @@
#include <selinux/selinux.h> #include <selinux/selinux.h>
#include <selinux/label.h> #include <selinux/label.h>
static void usage(const char *progname) static __attribute__ ((__noreturn__)) void usage(const char *progname)
{ {
fprintf(stderr, fprintf(stderr,
"usage: %s [-v] [-r] -p path [-m mode] [-f file] [link...]\n\n" "usage: %s [-v] [-r] -p path [-m mode] [-f file] [link...]\n\n"

View file

@ -7,7 +7,7 @@
#include <selinux/selinux.h> #include <selinux/selinux.h>
#include <selinux/label.h> #include <selinux/label.h>
static void usage(const char *progname) static __attribute__ ((__noreturn__)) void usage(const char *progname)
{ {
fprintf(stderr, fprintf(stderr,
"usage: %s [-v] -p <path> [-f file]\n\n" "usage: %s [-v] -p <path> [-f file]\n\n"

View file

@ -9,7 +9,7 @@
#include <sys/errno.h> #include <sys/errno.h>
#include <selinux/selinux.h> #include <selinux/selinux.h>
static void usage(const char *progname) static __attribute__ ((__noreturn__)) void usage(const char *progname)
{ {
fprintf(stderr, "usage: %s tty_context...\n", progname); fprintf(stderr, "usage: %s tty_context...\n", progname);
exit(1); exit(1);

View file

@ -34,7 +34,7 @@ static int validate_context(char **contextp)
return 0; return 0;
} }
static void usage(const char *progname) static __attribute__ ((__noreturn__)) void usage(const char *progname)
{ {
fprintf(stderr, fprintf(stderr,
"\nusage: %s [-FCnRrdmiIaAsl] [-e dir] [-v|-P]\n" "\nusage: %s [-FCnRrdmiIaAsl] [-e dir] [-v|-P]\n"

View file

@ -8,7 +8,7 @@
#include <ctype.h> #include <ctype.h>
#include <selinux/selinux.h> #include <selinux/selinux.h>
static void usage(const char *name, const char *detail, int rc) static __attribute__ ((__noreturn__)) void usage(const char *name, const char *detail, int rc)
{ {
fprintf(stderr, "usage: %s command [ fromcon ]\n", name); fprintf(stderr, "usage: %s command [ fromcon ]\n", name);
if (detail) if (detail)

View file

@ -6,7 +6,7 @@
#include <strings.h> #include <strings.h>
#include <selinux/selinux.h> #include <selinux/selinux.h>
static void usage(const char *progname) static __attribute__ ((__noreturn__)) void usage(const char *progname)
{ {
fprintf(stderr, "usage: %s [ Enforcing | Permissive | 1 | 0 ]\n", fprintf(stderr, "usage: %s [ Enforcing | Permissive | 1 | 0 ]\n",
progname); progname);

View file

@ -10,7 +10,7 @@
/* Attempt to rollback the transaction. No need to check error /* Attempt to rollback the transaction. No need to check error
codes since this is rolling back something that blew up. */ codes since this is rolling back something that blew up. */
static void rollback(int argc, char **argv) static __attribute__ ((__noreturn__)) void rollback(int argc, char **argv)
{ {
int i; int i;