From: Bruno Haible Date: Thu, 30 Nov 2023 07:24:18 +0000 (+0100) Subject: Fix clang -Wunused-function warnings. X-Git-Tag: v0.23~294 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=afd8c6f290b788aabacea6259ffe855681fb5d8c;p=thirdparty%2Fgettext.git Fix clang -Wunused-function warnings. * gettext-runtime/src/envsubst.c: Include attribute.h. (string_list_member, string_list_destroy): Mark as MAYBE_UNUSED. * gettext-tools/src/format-scheme.c: Include attribute.h. (II): Mark as MAYBE_UNUSED. * gettext-tools/src/msgl-fsearch.c: Include attribute.h. (add_index): Mark as MAYBE_UNUSED. * gettext-tools/src/po-lex.c: Include attribute.h. (mb_isnul, mb_cmp, mb_equal, mb_isascii, mb_putc, mb_setascii): Mark as MAYBE_UNUSED. * gettext-tools/src/write-qt.c: Include attribute.h. (write_u16): Mark as MAYBE_UNUSED. * gettext-tools/src/x-awk.c (free_token): Mark as MAYBE_UNUSED. * gettext-tools/src/x-python.c (phase0_ungetc): Mark as MAYBE_UNUSED. --- diff --git a/gettext-runtime/src/envsubst.c b/gettext-runtime/src/envsubst.c index 692a50992..de3589c56 100644 --- a/gettext-runtime/src/envsubst.c +++ b/gettext-runtime/src/envsubst.c @@ -28,6 +28,7 @@ #include #include +#include "attribute.h" #include "noreturn.h" #include "closeout.h" #include "error.h" @@ -358,7 +359,7 @@ string_list_sort (string_list_ty *slp) } /* Test whether a string list contains a given string. */ -static inline int +MAYBE_UNUSED static inline int string_list_member (const string_list_ty *slp, const char *s) { size_t j; @@ -402,7 +403,7 @@ sorted_string_list_member (const string_list_ty *slp, const char *s) } /* Destroy a list of strings. */ -static inline void +MAYBE_UNUSED static inline void string_list_destroy (string_list_ty *slp) { size_t j; diff --git a/gettext-tools/src/format-scheme.c b/gettext-tools/src/format-scheme.c index 2084fdb68..a8df14b90 100644 --- a/gettext-tools/src/format-scheme.c +++ b/gettext-tools/src/format-scheme.c @@ -22,6 +22,7 @@ #include #include +#include "attribute.h" #include "format.h" #include "c-ctype.h" #include "gcd.h" @@ -2321,7 +2322,7 @@ make_repeated_list (struct format_arg_list *sublist, unsigned int period) /* Possible signatures of format directives. */ static const enum format_arg_type I [1] = { FAT_INTEGER_NULL }; -_GL_ATTRIBUTE_MAYBE_UNUSED +MAYBE_UNUSED static const enum format_arg_type II [2] = { FAT_INTEGER_NULL, FAT_INTEGER_NULL }; diff --git a/gettext-tools/src/msgl-fsearch.c b/gettext-tools/src/msgl-fsearch.c index bd78a8600..08543514a 100644 --- a/gettext-tools/src/msgl-fsearch.c +++ b/gettext-tools/src/msgl-fsearch.c @@ -25,6 +25,7 @@ #include #include +#include "attribute.h" #include "xalloc.h" #include "po-charset.h" @@ -130,7 +131,7 @@ addlast_index (index_list_ty list, index_ty idx) /* Add a given index to an index list. Return the new index list, if it had to be reallocated, or NULL if it didn't change. */ -static inline index_list_ty +MAYBE_UNUSED static inline index_list_ty add_index (index_list_ty list, index_ty idx) { index_list_ty result; diff --git a/gettext-tools/src/po-lex.c b/gettext-tools/src/po-lex.c index e6420456f..278016d16 100644 --- a/gettext-tools/src/po-lex.c +++ b/gettext-tools/src/po-lex.c @@ -36,6 +36,7 @@ # include #endif +#include "attribute.h" #include "c-ctype.h" #include "uniwidth.h" #include "gettext.h" @@ -169,7 +170,7 @@ mb_iseq (const mbchar_t mbc, char sc) return (mbc->bytes == 1 && mbc->buf[0] == sc); } -static inline bool +MAYBE_UNUSED static inline bool mb_isnul (const mbchar_t mbc) { #if HAVE_ICONV @@ -180,7 +181,7 @@ mb_isnul (const mbchar_t mbc) return (mbc->bytes == 1 && mbc->buf[0] == 0); } -static inline int +MAYBE_UNUSED static inline int mb_cmp (const mbchar_t mbc1, const mbchar_t mbc2) { #if HAVE_ICONV @@ -195,7 +196,7 @@ mb_cmp (const mbchar_t mbc1, const mbchar_t mbc2) : (memcmp (mbc1->buf, mbc2->buf, mbc2->bytes) >= 0 ? 1 : -1)); } -static inline bool +MAYBE_UNUSED static inline bool mb_equal (const mbchar_t mbc1, const mbchar_t mbc2) { #if HAVE_ICONV @@ -209,7 +210,7 @@ mb_equal (const mbchar_t mbc1, const mbchar_t mbc2) /* , classification. */ -static inline bool +MAYBE_UNUSED static inline bool mb_isascii (const mbchar_t mbc) { #if HAVE_ICONV @@ -279,14 +280,14 @@ mb_width (struct po_parser_state *ps, const mbchar_t mbc) } /* Output. */ -static inline void +MAYBE_UNUSED static inline void mb_putc (const mbchar_t mbc, FILE *stream) { fwrite (mbc->buf, 1, mbc->bytes, stream); } /* Assignment. */ -static inline void +MAYBE_UNUSED static inline void mb_setascii (mbchar_t mbc, char sc) { mbc->bytes = 1; diff --git a/gettext-tools/src/write-qt.c b/gettext-tools/src/write-qt.c index e7e054c68..73dea734a 100644 --- a/gettext-tools/src/write-qt.c +++ b/gettext-tools/src/write-qt.c @@ -1,5 +1,5 @@ /* Writing Qt .qm files. - Copyright (C) 2003, 2005-2007, 2009, 2016, 2020 Free Software Foundation, Inc. + Copyright (C) 2003, 2005-2007, 2009, 2016, 2020, 2023 Free Software Foundation, Inc. Written by Bruno Haible , 2003. This program is free software: you can redistribute it and/or modify @@ -29,6 +29,7 @@ #include #include +#include "attribute.h" #include "error.h" #include "xerror.h" #include "message.h" @@ -189,7 +190,7 @@ write_u8 (FILE *output_file, unsigned char value) } /* Write a u16 (two bytes) to the output stream. */ -static inline void +MAYBE_UNUSED static inline void write_u16 (FILE *output_file, unsigned short value) { unsigned char data[2]; diff --git a/gettext-tools/src/x-awk.c b/gettext-tools/src/x-awk.c index 50643c6e1..ef21967f6 100644 --- a/gettext-tools/src/x-awk.c +++ b/gettext-tools/src/x-awk.c @@ -345,7 +345,7 @@ phase7_getc () /* Free the memory pointed to by a 'struct token_ty'. */ -static inline void +MAYBE_UNUSED static inline void free_token (token_ty *tp) { switch (tp->type) diff --git a/gettext-tools/src/x-python.c b/gettext-tools/src/x-python.c index 38f6f82a5..b5edb1ab7 100644 --- a/gettext-tools/src/x-python.c +++ b/gettext-tools/src/x-python.c @@ -197,7 +197,7 @@ phase0_getc () } /* Supports only one pushback character, and not '\n'. */ -static inline void +MAYBE_UNUSED static inline void phase0_ungetc (int c) { if (c != EOF)