Message ID | 20241222000509.2205895-25-hjl.tools@gmail.com |
---|---|
State | New |
Headers | show |
Series | [01/39] conform: Use -dD instead of -dN on compiler invocation | expand |
"H.J. Lu" <hjl.tools@gmail.com> writes: > From: Adhemerval Zanella <adhemerval.zanella@linaro.org> > > clang does not support 'I' specifier and handles it as a 'length > modifier'. > --- > localedata/tst-trans.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/localedata/tst-trans.c b/localedata/tst-trans.c > index 2819bb32cc..3c0db4d5c1 100644 > --- a/localedata/tst-trans.c > +++ b/localedata/tst-trans.c > @@ -22,6 +22,7 @@ > #include <string.h> > #include <wchar.h> > #include <wctype.h> > +#include <libc-diag.h> > > static int > do_test (void) > @@ -59,7 +60,12 @@ do_test (void) > errors |= len != 10; > printf ("len = %d, wbuf = L\"%ls\"\n", len, wbuf); > > - snprintf (buf, sizeof buf, "%Id", 0x499602D2); > + /* clang does not support 'I' specifier and handles it as a 'length > + * modifier'. */ > + DIAG_PUSH_NEEDS_COMMENT_CLANG; > + DIAG_IGNORE_NEEDS_COMMENT_CLANG (16, "-Wformat"); > + snprintf (buf, sizeof buf, "%Id", 0x499602D2U); > + DIAG_POP_NEEDS_COMMENT_CLANG; > errors |= strcmp (buf, "bcdefghija") != 0; > len = strlen (buf); > errors |= len != 10; I'd still prefer -Wno-format for this for Clang but it's not like that's less messy given it pollutes the Makefiles. Reviewed-by: Sam James <sam@gentoo.org>
diff --git a/localedata/tst-trans.c b/localedata/tst-trans.c index 2819bb32cc..3c0db4d5c1 100644 --- a/localedata/tst-trans.c +++ b/localedata/tst-trans.c @@ -22,6 +22,7 @@ #include <string.h> #include <wchar.h> #include <wctype.h> +#include <libc-diag.h> static int do_test (void) @@ -59,7 +60,12 @@ do_test (void) errors |= len != 10; printf ("len = %d, wbuf = L\"%ls\"\n", len, wbuf); - snprintf (buf, sizeof buf, "%Id", 0x499602D2); + /* clang does not support 'I' specifier and handles it as a 'length + * modifier'. */ + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (16, "-Wformat"); + snprintf (buf, sizeof buf, "%Id", 0x499602D2U); + DIAG_POP_NEEDS_COMMENT_CLANG; errors |= strcmp (buf, "bcdefghija") != 0; len = strlen (buf); errors |= len != 10;
From: Adhemerval Zanella <adhemerval.zanella@linaro.org> clang does not support 'I' specifier and handles it as a 'length modifier'. --- localedata/tst-trans.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)