diff options
author | Colin Watson <cjwatson@debian.org> | 2022-01-01 03:09:42 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2022-01-01 03:09:42 +0000 |
commit | ccee650184015b21c343dc7c0316e6439ce7751b (patch) | |
tree | a84b1cd31c3f9bd2480d5b3bef6ed235dc7b6937 /lib | |
parent | c4d20840f3487588c4a0da4397b1acb6dc83a1e5 (diff) |
Use Gnulib attribute.h properly
manconfig.h previously used _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM without
first including "stdio.h", which caused build failures. We should be
using the public names anyway.
* bootstrap.conf (gnulib_modules): Add attribute.
* include/manconfig.h.in (create_tempdir, appendstr): Use NODISCARD
rather than _GL_ATTRIBUTE_NODISCARD.
* include/manconfig.h.in (debug, debug_error): Use ATTRIBUTE_FORMAT
rather than _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM.
* lib/debug.c (vdebug): Likewise.
* include/manconfig.h.in (appendstr): Use ATTRIBUTE_SENTINEL rather than
_GL_ATTRIBUTE_SENTINEL.
* lib/encodings.c (get_page_encoding): Use ATTRIBUTE_MALLOC rather than
_GL_ATTRIBUTE_MALLOC.
* lib/util.c (trim_spaces): Likewise.
* lib/encodings.c (is_roff_device, get_output_encoding,
get_less_charset, get_jless_charset): Use ATTRIBUTE_PURE rather than
_GL_ATTRIBUTE_PURE.
* lib/glcontainers.c (string_equals, string_hash): Likewise.
* lib/security.c (running_setuid): Likewise.
* src/manp.c (canonicalized_path_equals, canonicalized_path_hash):
Likewise.
* src/whatis.c (match): Likewise.
* libdb/db_lookup.c (dash_if_unset): Use ATTRIBUTE_CONST rather than
_GL_ATTRIBUTE_CONST.
* libdb/db_store.c (compare_ids): Likewise.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/debug.c | 6 | ||||
-rw-r--r-- | lib/encodings.c | 13 | ||||
-rw-r--r-- | lib/glcontainers.c | 5 | ||||
-rw-r--r-- | lib/security.c | 3 | ||||
-rw-r--r-- | lib/util.c | 3 |
5 files changed, 17 insertions, 13 deletions
diff --git a/lib/debug.c b/lib/debug.c index 9e2c9c70..827c86db 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -30,6 +30,8 @@ #include <string.h> #include <errno.h> +#include "attribute.h" + #include "manconfig.h" bool debug_level = false; @@ -41,8 +43,8 @@ void init_debug (void) debug_level = true; } -static void _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0) vdebug - (const char *message, va_list args) +static void ATTRIBUTE_FORMAT ((__printf__, 1, 0)) vdebug (const char *message, + va_list args) { if (debug_level) vfprintf (stderr, message, args); diff --git a/lib/encodings.c b/lib/encodings.c index e8ad3381..cb09f7b7 100644 --- a/lib/encodings.c +++ b/lib/encodings.c @@ -31,6 +31,7 @@ #include <unistd.h> #include <assert.h> +#include "attribute.h" #include "gettext.h" #include "localcharset.h" #include <locale.h> @@ -409,7 +410,7 @@ const char *get_groff_preconv (void) * * The caller should free the returned string when it is finished with it. */ -char * _GL_ATTRIBUTE_MALLOC get_page_encoding (const char *lang) +char * ATTRIBUTE_MALLOC get_page_encoding (const char *lang) { const struct directory_entry *entry; const char *dot; @@ -724,7 +725,7 @@ const char *get_default_device (const char *charset_from_locale, } /* Is this a known *roff device name? */ -bool _GL_ATTRIBUTE_PURE is_roff_device (const char *device) +bool ATTRIBUTE_PURE is_roff_device (const char *device) { const struct device_entry *entry; @@ -784,7 +785,7 @@ const char *get_roff_encoding (const char *device, const char *source_encoding) /* Find the output encoding that this device will produce, or NULL if it * will simply pass through the input encoding. */ -const char * _GL_ATTRIBUTE_PURE get_output_encoding (const char *device) +const char * ATTRIBUTE_PURE get_output_encoding (const char *device) { const struct device_entry *entry; @@ -796,8 +797,7 @@ const char * _GL_ATTRIBUTE_PURE get_output_encoding (const char *device) } /* Return the value of LESSCHARSET appropriate for this locale. */ -const char * _GL_ATTRIBUTE_PURE get_less_charset ( - const char *charset_from_locale) +const char * ATTRIBUTE_PURE get_less_charset (const char *charset_from_locale) { const struct less_charset_entry *entry; @@ -815,8 +815,7 @@ const char * _GL_ATTRIBUTE_PURE get_less_charset ( /* Return the value of JLESSCHARSET appropriate for this locale. May return * NULL. */ -const char * _GL_ATTRIBUTE_PURE get_jless_charset ( - const char *charset_from_locale) +const char * ATTRIBUTE_PURE get_jless_charset (const char *charset_from_locale) { const struct less_charset_entry *entry; diff --git a/lib/glcontainers.c b/lib/glcontainers.c index cbd635cf..4cbe4bae 100644 --- a/lib/glcontainers.c +++ b/lib/glcontainers.c @@ -28,6 +28,7 @@ #include <stdlib.h> #include <string.h> +#include "attribute.h" #include "gl_xlist.h" #include "gl_xmap.h" #include "gl_xset.h" @@ -37,12 +38,12 @@ #include "glcontainers.h" -bool _GL_ATTRIBUTE_PURE string_equals (const void *s1, const void *s2) +bool ATTRIBUTE_PURE string_equals (const void *s1, const void *s2) { return STREQ ((const char *) s1, (const char *) s2); } -size_t _GL_ATTRIBUTE_PURE string_hash (const void *s) +size_t ATTRIBUTE_PURE string_hash (const void *s) { return hash_pjw_bare (s, strlen ((const char *) s)); } diff --git a/lib/security.c b/lib/security.c index cf14e350..dd37af12 100644 --- a/lib/security.c +++ b/lib/security.c @@ -35,6 +35,7 @@ #include <errno.h> #include <sys/types.h> +#include "attribute.h" #include "gettext.h" #define _(String) gettext (String) @@ -95,7 +96,7 @@ void init_security (void) #endif /* MAN_OWNER */ } -bool _GL_ATTRIBUTE_PURE running_setuid (void) +bool ATTRIBUTE_PURE running_setuid (void) { #ifdef MAN_OWNER return ruid != euid; @@ -44,6 +44,7 @@ #include <unistd.h> #include <locale.h> +#include "attribute.h" #include "stat-time.h" #include "timespec.h" #include "xvasprintf.h" @@ -193,7 +194,7 @@ int remove_directory (const char *directory, int recurse) /* Returns an allocated copy of s, with leading and trailing spaces * removed. */ -char * _GL_ATTRIBUTE_MALLOC trim_spaces (const char *s) +char * ATTRIBUTE_MALLOC trim_spaces (const char *s) { int length; while (*s == ' ') |