Blame stdio-common/bug21.c

Packit 6c4009
#include <stdio.h>
Packit 6c4009
#include <libc-diag.h>
Packit 6c4009
Packit 6c4009
static int
Packit 6c4009
do_test (void)
Packit 6c4009
{
Packit 6c4009
  static const char buf[] = " ";
Packit 6c4009
  char *str;
Packit 6c4009
Packit 6c4009
  /* GCC in C99 mode treats %a as the C99 format expecting float *,
Packit 6c4009
     but glibc with _GNU_SOURCE treats %as as the GNU allocation
Packit 6c4009
     extension, so resulting in "warning: format '%a' expects argument
Packit 6c4009
     of type 'float *', but argument 3 has type 'char **'".  This
Packit 6c4009
     applies to the other %as, %aS and %a[] formats below as well.  */
Packit 6c4009
  DIAG_PUSH_NEEDS_COMMENT;
Packit 6c4009
  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat");
Packit 6c4009
  int r = sscanf (buf, "%as", &str);
Packit 6c4009
  DIAG_POP_NEEDS_COMMENT;
Packit 6c4009
  printf ("%d %p\n", r, str);
Packit 6c4009
Packit 6c4009
  return r != -1 || str != NULL;
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
#define TEST_FUNCTION do_test ()
Packit 6c4009
#include "../test-skeleton.c"