2018-08-09 Niels Möller <nisse@lysator.liu.se>
+ * nettle-types.h (_NETTLE_ATTRIBUTE_PURE): Define
+ _NETTLE_ATTRIBUTE_PURE for gcc and lookalikes.
+ * ecc-curve.h: Include nettle-types.h, and use
+ _NETTLE_ATTRIBUTE_PURE instead of local definition.
+ * nettle-meta.h: Use _NETTLE_ATTRIBUTE_PURE, instead of explicit
+ #ifdefs.
+
* nettle-internal.c (des_set_key_wrapper, des3_set_key_wrapper)
(blowfish128_set_key_wrapper): Wrapper functions, to avoid cast
between incompatible function types (which gcc-8 warns about).
#ifndef NETTLE_ECC_CURVE_H_INCLUDED
#define NETTLE_ECC_CURVE_H_INCLUDED
+#include "nettle-types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
/* The contents of this struct is internal. */
struct ecc_curve;
-#ifdef __GNUC__
-#define NETTLE_PURE __attribute__((pure))
-#else
-#define NETTLE_PURE
-#endif
-
-const struct ecc_curve * NETTLE_PURE nettle_get_secp_192r1(void);
-const struct ecc_curve * NETTLE_PURE nettle_get_secp_224r1(void);
-const struct ecc_curve * NETTLE_PURE nettle_get_secp_256r1(void);
-const struct ecc_curve * NETTLE_PURE nettle_get_secp_384r1(void);
-const struct ecc_curve * NETTLE_PURE nettle_get_secp_521r1(void);
-
-#undef NETTLE_PURE
+const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_secp_192r1(void);
+const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_secp_224r1(void);
+const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_secp_256r1(void);
+const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_secp_384r1(void);
+const struct ecc_curve * _NETTLE_ATTRIBUTE_PURE nettle_get_secp_521r1(void);
#ifdef __cplusplus
}
};
/* null-terminated list of ciphers implemented by this version of nettle */
-const struct nettle_cipher * const *
-#ifdef __GNUC__
-__attribute__((pure))
-#endif
+const struct nettle_cipher * const * _NETTLE_ATTRIBUTE_PURE
nettle_get_ciphers (void);
#define nettle_ciphers (nettle_get_ciphers())
}
/* null-terminated list of digests implemented by this version of nettle */
-const struct nettle_hash * const *
-#ifdef __GNUC__
-__attribute__((pure))
-#endif
+const struct nettle_hash * const * _NETTLE_ATTRIBUTE_PURE
nettle_get_hashes (void);
#define nettle_hashes (nettle_get_hashes())
/* null-terminated list of aead constructions implemented by this
version of nettle */
-const struct nettle_aead * const *
-#ifdef __GNUC__
-__attribute__((pure))
-#endif
+const struct nettle_aead * const * _NETTLE_ATTRIBUTE_PURE
nettle_get_aeads (void);
#define nettle_aeads (nettle_get_aeads())
}
/* null-terminated list of armor schemes implemented by this version of nettle */
-const struct nettle_armor * const *
-#ifdef __GNUC__
-__attribute__((pure))
-#endif
+const struct nettle_armor * const * _NETTLE_ATTRIBUTE_PURE
nettle_get_armors (void);
#define nettle_armors (nettle_get_armors())
#define _STDINT_HAVE_INT_FAST32_T 1
#include "nettle-stdint.h"
+/* Attributes we want to use in installed header files, and hence
+ can't rely on config.h. */
+#ifdef __GNUC__
+#define _NETTLE_ATTRIBUTE_PURE __attribute__((pure))
+#else /* !__GNUC__ */
+#define _NETTLE_ATTRIBUTE_PURE
+#endif /* !__GNUC__ */
#ifdef __cplusplus
extern "C" {
#endif