[v11,25/29] string: Hook up the default implementation on test-strncmp

Message ID 20230201170406.303978-26-adhemerval.zanella@linaro.org
State Superseded
Headers
Series Improve generic string routines |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Adhemerval Zanella Netto Feb. 1, 2023, 5:04 p.m. UTC
  ---
 string/test-strncmp.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
  

Comments

Richard Henderson Feb. 1, 2023, 5:56 p.m. UTC | #1
On 2/1/23 07:04, Adhemerval Zanella wrote:
> ---
>   string/test-strncmp.c | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~

> 
> diff --git a/string/test-strncmp.c b/string/test-strncmp.c
> index fb4c6420b8..35dc496eae 100644
> --- a/string/test-strncmp.c
> +++ b/string/test-strncmp.c
> @@ -90,6 +90,22 @@ typedef int (*proto_t) (const CHAR *, const CHAR *, size_t);
>   
>   IMPL (STRNCMP, 1)
>   
> +/* Also check the default implementation.  */
> +#undef STRNCMP
> +#undef libc_hidden_builtin_def
> +#define libc_hidden_builtin_def(a)
> +#undef attribute_hidden
> +#define attribute_hidden
> +#ifndef WIDE
> +# define STRNCMP __strncmp_default
> +# include "string/strncmp.c"
> +# define STRNCMP_DEFAULT STRNCMP
> +#else
> +# define WCSNCMP __wcsncmp_default
> +# include "wcsmbs/wcsncmp.c"
> +# define STRNCMP_DEFAULT WCSNCMP
> +#endif
> +IMPL (STRNCMP_DEFAULT, 1)
>   
>   static int
>   check_result (impl_t *impl, const CHAR *s1, const CHAR *s2, size_t n,
  

Patch

diff --git a/string/test-strncmp.c b/string/test-strncmp.c
index fb4c6420b8..35dc496eae 100644
--- a/string/test-strncmp.c
+++ b/string/test-strncmp.c
@@ -90,6 +90,22 @@  typedef int (*proto_t) (const CHAR *, const CHAR *, size_t);
 
 IMPL (STRNCMP, 1)
 
+/* Also check the default implementation.  */
+#undef STRNCMP
+#undef libc_hidden_builtin_def
+#define libc_hidden_builtin_def(a)
+#undef attribute_hidden
+#define attribute_hidden
+#ifndef WIDE
+# define STRNCMP __strncmp_default
+# include "string/strncmp.c"
+# define STRNCMP_DEFAULT STRNCMP
+#else
+# define WCSNCMP __wcsncmp_default
+# include "wcsmbs/wcsncmp.c"
+# define STRNCMP_DEFAULT WCSNCMP
+#endif
+IMPL (STRNCMP_DEFAULT, 1)
 
 static int
 check_result (impl_t *impl, const CHAR *s1, const CHAR *s2, size_t n,