]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Use the noreturn attribute, rather than comments
authorAlejandro Colomar <alx@kernel.org>
Tue, 7 Feb 2023 18:50:36 +0000 (19:50 +0100)
committerSerge Hallyn <serge@hallyn.com>
Thu, 9 Feb 2023 04:01:01 +0000 (22:01 -0600)
This will allow the compiler to understand these functions better.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
16 files changed:
src/chage.c
src/chfn.c
src/chgpasswd.c
src/chpasswd.c
src/chsh.c
src/expiry.c
src/faillog.c
src/groupadd.c
src/groupdel.c
src/groupmems.c
src/grpck.c
src/lastlog.c
src/passwd.c
src/pwck.c
src/su.c
src/usermod.c

index 01570d725e13dbc7fae24b2e63114f89cf164f6f..5954ebe881b45a90218e00b3d695470d95789d5f 100644 (file)
@@ -66,7 +66,7 @@ static long inactdays;
 static long expdate;
 
 /* local function prototypes */
-static /*@noreturn@*/void usage (int status);
+NORETURN static void usage (int status);
 static int new_fields (void);
 static void print_date (time_t date);
 static void list_fields (void);
@@ -75,12 +75,14 @@ static void check_flags (int argc, int opt_index);
 static void check_perms (void);
 static void open_files (bool readonly);
 static void close_files (void);
-static /*@noreturn@*/void fail_exit (int code);
+NORETURN static void fail_exit (int code);
 
 /*
  * fail_exit - do some cleanup and exit with the given error code
  */
