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

Message ID 20230201170406.303978-25-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 Feb. 1, 2023, 5:04 p.m. UTC
  ---
 string/test-strcmp.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
  

Comments

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

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


r~

> 
> diff --git a/string/test-strcmp.c b/string/test-strcmp.c
> index ceb0d29c74..fa3161688c 100644
> --- a/string/test-strcmp.c
> +++ b/string/test-strcmp.c
> @@ -101,6 +101,28 @@ typedef int (*proto_t) (const CHAR *, const CHAR *);
>   
>   IMPL (STRCMP, 1)
>   
> +/* Also check the default implementation.  */
> +#undef STRCMP
> +#undef libc_hidden_builtin_def
> +#define libc_hidden_builtin_def(a)
> +#undef libc_hidden_def
> +#define libc_hidden_def(a)
> +#undef weak_alias
> +#define weak_alias(a, b)
> +#undef attribute_hidden
> +#define attribute_hidden
> +#ifndef WIDE
> +# define STRCMP __strcmp_default
> +# include "string/strcmp.c"
> +# define STRCMP_DEFAULT STRCMP
> +#else
> +# define WCSCMP __wcscmp_default
> +# include "wcsmbs/wcscmp.c"
> +# define STRCMP_DEFAULT WCSCMP
> +#endif
> +IMPL (STRCMP_DEFAULT, 1)
> +
> +
>   static int
>   check_result (impl_t *impl,
>   	     const CHAR *s1, const CHAR *s2,
  

Patch

diff --git a/string/test-strcmp.c b/string/test-strcmp.c
index ceb0d29c74..fa3161688c 100644
--- a/string/test-strcmp.c
+++ b/string/test-strcmp.c
@@ -101,6 +101,28 @@  typedef int (*proto_t) (const CHAR *, const CHAR *);
 
 IMPL (STRCMP, 1)
 
+/* Also check the default implementation.  */
+#undef STRCMP
+#undef libc_hidden_builtin_def
+#define libc_hidden_builtin_def(a)
+#undef libc_hidden_def
+#define libc_hidden_def(a)
+#undef weak_alias
+#define weak_alias(a, b)
+#undef attribute_hidden
+#define attribute_hidden
+#ifndef WIDE
+# define STRCMP __strcmp_default
+# include "string/strcmp.c"
+# define STRCMP_DEFAULT STRCMP
+#else
+# define WCSCMP __wcscmp_default
+# include "wcsmbs/wcscmp.c"
+# define STRCMP_DEFAULT WCSCMP
+#endif
+IMPL (STRCMP_DEFAULT, 1)
+
+
 static int
 check_result (impl_t *impl,
 	     const CHAR *s1, const CHAR *s2,