[PATCH v2 12/13] resolv: Add new tst-resolv-invalid-cname

Szabolcs Nagy szabolcs.nagy@arm.com
Tue Aug 30 10:59:37 GMT 2022


The 08/26/2022 12:34, Florian Weimer via Libc-alpha wrote:
> This test checks resolution through CNAME chains that do not contain
> host names (bug 12154).
> 
> Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
> ---
>  resolv/Makefile                   |   3 +
>  resolv/tst-resolv-invalid-cname.c | 406 ++++++++++++++++++++++++++++++
>  2 files changed, 409 insertions(+)
>  create mode 100644 resolv/tst-resolv-invalid-cname.c
...
> +static const char *
> +test_mode_to_string (enum test_mode mode)
> +{
> +  switch (mode)
> +    {
> +    case byname:
> +      return "byname";
> +    case byname2:
> +      return "byname2";
> +    case gai:
> +      return "gai";
> +    case gai_canon:
> +      return "gai_canon";
> +    case test_mode_num:
> +      /* Report error below.  */
> +    }
> +  FAIL_EXIT1 ("invalid test_mode: %d", mode);
> +}

with gcc-8 i see build failure like

tst-resolv-invalid-cname.c: In function 'test_mode_to_string':
tst-resolv-invalid-cname.c:164:10: error: label at end of compound statement
     case test_mode_num:
          ^~~~~~~~~~~~~
make[2]: *** [../o-iterator.mk:9: /work/glibc-aarch64-linux/build/build/resolv/tst-resolv-invalid-cname.o] Error 1


at least with gcc-8,9,10 i think

void f(int x){switch(x){case 1:}}

is rejected.



More information about the Libc-alpha mailing list