From 2fcadc1dcdd70a5f87725857976cc9a01efa3e25 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Mon, 28 Mar 2022 15:22:13 +0100 Subject: Compiler quietening --- src/src/hintsdb.h | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/src/mytypes.h | 2 ++ 2 files changed, 81 insertions(+) diff --git a/src/src/hintsdb.h b/src/src/hintsdb.h index de3e6e4aa..9c2082b76 100644 --- a/src/src/hintsdb.h +++ b/src/src/hintsdb.h @@ -45,6 +45,7 @@ tdb_traverse to be called) */ /* Access functions */ /* EXIM_DBOPEN - return pointer to an EXIM_DB, NULL if failed */ +FUNC_MAYBE_UNUSED static EXIM_DB * exim_dbopen__(const uschar * name, const uschar * dirname, int flags, unsigned mode) @@ -53,6 +54,7 @@ return tdb_open(CS name, 0, TDB_DEFAULT, flags, mode); } /* EXIM_DBGET - returns TRUE if successful, FALSE otherwise */ +FUNC_MAYBE_UNUSED static BOOL exim_dbget(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * res) { @@ -61,11 +63,13 @@ return res->dptr != NULL; } /* EXIM_DBPUT - returns nothing useful, assumes replace mode */ +FUNC_MAYBE_UNUSED static int exim_dbput(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * data) { return tdb_store(dbp, *key, *data, TDB_REPLACE); } /* EXIM_DBPUTB - non-overwriting for use by dbmbuild */ +FUNC_MAYBE_UNUSED static int exim_dbputb(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * data) { return tdb_store(dbp, *key, *data, TDB_INSERT); } @@ -76,11 +80,13 @@ exim_dbputb(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * data) # define EXIM_DBPUTB_DUP (-1) /* EXIM_DBDEL */ +FUNC_MAYBE_UNUSED static int exim_dbdel(EXIM_DB * dbp, EXIM_DATUM * key) { return tdb_delete(dbp, *key); } /* EXIM_DBCREATE_CURSOR - initialize for scanning operation */ +FUNC_MAYBE_UNUSED static EXIM_CURSOR * exim_dbcreate_cursor(EXIM_DB * dbp) { @@ -92,6 +98,7 @@ return c; /* EXIM_DBSCAN - This is complicated because we have to free the last datum free() must not die when passed NULL */ +FUNC_MAYBE_UNUSED static BOOL exim_dbscan(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * res, BOOL first, EXIM_CURSOR * cursor) @@ -103,39 +110,47 @@ return key->dptr != NULL; } /* EXIM_DBDELETE_CURSOR - terminate scanning operation. */ +FUNC_MAYBE_UNUSED static void exim_dbdelete_cursor(EXIM_CURSOR * cursor) { store_free(cursor); } /* EXIM_DBCLOSE */ +FUNC_MAYBE_UNUSED static void exim_dbclose__(EXIM_DB * db) { tdb_close(db); } /* Datum access */ +FUNC_MAYBE_UNUSED static uschar * exim_datum_data_get(EXIM_DATUM * dp) { return US dp->dptr; } +FUNC_MAYBE_UNUSED static void exim_datum_data_set(EXIM_DATUM * dp, void * s) { dp->dptr = s; } +FUNC_MAYBE_UNUSED static unsigned exim_datum_size_get(EXIM_DATUM * dp) { return dp->dsize; } +FUNC_MAYBE_UNUSED static void exim_datum_size_set(EXIM_DATUM * dp, unsigned n) { dp->dsize = n; } /* No initialization is needed. */ +FUNC_MAYBE_UNUSED static void exim_datum_init(EXIM_DATUM * d) { } /* Free the stuff inside the datum. */ +FUNC_MAYBE_UNUSED static void exim_datum_free(EXIM_DATUM * d) { @@ -215,6 +230,7 @@ specified working dir, to avoid the DBCONFIG file trap. */ # define ENV_TO_DB(env) ((DB *)(((EXIM_DB *)env)->app_private)) +FUNC_MAYBE_UNUSED static EXIM_DB * exim_dbopen__(const uschar * name, const uschar * dirname, int flags, unsigned mode) @@ -243,6 +259,7 @@ return NULL; } /* EXIM_DBGET - returns TRUE if successful, FALSE otherwise */ +FUNC_MAYBE_UNUSED static BOOL exim_dbget(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * res) { @@ -251,6 +268,7 @@ return b->get(b, NULL, key, res, 0) == 0; } /* EXIM_DBPUT - returns nothing useful, assumes replace mode */ +FUNC_MAYBE_UNUSED static int exim_dbput(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * data) { @@ -259,6 +277,7 @@ return b->put(b, NULL, key, data, 0); } /* EXIM_DBPUTB - non-overwriting for use by dbmbuild */ +FUNC_MAYBE_UNUSED static int exim_dbputb(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * data) { @@ -272,6 +291,7 @@ return b->put(b, NULL, key, data, DB_NOOVERWRITE); # define EXIM_DBPUTB_DUP DB_KEYEXIST /* EXIM_DBDEL */ +FUNC_MAYBE_UNUSED static int exim_dbdel(EXIM_DB * dbp, EXIM_DATUM * key) { @@ -281,6 +301,7 @@ return b->del(b, NULL, key, 0); /* EXIM_DBCREATE_CURSOR - initialize for scanning operation */ +FUNC_MAYBE_UNUSED static EXIM_CURSOR * exim_dbcreate_cursor(EXIM_DB * dbp) { @@ -291,6 +312,7 @@ return c; } /* EXIM_DBSCAN - returns TRUE if data is returned, FALSE at end */ +FUNC_MAYBE_UNUSED static BOOL exim_dbscan(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * data, BOOL first, EXIM_CURSOR * cursor) @@ -299,11 +321,13 @@ return cursor->c_get(cursor, key, data, first ? DB_FIRST : DB_NEXT) == 0; } /* EXIM_DBDELETE_CURSOR - terminate scanning operation */ +FUNC_MAYBE_UNUSED static void exim_dbdelete_cursor(EXIM_CURSOR * cursor) { cursor->c_close(cursor); } /* EXIM_DBCLOSE */ +FUNC_MAYBE_UNUSED static void exim_dbclose__(EXIM_DB * dbp_o) { @@ -315,16 +339,20 @@ dbp->close(dbp, DB_FORCESYNC); /* Datum access */ +FUNC_MAYBE_UNUSED static uschar * exim_datum_data_get(EXIM_DATUM * dp) { return dp->data; } +FUNC_MAYBE_UNUSED static void exim_datum_data_set(EXIM_DATUM * dp, void * s) { dp->data = s; } +FUNC_MAYBE_UNUSED static unsigned exim_datum_size_get(EXIM_DATUM * dp) { return dp->size; } +FUNC_MAYBE_UNUSED static void exim_datum_size_set(EXIM_DATUM * dp, unsigned n) { dp->size = n; } @@ -332,10 +360,12 @@ exim_datum_size_set(EXIM_DATUM * dp, unsigned n) /* The whole datum structure contains other fields that must be cleared before use, but we don't have to free anything after reading data. */ +FUNC_MAYBE_UNUSED static void exim_datum_init(EXIM_DATUM * d) { memset(d, 0, sizeof(*d)); } +FUNC_MAYBE_UNUSED static void exim_datum_free(EXIM_DATUM * d) { } @@ -356,6 +386,7 @@ exim_datum_free(EXIM_DATUM * d) /* Access functions */ /* EXIM_DBOPEN - return pointer to an EXIM_DB, NULL if failed */ +FUNC_MAYBE_UNUSED static EXIM_DB * exim_dbopen__(const uschar * name, const uschar * dirname, int flags, unsigned mode) @@ -372,16 +403,19 @@ return db_create(&dbp, NULL, 0) == 0 } /* EXIM_DBGET - returns TRUE if successful, FALSE otherwise */ +FUNC_MAYBE_UNUSED static BOOL exim_dbget(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * res) { return dbp->get(dbp, NULL, key, res, 0) == 0; } /* EXIM_DBPUT - returns nothing useful, assumes replace mode */ +FUNC_MAYBE_UNUSED static int exim_dbput(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * data) { return dbp->put(dbp, NULL, key, data, 0); } /* EXIM_DBPUTB - non-overwriting for use by dbmbuild */ +FUNC_MAYBE_UNUSED static int exim_dbputb(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * data) { return dbp->put(dbp, NULL, key, data, DB_NOOVERWRITE); } @@ -392,12 +426,14 @@ exim_dbputb(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * data) # define EXIM_DBPUTB_DUP DB_KEYEXIST /* EXIM_DBDEL */ +FUNC_MAYBE_UNUSED static int exim_dbdel(EXIM_DB * dbp, EXIM_DATUM * key) { return dbp->del(dbp, NULL, key, 0); } /* EXIM_DBCREATE_CURSOR - initialize for scanning operation */ +FUNC_MAYBE_UNUSED static EXIM_CURSOR * exim_dbcreate_cursor(EXIM_DB * dbp) { @@ -407,6 +443,7 @@ return c; } /* EXIM_DBSCAN - returns TRUE if data is returned, FALSE at end */ +FUNC_MAYBE_UNUSED static BOOL exim_dbscan(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * data, BOOL first, EXIM_CURSOR * cursor) @@ -415,27 +452,33 @@ return cursor->c_get(cursor, key, data, first ? DB_FIRST : DB_NEXT) == 0; } /* EXIM_DBDELETE_CURSOR - terminate scanning operation */ +FUNC_MAYBE_UNUSED static void exim_dbdelete_cursor(EXIM_CURSOR * cursor) { cursor->c_close(cursor); } /* EXIM_DBCLOSE */ +FUNC_MAYBE_UNUSED static void exim_dbclose__(EXIM_DB * dbp) { dbp->close(dbp, 0); } /* Datum access */ +FUNC_MAYBE_UNUSED static uschar * exim_datum_data_get(EXIM_DATUM * dp) { return US dp->dptr; } +FUNC_MAYBE_UNUSED static void exim_datum_data_set(EXIM_DATUM * dp, void * s) { dp->dptr = s; } +FUNC_MAYBE_UNUSED static uschar * exim_datum_size_get(EXIM_DATUM * dp) { return US dp->size; } +FUNC_MAYBE_UNUSED static void exim_datum_size_set(EXIM_DATUM * dp, uschar * s) { dp->size = CS s; } @@ -443,10 +486,12 @@ exim_datum_size_set(EXIM_DATUM * dp, uschar * s) /* The whole datum structure contains other fields that must be cleared before use, but we don't have to free anything after reading data. */ +FUNC_MAYBE_UNUSED static void exim_datum_init(EXIM_DATUM * d) { memset(d, 0, sizeof(*d)); } +FUNC_MAYBE_UNUSED static void exim_datum_free(EXIM_DATUM * d) { } @@ -498,6 +543,7 @@ typedef struct { /* Access functions */ /* EXIM_DBOPEN - return pointer to an EXIM_DB, NULL if failed */ +FUNC_MAYBE_UNUSED static EXIM_DB * exim_dbopen__(const uschar * name, const uschar * dirname, int flags, unsigned mode) @@ -518,6 +564,7 @@ return NULL; } /* EXIM_DBGET - returns TRUE if successful, FALSE otherwise */ +FUNC_MAYBE_UNUSED static BOOL exim_dbget(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * res) { @@ -526,11 +573,13 @@ return res->dptr != NULL; } /* EXIM_DBPUT - returns nothing useful, assumes replace mode */ +FUNC_MAYBE_UNUSED static int exim_dbput(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * data) { return gdbm_store(dbp->gdbm, *key, *data, GDBM_REPLACE); } /* EXIM_DBPUTB - non-overwriting for use by dbmbuild */ +FUNC_MAYBE_UNUSED static int exim_dbputb(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * data) { return gdbm_store(dbp->gdbm, *key, *data, GDBM_INSERT); } @@ -541,16 +590,19 @@ exim_dbputb(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * data) # define EXIM_DBPUTB_DUP 1 /* EXIM_DBDEL */ +FUNC_MAYBE_UNUSED static int exim_dbdel(EXIM_DB * dbp, EXIM_DATUM * key) { return gdbm_delete(dbp->gdbm, *key); } /* EXIM_DBCREATE_CURSOR - initialize for scanning operation (null) */ +FUNC_MAYBE_UNUSED static EXIM_CURSOR * exim_dbcreate_cursor(EXIM_DB * dbp) { return NULL; } /* EXIM_DBSCAN */ +FUNC_MAYBE_UNUSED static BOOL exim_dbscan(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * data, BOOL first, EXIM_CURSOR * cursor) @@ -563,11 +615,13 @@ return key->dptr != NULL; } /* EXIM_DBDELETE_CURSOR - terminate scanning operation (null). */ +FUNC_MAYBE_UNUSED static void exim_dbdelete_cursor(EXIM_CURSOR * cursor) { } /* EXIM_DBCLOSE */ +FUNC_MAYBE_UNUSED static void exim_dbclose__(EXIM_DB * dbp) { @@ -579,16 +633,20 @@ free(dbp); /* Datum access types */ +FUNC_MAYBE_UNUSED static uschar * exim_datum_data_get(EXIM_DATUM * dp) { return US dp->dptr; } +FUNC_MAYBE_UNUSED static void exim_datum_data_set(EXIM_DATUM * dp, void * s) { dp->dptr = s; } +FUNC_MAYBE_UNUSED static unsigned exim_datum_size_get(EXIM_DATUM * dp) { return dp->dsize; } +FUNC_MAYBE_UNUSED static void exim_datum_size_set(EXIM_DATUM * dp, unsigned n) { dp->dsize = n; } @@ -596,10 +654,12 @@ exim_datum_size_set(EXIM_DATUM * dp, unsigned n) /* There's no clearing required before use, but we have to free the dptr after reading data. */ +FUNC_MAYBE_UNUSED static void exim_datum_init(EXIM_DATUM * d) { } +FUNC_MAYBE_UNUSED static void exim_datum_free(EXIM_DATUM * d) { free(d->dptr); } @@ -643,6 +703,7 @@ interface */ a directory name; otherwise we would create the name.pag and name.dir files in the directory's parent. */ +FUNC_MAYBE_UNUSED static EXIM_DB * exim_dbopen__(const uschar * name, const uschar * dirname, int flags, unsigned mode) @@ -658,6 +719,7 @@ return NULL; } /* EXIM_DBGET - returns TRUE if successful, FALSE otherwise */ +FUNC_MAYBE_UNUSED static BOOL exim_dbget(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * res) { @@ -666,11 +728,13 @@ return res->dptr != NULL; } /* EXIM_DBPUT - returns nothing useful, assumes replace mode */ +FUNC_MAYBE_UNUSED static int exim_dbput(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * data) { return dbm_store(dbp, *key, *data, DBM_REPLACE); } /* EXIM_DBPUTB - non-overwriting for use by dbmbuild */ +FUNC_MAYBE_UNUSED static int exim_dbputb(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * data) { return dbm_store(dbp, *key, *data, DBM_INSERT); } @@ -681,16 +745,19 @@ exim_dbputb(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * data) # define EXIM_DBPUTB_DUP 1 /* EXIM_DBDEL */ +FUNC_MAYBE_UNUSED static int exim_dbdel(EXIM_DB * dbp, EXIM_DATUM * key) { return dbm_delete(dbp, *key); } /* EXIM_DBCREATE_CURSOR - initialize for scanning operation (null) */ +FUNC_MAYBE_UNUSED static EXIM_CURSOR * exim_dbcreate_cursor(EXIM_DB * dbp) { return NULL; } /* EXIM_DBSCAN */ +FUNC_MAYBE_UNUSED static BOOL exim_dbscan(EXIM_DB * dbp, EXIM_DATUM * key, EXIM_DATUM * data, BOOL first, EXIM_CURSOR * cursor) @@ -700,27 +767,33 @@ return key->dptr != NULL; } /* EXIM_DBDELETE_CURSOR - terminate scanning operation (null). */ +FUNC_MAYBE_UNUSED static void exim_dbdelete_cursor(EXIM_CURSOR * cursor) { } /* EXIM_DBCLOSE */ +FUNC_MAYBE_UNUSED static void exim_dbclose__(EXIM_DB * dbp) { dbm_close(dbp); } /* Datum access types */ +FUNC_MAYBE_UNUSED static uschar * exim_datum_data_get(EXIM_DATUM * dp) { return US dp->dptr; } +FUNC_MAYBE_UNUSED static void exim_datum_data_set(EXIM_DATUM * dp, void * s) { dp->dptr = s; } +FUNC_MAYBE_UNUSED static unsigned exim_datum_size_get(EXIM_DATUM * dp) { return dp->dsize; } +FUNC_MAYBE_UNUSED static void exim_datum_size_set(EXIM_DATUM * dp, unsigned n) { dp->dsize = n; } @@ -728,10 +801,12 @@ exim_datum_size_set(EXIM_DATUM * dp, unsigned n) /* There's no clearing required before use, and we don't have to free anything after reading data. */ +FUNC_MAYBE_UNUSED static void exim_datum_init(EXIM_DATUM * d) { } +FUNC_MAYBE_UNUSED static void exim_datum_free(EXIM_DATUM * d) { } @@ -748,6 +823,7 @@ exim_datum_free(EXIM_DATUM * d) #if defined(COMPILE_UTILITY) || defined(MACRO_PREDEF) +FUNC_MAYBE_UNUSED static EXIM_DB * exim_dbopen(const uschar * name, const uschar * dirname, int flags, unsigned mode) @@ -755,6 +831,7 @@ exim_dbopen(const uschar * name, const uschar * dirname, int flags, return exim_dbopen__(name, dirname, flags, mode); } +FUNC_MAYBE_UNUSED static void exim_dbclose(EXIM_DB * dbp) { exim_dbclose__(dbp); } @@ -765,6 +842,7 @@ exim_dbclose(EXIM_DB * dbp) extern void debug_printf_indent(const char *, ...); static BOOL is_tainted(const void *); +FUNC_MAYBE_UNUSED static EXIM_DB * exim_dbopen(const uschar * name, const uschar * dirname, int flags, unsigned mode) @@ -789,6 +867,7 @@ DEBUG(D_hints_lookup) debug_printf_indent("returned from EXIM_DBOPEN: %p\n", dbp return dbp; } +FUNC_MAYBE_UNUSED static void exim_dbclose(EXIM_DB * dbp) { diff --git a/src/src/mytypes.h b/src/src/mytypes.h index c51c870c2..8ccc679bb 100644 --- a/src/src/mytypes.h +++ b/src/src/mytypes.h @@ -39,12 +39,14 @@ so we have to give up on all of the available parameter checking. */ # define PRINTF_FUNCTION(A,B) __attribute__((format(printf,A,B))) # endif # define ARG_UNUSED __attribute__((__unused__)) +# define FUNC_MAYBE_UNUSED __attribute__((__unused__)) # define WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) # define ALLOC __attribute__((malloc)) # define ALLOC_SIZE(A) __attribute__((alloc_size(A))) # define NORETURN __attribute__((noreturn)) #else # define ARG_UNUSED /**/ +# define FUNC_MAYBE_UNUSED /**/ # define WARN_UNUSED_RESULT /**/ # define ALLOC /**/ # define ALLOC_SIZE(A) /**/ -- cgit v1.2.3