-static /*@noreturn@*/void fail_exit (int code)
+NORETURN
+static void
+fail_exit (int code)
 {
        if (spw_locked) {
                if (spw_unlock () == 0) {
@@ -112,7 +114,9 @@ static /*@noreturn@*/void fail_exit (int code)
 /*
  * usage - print command line syntax and exit
  */
-static /*@noreturn@*/void usage (int status)
+NORETURN
+static void
+usage (int status)
 {
        FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
        (void) fprintf (usageout,
index 246e2e82d37532bda54d920ee1dd9810e349d57a..d56b329e03d891d1612af55d5f9ce2be49bc6491 100644 (file)
@@ -55,7 +55,7 @@ static bool pw_locked = false;
 
 /* local function prototypes */
 static void fail_exit (int code);
-static /*@noreturn@*/void usage (int status);
+NORETURN static void usage (int status);
 static bool may_change_field (int);
 static void new_fields (void);
 static char *copy_field (char *, char *, char *);
@@ -86,7 +86,9 @@ static void fail_exit (int code)
 /*
  * usage - print command line syntax and exit
  */
-static /*@noreturn@*/void usage (int status)
+NORETURN
+static void
+usage (int status)
 {
        FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
        (void) fprintf (usageout,
index f6c92293934521efad839ed652258b30a17161fd..b750994e2d23d62302c81bad75a730355cf2a173 100644 (file)
@@ -63,7 +63,7 @@ static bool gr_locked = false;
 
 /* local function prototypes */
 static void fail_exit (int code);
-static /*@noreturn@*/void usage (int status);
+NORETURN static void usage (int status);
 static void process_flags (int argc, char **argv);
 static void check_flags (void);
 static void check_perms (void);
@@ -99,7 +99,9 @@ static void fail_exit (int code)
 /*
  * usage - display usage message and exit
  */
-static /*@noreturn@*/void usage (int status)
+NORETURN
+static void
+usage (int status)
 {
        FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
        (void) fprintf (usageout,
index e3188a768a6d3c3d07ff3f2e38aafdda5c715a74..5c1c6c261ba8951687b38953ef112356d5462b68 100644 (file)
@@ -60,7 +60,7 @@ static bool spw_locked = false;
 
 /* local function prototypes */
 static void fail_exit (int code);
-static /*@noreturn@*/void usage (int status);
+NORETURN static void usage (int status);
 static void process_flags (int argc, char **argv);
 static void check_flags (void);
 static void check_perms (void);
@@ -94,7 +94,9 @@ static void fail_exit (int code)
 /*
  * usage - display usage message and exit
  */
-static /*@noreturn@*/void usage (int status)
+NORETURN
+static void
+usage (int status)
 {
        FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
        (void) fprintf (usageout,
index fe0f46090f55aedaea1332cb8b9802fbb6833b92..64f53392b1151e927e26280f3ed5bd994bb0ef73 100644 (file)
@@ -53,8 +53,8 @@ static bool pw_locked = false;
 /* external identifiers */
 
 /* local function prototypes */
-static /*@noreturn@*/void fail_exit (int code);
-static /*@noreturn@*/void usage (int status);
+NORETURN static void fail_exit (int code);
+NORETURN static void usage (int status);
 static void new_fields (void);
 static bool shell_is_listed (const char *);
 static bool is_restricted_shell (const char *);
@@ -65,7 +65,9 @@ static void update_shell (const char *user, char *loginsh);
 /*
  * fail_exit - do some cleanup and exit with the given error code
  */
-static /*@noreturn@*/void fail_exit (int code)
+NORETURN
+static void
+fail_exit (int code)
 {
        if (pw_locked) {
                if (pw_unlock () == 0) {
@@ -83,7 +85,9 @@ static /*@noreturn@*/void fail_exit (int code)
 /*
  * usage - print command line syntax and exit
  */
-static /*@noreturn@*/void usage (int status)
+NORETURN
+static void
+usage (int status)
 {
        FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
        (void) fprintf (usageout,
index 70e6c20e060ec83a727c3c5033bf13277c31219a..b980b65653860ca4cd43193fce4099b18bd217bc 100644 (file)
@@ -28,7 +28,7 @@ static bool cflg = false;
 
 /* local function prototypes */
 static void catch_signals (unused int sig);
-static /*@noreturn@*/void usage (int status);
+NORETURN static void usage (int status);
 static void process_flags (int argc, char **argv);
 
 /*
@@ -42,7 +42,9 @@ static void catch_signals (unused int sig)
 /*
  * usage - print syntax message and exit
  */
-static /*@noreturn@*/void usage (int status)
+NORETURN
+static void
+usage (int status)
 {
        FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
        (void) fprintf (usageout,
index 72b8a956df99113f444efd23d5c4f7b51911b88a..0f52e0f76177f35d3ca14222b810925b113cda22 100644 (file)
@@ -26,7 +26,7 @@
 #include "shadowlog.h"
 
 /* local function prototypes */
-static /*@noreturn@*/void usage (int status);
+NORETURN static void usage (int status);
 static void print_one (/*@null@*/const struct passwd *pw, bool force);
 static void set_locktime (long locktime);
 static bool set_locktime_one (uid_t uid, long locktime);
@@ -59,7 +59,9 @@ static struct stat statbuf;   /* fstat buffer for file size */
 
 #define        NOW     time(NULL)
 
-static /*@noreturn@*/void usage (int status)
+NORETURN
+static void
+usage (int status)
 {
        FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
        (void) fprintf (usageout,
index 66ccb53e9e60ebf8c1778e88d44db5e3a1b836d5..9a6df27334d199046f99cab401751d32fca489b2 100644 (file)
@@ -70,7 +70,7 @@ static bool is_shadow_grp;
 #endif
 
 /* local function prototypes */
-static /*@noreturn@*/void usage (int status);
+NORETURN static void usage (int status);
 static void new_grent (struct group *grent);
 
 #ifdef SHADOWGRP
@@ -87,7 +87,9 @@ static void check_perms (void);
 /*
  * usage - display usage message and exit
  */
-static /*@noreturn@*/void usage (int status)
+NORETURN
+static void
+usage (int status)
 {
        FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
        (void) fprintf (usageout,
index a9b15dca9fde83e8ccdb24b9737c509e82a0fd1d..65fc04e23ba20761099ebf5d5bb49b405c68bd54 100644 (file)
@@ -58,7 +58,7 @@ static bool is_shadow_grp;
 #define E_GRP_UPDATE   10      /* can't update group file */
 
 /* local function prototypes */
-static /*@noreturn@*/void usage (int status);
+NORETURN static void usage (int status);
 static void grp_update (void);
 static void close_files (void);
 static void open_files (void);
@@ -68,7 +68,9 @@ static void process_flags (int argc, char **argv);
 /*
  * usage - display usage message and exit
  */
-static /*@noreturn@*/void usage (int status)
+NORETURN
+static void
+usage (int status)
 {
        FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
        (void) fprintf (usageout,
index a0e3266b0c53cfc8201bcdf86352ee5edfba99bc..a962c055f4af665864aae8f96357020f472d6626 100644 (file)
@@ -66,7 +66,7 @@ static void remove_user (const char *user,
                          const struct group *grp);
 static void purge_members (const struct group *grp);
 static void display_members (const char *const *members);
-static /*@noreturn@*/void usage (int status);
+NORETURN static void usage (int status);
 static void process_flags (int argc, char **argv);
 static void check_perms (void);
 static void fail_exit (int code);
@@ -339,7 +339,9 @@ static void display_members (const char *const *members)
        }
 }
 
-static /*@noreturn@*/void usage (int status)
+NORETURN
+static void
+usage (int status)
 {
        FILE *usageout = (EXIT_SUCCESS != status) ? stderr : stdout;
        (void) fprintf (usageout,
index 881fb4de716dae65530753be97f7622e92d0a86a..ec092b2c296714554d2dd4bf1c28129fa7f95ccc 100644 (file)
@@ -62,7 +62,7 @@ static bool silence_warnings = false;
 
 /* local function prototypes */
 static void fail_exit (int status);
-static /*@noreturn@*/void usage (int status);
+NORETURN static void usage (int status);
 static void delete_member (char **, const char *);
 static void process_flags (int argc, char **argv);
 static void open_files (void);
@@ -114,7 +114,9 @@ static void fail_exit (int status)
 /*
  * usage - print syntax message and exit
  */
-static /*@noreturn@*/void usage (int status)
+NORETURN
+static void
+usage (int status)
 {
        FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
 #ifdef SHADOWGRP
index 3338d6bd1a4614ba2b2bbbd844caffe34e7bac54..6c2a34d31db4c31a6a827bfef154049bcb76a540 100644 (file)
@@ -58,7 +58,9 @@ static bool Sflg = false;     /* set record for user */
 
 #define        NOW     time(NULL)
 
-static /*@noreturn@*/void usage (int status)
+NORETURN
+static void
+usage (int status)
 {
        FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
        (void) fprintf (usageout,
index c729a14a1d6130aa3b24326d75f89992130657be..1aebdc37ca3957b3c483f490e7e4313e1d47da66 100644 (file)
@@ -104,7 +104,7 @@ static bool do_update_pwd = false;
  */
 
 /* local function prototypes */
-static /*@noreturn@*/void usage (int);
+NORETURN static void usage (int);
 
 #ifndef USE_PAM
 static bool reuse (const char *, const struct passwd *);
@@ -114,8 +114,8 @@ static void check_password (const struct passwd *, const struct spwd *);
 #endif                         /* !USE_PAM */
 static /*@observer@*/const char *pw_status (const char *);
 static void print_status (const struct passwd *);
-static /*@noreturn@*/void fail_exit (int);
-static /*@noreturn@*/void oom (void);
+NORETURN static void fail_exit (int);
+NORETURN static void oom (void);
 static char *update_crypt_pw (char *);
 static void update_noshadow (void);
 
@@ -124,7 +124,9 @@ static void update_shadow (void);
 /*
  * usage - print command usage and exit
  */
-static /*@noreturn@*/void usage (int status)
+NORETURN
+static void
+usage (int status)
 {
        FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
        (void) fprintf (usageout,
@@ -466,7 +468,9 @@ static void print_status (const struct passwd *pw)
 }
 
 
-static /*@noreturn@*/void fail_exit (int status)
+NORETURN
+static void
+fail_exit (int status)
 {
        if (pw_locked) {
                if (pw_unlock () == 0) {
@@ -487,7 +491,9 @@ static /*@noreturn@*/void fail_exit (int status)
        exit (status);
 }
 
-static /*@noreturn@*/void oom (void)
+NORETURN
+static void
+oom (void)
 {
        (void) fprintf (stderr, _("%s: out of memory\n"), Prog);
        fail_exit (E_FAILURE);
index 83aaaca93ed96acaca9bb4c853b358cd8c506f5b..8e449fc3f2b52b24bc13df6aecf167ae7e64179e 100644 (file)
@@ -66,7 +66,7 @@ static bool quiet = false;            /* don't report warnings, only errors */
 
 /* local function prototypes */
 static void fail_exit (int code);
-static /*@noreturn@*/void usage (int status);
+NORETURN static void usage (int status);
 static void process_flags (int argc, char **argv);
 static void open_files (void);
 static void close_files (bool changed);
@@ -109,7 +109,9 @@ static void fail_exit (int code)
 /*
  * usage - print syntax message and exit
  */
-static /*@noreturn@*/void usage (int status)
+NORETURN
+static void
+usage (int status)
 {
        FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
 #ifdef WITH_TCB
index 4fe86fee8f31c02a443f1754b7f5f89984b64462..35995c642f510b7c7f3572b97f42a6ca242005c5 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -111,7 +111,7 @@ static void die (int);
 static bool iswheel (const char *);
 #endif                         /* !USE_PAM */
 static bool restricted_shell (const char *shellname);
-static /*@noreturn@*/void su_failure (const char *tty, bool su_to_root);
+NORETURN static void su_failure (const char *tty, bool su_to_root);
 static /*@only@*/struct passwd * check_perms (void);
 #ifdef USE_PAM
 static void check_perms_pam (const struct passwd *pw);
@@ -185,7 +185,9 @@ static bool restricted_shell (const char *shellname)
        return true;
 }
 
-static /*@noreturn@*/void su_failure (const char *tty, bool su_to_root)
+NORETURN
+static void
+su_failure (const char *tty, bool su_to_root)
 {
        sulog (tty, false, caller_name, name);  /* log failed attempt */
        if (getdef_bool ("SYSLOG_SU_ENAB")) {
index 1c65a934b8dd0cfc87aca8af7655968f80b1dee2..7a357c4ff66993f484d2bed8a592cc3933ba553b 100644 (file)
@@ -163,10 +163,10 @@ static bool sub_gid_locked = false;
 
 /* local function prototypes */
 static int get_groups (char *);
-static /*@noreturn@*/void usage (int status);
+NORETURN static void usage (int status);
 static void new_pwent (struct passwd *);
 static void new_spent (struct spwd *);
-static /*@noreturn@*/void fail_exit (int);
+NORETURN static void fail_exit (int);
 static void update_group (void);
 
 #ifdef SHADOWGRP
@@ -359,7 +359,9 @@ static int prepend_range(const char *str, struct ulong_range_list_entry **head)
 /*
  * usage - display usage message and exit
  */
-static /*@noreturn@*/void usage (int status)
+NORETURN
+static void
+usage (int status)
 {
        FILE *usageout = (E_SUCCESS != status) ? stderr : stdout;
        (void) fprintf (usageout,
@@ -627,7 +629,9 @@ static void new_spent (struct spwd *spent)
 /*
  * fail_exit - exit with an error code after unlocking files
  */
-static /*@noreturn@*/void fail_exit (int code)
+NORETURN
+static void
+fail_exit (int code)
 {
        if (gr_locked) {
                if (gr_unlock () == 0) {