This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix build warnings in regex.c, bug-regex20.c, bug-regex33.c


Hi,

The builds for regex.c, bug-regex20.c and bug-regex33.c give warnings
about some static functions being defined, but not used:

In file included from regex_internal.h:65:0,
                 from regex.c:63:
../locale/elem-hash.h:22:1: warning: âelem_hashâ defined but not used [-Wunused-function]

In file included from bug-regex20.c:29:0:
regex_internal.h:689:1: warning: âbitset_notâ defined but not used [-Wunused-function]
regex_internal.h:697:1: warning: âbitset_mergeâ defined but not used [-Wunused-function]
regex_internal.h:705:1: warning: âbitset_maskâ defined but not used [-Wunused-function]
regex_internal.h:716:1: warning: âre_string_char_size_atâ defined but not used [-Wunused-function]
regex_internal.h:729:1: warning: âre_string_wchar_atâ defined but not used [-Wunused-function]
In file included from bug-regex33.c:26:0:
regex_internal.h:689:1: warning: âbitset_notâ defined but not used [-Wunused-function]
regex_internal.h:697:1: warning: âbitset_mergeâ defined but not used [-Wunused-function]
regex_internal.h:705:1: warning: âbitset_maskâ defined but not used [-Wunused-function]
regex_internal.h:716:1: warning: âre_string_char_size_atâ defined but not used [-Wunused-function]
regex_internal.h:729:1: warning: âre_string_wchar_atâ defined but not used [-Wunused-function]

The patch below marks these functions as possibly unused since any
file that includes regex_internal.h may not necessarily use all of the
functions defined.  Built and regression tested on x86_64.  OK to
commit?

Siddhesh

	* locale/elem-hash.h (elem_hash): Mark as pure and possibly
	unused.
	* posix/regex_internal.h (bitset_not): Mark as possibly
	unused.
	(bitset_merge): Likewise.
	(bitset_mask): Likewise.
	(re_string_char_size_at): Likewise.
	(re_string_wchar_at): Likewise.
	(re_string_elem_size_at): Likewise.

diff --git a/locale/elem-hash.h b/locale/elem-hash.h
index a308f5d..e23e159 100644
--- a/locale/elem-hash.h
+++ b/locale/elem-hash.h
@@ -18,7 +18,7 @@
 
 
 /* The hashing function used for the table with collation symbols.  */
-static int32_t
+static int32_t __attribute ((pure, unused))
 elem_hash (const char *str, int_fast32_t n)
 {
   int32_t result = n;
diff --git a/posix/regex_internal.h b/posix/regex_internal.h
index b280663..4425d3b 100644
--- a/posix/regex_internal.h
+++ b/posix/regex_internal.h
@@ -686,7 +686,7 @@ typedef struct
 
 
 /* Inline functions for bitset operation.  */
-static void
+static void __attribute ((unused))
 bitset_not (bitset_t set)
 {
   int bitset_i;
@@ -694,7 +694,7 @@ bitset_not (bitset_t set)
     set[bitset_i] = ~set[bitset_i];
 }
 
-static void
+static void __attribute ((unused))
 bitset_merge (bitset_t dest, const bitset_t src)
 {
   int bitset_i;
@@ -702,7 +702,7 @@ bitset_merge (bitset_t dest, const bitset_t src)
     dest[bitset_i] |= src[bitset_i];
 }
 
-static void
+static void __attribute ((unused))
 bitset_mask (bitset_t dest, const bitset_t src)
 {
   int bitset_i;
@@ -713,7 +713,7 @@ bitset_mask (bitset_t dest, const bitset_t src)
 #ifdef RE_ENABLE_I18N
 /* Inline functions for re_string.  */
 static int
-internal_function __attribute ((pure))
+internal_function __attribute ((pure, unused))
 re_string_char_size_at (const re_string_t *pstr, int idx)
 {
   int byte_idx;
@@ -726,7 +726,7 @@ re_string_char_size_at (const re_string_t *pstr, int idx)
 }
 
 static wint_t
-internal_function __attribute ((pure))
+internal_function __attribute ((pure, unused))
 re_string_wchar_at (const re_string_t *pstr, int idx)
 {
   if (pstr->mb_cur_max == 1)
@@ -736,7 +736,7 @@ re_string_wchar_at (const re_string_t *pstr, int idx)
 
 # ifndef NOT_IN_libc
 static int
-internal_function __attribute ((pure))
+internal_function __attribute ((pure, unused))
 re_string_elem_size_at (const re_string_t *pstr, int idx)
 {
 #  ifdef _LIBC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]