Skip to content

Commit

Permalink
Merge pull request #5069 from elliefm/v311/3737-attribute-noreturn
Browse files Browse the repository at this point in the history
add attribute noreturn where useful
  • Loading branch information
elliefm authored Oct 9, 2024
2 parents b93fac6 + 73de4ac commit 06cb964
Show file tree
Hide file tree
Showing 19 changed files with 34 additions and 10 deletions.
5 changes: 2 additions & 3 deletions imap/ctl_zoneinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ const int config_need_data = 0;
static int verbose = 0;

/* forward declarations */
void usage(void);
void usage(void) __attribute__((noreturn));
void free_zoneinfo(void *data);
void store_zoneinfo(const char *tzid, void *data, void *rock);
void do_zonedir(const char *prefix, struct hash_table *tzentries,
struct zoneinfo *info);
void shut_down(int code);
void shut_down(int code) __attribute__((noreturn));


int main(int argc, char **argv)
Expand Down Expand Up @@ -503,7 +503,6 @@ void store_zoneinfo(const char *tzid, void *data, void *rock)
/*
* Cleanly shut down and exit
*/
void shut_down(int code) __attribute__((noreturn));
void shut_down(int code)
{
in_shutdown = 1;
Expand Down
1 change: 1 addition & 0 deletions imap/cyr_synclog.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#include "util.h"
#include "xmalloc.h"

__attribute__((noreturn))
void usage(const char *name) {
fprintf(stderr, "Usage: %s [-C altconfig] [-{type}] value\n", name);

Expand Down
4 changes: 2 additions & 2 deletions imap/cyr_virusscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ static struct scan_engine engine = { "<None Configured>", NULL, NULL, NULL, NULL


/* forward declarations */
int usage(char *name);
void usage(char *name) __attribute__((noreturn));
int scan_me(struct findall_data *, void *);
unsigned virus_check(struct mailbox *mailbox,
const struct index_record *record,
Expand Down Expand Up @@ -395,7 +395,7 @@ int main (int argc, char *argv[])
return 0;
}

int usage(char *name)
void usage(char *name)
{
printf("usage: %s [-C <alt_config>] [-s <imap-search-string>] [ -r [-n] ] [-v]\n"
"\t[mboxpattern1 ... [mboxpatternN]]\n", name);
Expand Down
4 changes: 2 additions & 2 deletions imap/dav_reconstruct.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ static struct namespace recon_namespace;
const int config_need_data = 0;

/* forward declarations */
void usage(void);
void shut_down(int code);
void usage(void) __attribute__((noreturn));
void shut_down(int code) __attribute__((noreturn));

static int code = 0;

Expand Down
2 changes: 2 additions & 0 deletions imap/fud.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
/* generated headers are not necessarily in current directory */
#include "imap/imap_err.h"

#include "master/service.h"

#define REQ_OK 0
#define REQ_DENY 1
#define REQ_UNK 2
Expand Down
6 changes: 4 additions & 2 deletions imap/httpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@
#include "imap/imap_err.h"
#include "imap/http_err.h"

#include "master/service.h"

#ifdef WITH_DAV
#include "http_dav.h"
#endif
Expand Down Expand Up @@ -481,8 +483,8 @@ ptrarray_t backend_cached = PTRARRAY_INITIALIZER;

static int tls_init(int client_auth, struct buf *serverinfo);
static void starttls(struct http_connection *conn, int timeout);
void usage(void);
void shut_down(int code) __attribute__ ((noreturn));
void usage(void) __attribute__((noreturn));
void shut_down(int code) __attribute__((noreturn));

/* Enable the resetting of a sasl_conn_t */
static int reset_saslconn(sasl_conn_t **conn);
Expand Down
2 changes: 2 additions & 0 deletions imap/imapd.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@
/* generated headers are not necessarily in current directory */
#include "imap/imap_err.h"

#include "master/service.h"

#include "iostat.h"

extern int optind;
Expand Down
2 changes: 2 additions & 0 deletions imap/lmtpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
#include "imap/imap_err.h"
#include "imap/lmtp_err.h"

#include "master/service.h"

#include "lmtpd.h"
#include "lmtpengine.h"
#ifdef USE_SIEVE
Expand Down
2 changes: 2 additions & 0 deletions imap/mupdate.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
/* generated headers are not necessarily in current directory */
#include "imap/imap_err.h"

#include "master/service.h"

/* Sent to clients that we can't accept a connection for. */
static const char SERVER_UNABLE_STRING[] = "* BYE \"Server Unable\"\r\n";

Expand Down
2 changes: 2 additions & 0 deletions imap/nntpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@
#include "imap/imap_err.h"
#include "imap/nntp_err.h"

#include "master/service.h"

extern int optind;
extern char *optarg;
extern int opterr;
Expand Down
2 changes: 2 additions & 0 deletions imap/pop3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
/* generated headers are not necessarily in current directory */
#include "imap/imap_err.h"

#include "master/service.h"

#include "statuscache.h"

#include "iostat.h"
Expand Down
2 changes: 2 additions & 0 deletions imap/smmapd.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
/* generated headers are not necessarily in current directory */
#include "imap/imap_err.h"

#include "master/service.h"

static const char *BB;
static int forcedowncase;

Expand Down
2 changes: 2 additions & 0 deletions imap/sync_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
/* generated headers are not necessarily in current directory */
#include "imap/imap_err.h"

#include "master/service.h"

#include "message_guid.h"
#include "sync_support.h"
/*#include "cdb.h"*/
Expand Down
1 change: 1 addition & 0 deletions lib/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#ifndef INCLUDED_ASSERT_H
#define INCLUDED_ASSERT_H

__attribute__((noreturn))
void assertionfailed(const char *file, int line, const char *expr);

#define assert(expr) \
Expand Down
2 changes: 1 addition & 1 deletion master/service.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ enum {
extern int service_init(int argc, char **argv, char **envp);
extern int service_main(int argc, char **argv, char **envp);
extern int service_main_fd(int fd, int argc, char **argv, char **envp);
extern void service_abort(int error);
extern void service_abort(int error) __attribute__((noreturn));

enum {
MAX_USE = 250,
Expand Down
1 change: 1 addition & 0 deletions notifyd/notifyd.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
#include "xmalloc.h"
#include "strarray.h"

#include "master/service.h"

/* global state */
const int config_need_data = 0;
Expand Down
1 change: 1 addition & 0 deletions perl/sieve/lib/request.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@

#define BLOCKSIZE 1024

__attribute__((noreturn))
void parseerror(const char *str)
{
printf("Bad protocol from MANAGESIEVE server: %s\n", str);
Expand Down
2 changes: 2 additions & 0 deletions ptclient/ptloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
#include "xmalloc.h"
#include "ptloader.h"

#include "master/service.h"

struct pts_module *pts_modules[] = {
&pts_http,
#ifdef HAVE_LDAP
Expand Down
1 change: 1 addition & 0 deletions timsieved/timsieved.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
#include "imap/proxy.h"
#include "imap/sync_log.h"
#include "lib/assert.h"
#include "master/service.h"
#include "sieve/sieve_interface.h"
#include "timsieved/actions.h"
#include "timsieved/codes.h"
Expand Down

0 comments on commit 06cb964

Please sign in to comment.