]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
New macro _NETTLE_ATTRIBUTE_PURE.
authorNiels Möller <nisse@lysator.liu.se>
Thu, 9 Aug 2018 19:09:11 +0000 (21:09 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Thu, 9 Aug 2018 19:25:27 +0000 (21:25 +0200)
ChangeLog
ecc-curve.h
nettle-meta.h
nettle-types.h

index c37eff0cb9a3b365bf85fca5e23903721ad4be46..16895dff3da8faf6671fd546f890dcb81cae4af3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 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).
index 8af75fddb37cb8b09a531dc394ba7a289802d3a2..76024a19d24fc4048bae77a03f0bfe06927f7fd9 100644 (file)
@@ -34,6 +34,8 @@
 #ifndef NETTLE_ECC_CURVE_H_INCLUDED
 #define NETTLE_ECC_CURVE_H_INCLUDED
 
+#include "nettle-types.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -41,19 +43,11 @@ extern "C" {
 /* 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
 }
index 8fe1cf84651b91afdbb2d2d409f7f294cc5f8da1..74e50e59cd2ecef0f412504ebd97e0b75b8be821 100644 (file)
@@ -61,10 +61,7 @@ struct nettle_cipher
 };
 
 /* 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())
@@ -121,10 +118,7 @@ struct nettle_hash
 } 
 
 /* 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())
@@ -172,10 +166,7 @@ struct nettle_aead
 
 /* 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())
@@ -238,10 +229,7 @@ struct nettle_armor
 }
 
 /* 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())
index f04655d6582988d3eecaeb5f56a44e9bafa27806..63eae4218bc8608cb92c30e642ef7db0c8aa3f9a 100644 (file)
 #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