bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

crc.h: declare each function with _GL_ATTRIBUTE_PURE


From: Jim Meyering
Subject: crc.h: declare each function with _GL_ATTRIBUTE_PURE
Date: Mon, 9 Sep 2024 09:02:14 +0200

gzip has the same tables/code as gnulib's crc module,
so while scoping out the gzip change (to use gnulib's crc), I hit this:

crc.c: In function 'crc32_update_no_xor':
crc.c:77:1: error: function might be candidate for attribute 'pure'
[-Werror=sugge
st-attribute=pure]
   77 | crc32_update_no_xor (uint32_t crc, const char *buf, size_t len)
      | ^~~~~~~~~~~~~~~~~~~
crc.c: In function 'crc32_no_xor':
crc.c:88:1: error: function might be candidate for attribute 'pure'
[-Werror=sugge
st-attribute=pure]
   88 | crc32_no_xor (const char *buf, size_t len)
      | ^~~~~~~~~~~~
crc.c: In function 'crc32_update':
crc.c:94:1: error: function might be candidate for attribute 'pure'
[-Werror=sugge
st-attribute=pure]
   94 | crc32_update (uint32_t crc, const char *buf, size_t len)
      | ^~~~~~~~~~~~
crc.c: In function 'crc32':
crc.c:100:1: error: function might be candidate for attribute 'pure'
[-Werror=sugg
est-attribute=pure]
  100 | crc32 (const char *buf, size_t len)
      | ^~~~~

I've pushed the obvious fix:

    crc.h: declare each function with _GL_ATTRIBUTE_PURE
    * lib/crc.h (crc32, crc32_update, crc32_no_xor)
    (crc32_update_no_xor): Declare with _GL_ATTRIBUTE_PURE.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]