From patchwork Tue Nov 1 21:23:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Roberts, William C" X-Patchwork-Id: 9408135 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 92A5C60585 for ; Tue, 1 Nov 2016 21:23:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84C8D29A50 for ; Tue, 1 Nov 2016 21:23:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7873529A73; Tue, 1 Nov 2016 21:23:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from emsm-gh1-uea11.nsa.gov (smtp.nsa.gov [8.44.101.9]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E8D529A50 for ; Tue, 1 Nov 2016 21:23:58 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.31,433,1473120000"; d="scan'208";a="411107" IronPort-PHdr: =?us-ascii?q?9a23=3AnfPgERXv7VH8+Ev5b/XRNX+o/VjV8LGtZVwlr6E/?= =?us-ascii?q?grcLSJyIuqrYZhKBt8tkgFKBZ4jH8fUM07OQ6PG6HzxZqs/d7DgrS99lb1c9k8?= =?us-ascii?q?IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9?= =?us-ascii?q?HOnpAIma153xjLHovc2KKFwU2HKUWvBbFF2OtwLft80b08NJC50a7V/3mEZOYP?= =?us-ascii?q?lc3mhyJFiezF7W78a0+4N/oWwL46pyv/NaVe3GW4hwDfkBVHV1e1wyscvqvh7H?= =?us-ascii?q?RBDJ53wbSX4+l0ZYRQ/f41WyRZr1sy3npsJhySKaOovwVrlyVjO8vIlxTxq9ly?= =?us-ascii?q?YDMz8w9SfczNZ3hq9BvAmJphpjzoqSa4aQZ6k2Rb/UYd5PHTkJZc1WTSEUR9rk?= =?us-ascii?q?Yg=3D=3D?= X-IPAS-Result: =?us-ascii?q?A2EzBADZBhlY/wHyM5BdGgEBAQECAQEBAQgBAQEBFQEBAQE?= =?us-ascii?q?CAQEBAQgBAQEBgn8BAQEBAR+BVKYRlGokiB1TAQEBAQEBAQECAQJfKIIzBAMTB?= =?us-ascii?q?YIXAjcUIAsDAwkCFwghCAgDAS0VGAcLBRgEiDO4VgEBCAEBAQEBIohChmkRAYV?= =?us-ascii?q?8BY5OeIR2hV6QNQKKCIV6ApEXVIQEHIFzUgGFIg0XB1qBNAEBAQ?= Received: from unknown (HELO tarius.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea11.nsa.gov with ESMTP; 01 Nov 2016 21:23:56 +0000 Received: from prometheus.infosec.tycho.ncsc.mil (prometheus [192.168.25.40]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id uA1LNrPT011635; Tue, 1 Nov 2016 17:23:54 -0400 Received: from tarius.tycho.ncsc.mil (tarius.infosec.tycho.ncsc.mil [144.51.242.1]) by prometheus.infosec.tycho.ncsc.mil (8.15.2/8.15.2) with ESMTP id uA1LNFmM042290 for ; Tue, 1 Nov 2016 17:23:15 -0400 Received: from goalie.tycho.ncsc.mil (goalie [144.51.242.250]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id uA1LNEZQ011609; Tue, 1 Nov 2016 17:23:14 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A1DCAwDtBhlY/yNjr8ZdGgEBAQECAQEBAQgBAQEBgyoBAQEBAR+BVLZshBYYhgqCGFMBAgEBAQEBAmKGCTCBDxKIVLhWAQEIJ4hCiWMLgwkFjk54hHaFXpA1ApACApEXVIQEHIFzHjQBhSIrgg4BAQE X-IPAS-Result: A1DCAwDtBhlY/yNjr8ZdGgEBAQECAQEBAQgBAQEBgyoBAQEBAR+BVLZshBYYhgqCGFMBAgEBAQEBAmKGCTCBDxKIVLhWAQEIJ4hCiWMLgwkFjk54hHaFXpA1ApACApEXVIQEHIFzHjQBhSIrgg4BAQE X-IronPort-AV: E=Sophos;i="5.31,433,1473134400"; d="scan'208";a="5799534" Received: from emsm-gh1-uea11.corp.nsa.gov (HELO emsm-gh1-uea11.nsa.gov) ([10.208.41.37]) by goalie.tycho.ncsc.mil with ESMTP; 01 Nov 2016 17:23:14 -0400 IronPort-PHdr: =?us-ascii?q?9a23=3A6sRVoRDnGM8rBip/L8vyUyQJP3N1i/DPJgcQr6Af?= =?us-ascii?q?oPdwSP78pMbcNUDSrc9gkEXOFd2CrakV0ayG6uu5BTBIyK3CmUhKSIZLWR4BhJ?= =?us-ascii?q?detC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TWM5DIfUi/yKRBy?= =?us-ascii?q?brysXNWD1YLnjqvrp8GbSj4LrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYe?= =?us-ascii?q?VcyDAgD1uSmxHh+pX4p8Y7oGx48sgs/M9YUKj8Y79wDfkBVGxnYCgJ45jttBLE?= =?us-ascii?q?SQKUoHobVX4Nuh8UE07C9h6+Foz8tir8q/pVxDiRPcqwS6s9Hzul8fRFUhjt3T?= =?us-ascii?q?gGMzo4+WSRgYpqi6hWug66jx1534PQJoqSMaktNpjBdM8XEDISFv1aUDZMV8bl?= =?us-ascii?q?N9MC?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0EyBADZBhlY/yNjr8ZdGgEBAQECAQEBA?= =?us-ascii?q?QgBAQEBFQEBAQECAQEBAQgBAQEBgn8BAQEBAR+BVKYRkFuEFhiGCoIYUwEBAQE?= =?us-ascii?q?BAQEBAgECXyiCMwQBFQEEgw8wgQ8SiFS4VgEBCAIBJIhCiWMLgwkFjk54hHaFX?= =?us-ascii?q?pA1ApACApEXVIQEHIFzHjQBhSIrQYFNAQEB?= X-IPAS-Result: =?us-ascii?q?A0EyBADZBhlY/yNjr8ZdGgEBAQECAQEBAQgBAQEBFQEBAQE?= =?us-ascii?q?CAQEBAQgBAQEBgn8BAQEBAR+BVKYRkFuEFhiGCoIYUwEBAQEBAQEBAgECXyiCM?= =?us-ascii?q?wQBFQEEgw8wgQ8SiFS4VgEBCAIBJIhCiWMLgwkFjk54hHaFXpA1ApACApEXVIQ?= =?us-ascii?q?EHIFzHjQBhSIrQYFNAQEB?= X-IronPort-AV: E=Sophos;i="5.31,433,1473120000"; d="scan'208";a="411083" Received: from fmsmga002-icc.fm.intel.com ([198.175.99.35]) by emsm-gh1-uea11.nsa.gov with ESMTP; 01 Nov 2016 21:23:13 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga002-icc.fm.intel.com with ESMTP; 01 Nov 2016 14:23:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.31,433,1473145200"; d="scan'208"; a="1053717751" Received: from cmrodrig-mobl.amr.corp.intel.com (HELO wcrobert-MOBL1.amr.corp.intel.com) ([10.254.111.80]) by orsmga001.jf.intel.com with ESMTP; 01 Nov 2016 14:23:13 -0700 From: william.c.roberts@intel.com To: nicolas.iooss@m4x.org, selinux@tycho.nsa.gov Subject: [PATCH] libselinux/utils: fix all the noreturn errors Date: Tue, 1 Nov 2016 14:23:10 -0700 Message-Id: <1478035390-24547-1-git-send-email-william.c.roberts@intel.com> X-Mailer: git-send-email 2.7.4 X-BeenThere: selinux@tycho.nsa.gov X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: Cc: sds@tycho.nsa.gov MIME-Version: 1.0 Errors-To: selinux-bounces@tycho.nsa.gov Sender: "Selinux" X-Virus-Scanned: ClamAV using ClamSMTP From: William Roberts 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 --- libselinux/utils/avcstat.c | 2 +- libselinux/utils/getconlist.c | 2 +- libselinux/utils/getdefaultcon.c | 2 +- libselinux/utils/getsebool.c | 2 +- libselinux/utils/matchpathcon.c | 2 +- libselinux/utils/selabel_digest.c | 2 +- libselinux/utils/selabel_lookup.c | 2 +- libselinux/utils/selabel_lookup_best_match.c | 2 +- libselinux/utils/selabel_partial_match.c | 2 +- libselinux/utils/selinux_check_securetty_context.c | 2 +- libselinux/utils/selinux_restorecon.c | 2 +- libselinux/utils/selinuxexeccon.c | 2 +- libselinux/utils/setenforce.c | 2 +- libselinux/utils/togglesebool.c | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/libselinux/utils/avcstat.c b/libselinux/utils/avcstat.c index 1d4d5c8..70b3109 100644 --- a/libselinux/utils/avcstat.c +++ b/libselinux/utils/avcstat.c @@ -43,7 +43,7 @@ static char buf[DEF_BUF_SIZE]; /* selinuxfs mount point */ 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; diff --git a/libselinux/utils/getconlist.c b/libselinux/utils/getconlist.c index 872ce05..adec178 100644 --- a/libselinux/utils/getconlist.c +++ b/libselinux/utils/getconlist.c @@ -9,7 +9,7 @@ #include #include -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); if (detail) diff --git a/libselinux/utils/getdefaultcon.c b/libselinux/utils/getdefaultcon.c index c6f7151..96a5a8c 100644 --- a/libselinux/utils/getdefaultcon.c +++ b/libselinux/utils/getdefaultcon.c @@ -9,7 +9,7 @@ #include #include -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); if (detail) diff --git a/libselinux/utils/getsebool.c b/libselinux/utils/getsebool.c index 9ae9243..3c6eba5 100644 --- a/libselinux/utils/getsebool.c +++ b/libselinux/utils/getsebool.c @@ -6,7 +6,7 @@ #include #include -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); exit(1); diff --git a/libselinux/utils/matchpathcon.c b/libselinux/utils/matchpathcon.c index d1f1348..fca8ee2 100644 --- a/libselinux/utils/matchpathcon.c +++ b/libselinux/utils/matchpathcon.c @@ -12,7 +12,7 @@ #include #include -static void usage(const char *progname) +static __attribute__ ((__noreturn__)) void usage(const char *progname) { fprintf(stderr, "usage: %s [-N] [-n] [-f file_contexts] [ -P policy_root_path ] [-p prefix] [-Vq] path...\n", diff --git a/libselinux/utils/selabel_digest.c b/libselinux/utils/selabel_digest.c index e4d84a5..49408a0 100644 --- a/libselinux/utils/selabel_digest.c +++ b/libselinux/utils/selabel_digest.c @@ -8,7 +8,7 @@ static size_t digest_len; -static void usage(const char *progname) +static __attribute__ ((__noreturn__)) void usage(const char *progname) { fprintf(stderr, "usage: %s -b backend [-d] [-v] [-B] [-i] [-f file]\n\n" diff --git a/libselinux/utils/selabel_lookup.c b/libselinux/utils/selabel_lookup.c index b678a89..1aef64d 100644 --- a/libselinux/utils/selabel_lookup.c +++ b/libselinux/utils/selabel_lookup.c @@ -6,7 +6,7 @@ #include #include -static void usage(const char *progname) +static __attribute__ ((__noreturn__)) void usage(const char *progname) { fprintf(stderr, "usage: %s -b backend [-v] [-r] -k key [-t type] [-f file]\n\n" diff --git a/libselinux/utils/selabel_lookup_best_match.c b/libselinux/utils/selabel_lookup_best_match.c index d74382f..6a71742 100644 --- a/libselinux/utils/selabel_lookup_best_match.c +++ b/libselinux/utils/selabel_lookup_best_match.c @@ -7,7 +7,7 @@ #include #include -static void usage(const char *progname) +static __attribute__ ((__noreturn__)) void usage(const char *progname) { fprintf(stderr, "usage: %s [-v] [-r] -p path [-m mode] [-f file] [link...]\n\n" diff --git a/libselinux/utils/selabel_partial_match.c b/libselinux/utils/selabel_partial_match.c index 017702d..c5932cb 100644 --- a/libselinux/utils/selabel_partial_match.c +++ b/libselinux/utils/selabel_partial_match.c @@ -7,7 +7,7 @@ #include #include -static void usage(const char *progname) +static __attribute__ ((__noreturn__)) void usage(const char *progname) { fprintf(stderr, "usage: %s [-v] -p [-f file]\n\n" diff --git a/libselinux/utils/selinux_check_securetty_context.c b/libselinux/utils/selinux_check_securetty_context.c index b158eb3..84f5907 100644 --- a/libselinux/utils/selinux_check_securetty_context.c +++ b/libselinux/utils/selinux_check_securetty_context.c @@ -9,7 +9,7 @@ #include #include -static void usage(const char *progname) +static __attribute__ ((__noreturn__)) void usage(const char *progname) { fprintf(stderr, "usage: %s tty_context...\n", progname); exit(1); diff --git a/libselinux/utils/selinux_restorecon.c b/libselinux/utils/selinux_restorecon.c index 7aea81f..4d2b08f 100644 --- a/libselinux/utils/selinux_restorecon.c +++ b/libselinux/utils/selinux_restorecon.c @@ -34,7 +34,7 @@ static int validate_context(char **contextp) return 0; } -static void usage(const char *progname) +static __attribute__ ((__noreturn__)) void usage(const char *progname) { fprintf(stderr, "\nusage: %s [-FCnRrdmiIaAsl] [-e dir] [-v|-P]\n" diff --git a/libselinux/utils/selinuxexeccon.c b/libselinux/utils/selinuxexeccon.c index e0212e4..b50e788 100644 --- a/libselinux/utils/selinuxexeccon.c +++ b/libselinux/utils/selinuxexeccon.c @@ -8,7 +8,7 @@ #include #include -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); if (detail) diff --git a/libselinux/utils/setenforce.c b/libselinux/utils/setenforce.c index df58597..60a20a4 100644 --- a/libselinux/utils/setenforce.c +++ b/libselinux/utils/setenforce.c @@ -6,7 +6,7 @@ #include #include -static void usage(const char *progname) +static __attribute__ ((__noreturn__)) void usage(const char *progname) { fprintf(stderr, "usage: %s [ Enforcing | Permissive | 1 | 0 ]\n", progname); diff --git a/libselinux/utils/togglesebool.c b/libselinux/utils/togglesebool.c index 309f83b..4a7c830 100644 --- a/libselinux/utils/togglesebool.c +++ b/libselinux/utils/togglesebool.c @@ -10,7 +10,7 @@ /* Attempt to rollback the transaction. No need to check error 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;