From: Ralph Corderoy Date: Sat, 26 Aug 2017 16:36:31 +0000 (+0100) Subject: Add gcc's const function attribute. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/9ffabd06f0dc8e7478b7484fceee4906990d44e2?ds=inline Add gcc's const function attribute. --- diff --git a/h/mh.h b/h/mh.h index e9460db5..2a4ce617 100644 --- a/h/mh.h +++ b/h/mh.h @@ -37,12 +37,14 @@ typedef unsigned char boolean; /* not int so we can pack in a structure */ #define CHECK_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg))) #define ALLOC_SIZE(n) __attribute__((alloc_size(n))) #define ALLOC_SIZE2(m, n) __attribute__((alloc_size(m, n))) +#define CONST __attribute__((const)) #define NMH_UNUSED(i) (void) i #else #define NORETURN #define CHECK_PRINTF(fmt, arg) #define ALLOC_SIZE(n) #define ALLOC_SIZE2(m, n) +#define CONST #define NMH_UNUSED(i) i #endif diff --git a/h/mhparse.h b/h/mhparse.h index 256586f3..b96ce654 100644 --- a/h/mhparse.h +++ b/h/mhparse.h @@ -357,12 +357,12 @@ int get_ctinfo (char *, CT, int); int params_external (CT, int); int open7Bit (CT, char **); void close_encoding (CT); -char *ct_type_str (int); -char *ct_subtype_str (int, int); +char *ct_type_str (int) CONST; +char *ct_subtype_str (int, int) CONST; int ct_str_type (const char *); int ct_str_subtype (int, const char *); const struct str2init *get_ct_init (int); -const char *ce_str (int); +const char *ce_str (int) CONST; const struct str2init *get_ce_method (const char *); char *content_charset (CT); void reverse_alternative_parts (CT); diff --git a/h/prototypes.h b/h/prototypes.h index 7caa3d0f..29ca1ddf 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -70,7 +70,7 @@ void discard (FILE *); * * Returns the decoded value, -1 if the conversion failed. */ -int decode_qp(unsigned char byte1, unsigned char byte2); +int decode_qp(unsigned char byte1, unsigned char byte2) CONST; int default_done (int);