1  /* Test for scanf formats.  %m extensions.  */
       2  /* { dg-do compile } */
       3  /* { dg-options "-std=gnu99 -Wformat" } */
       4  
       5  #include "format.h"
       6  
       7  void
       8  foo (char **sp, wchar_t **lsp, int *ip, float *fp, void **pp)
       9  {
      10    /* m assignment-allocation modifier, recognized in both C90
      11       and C99 modes, is a POSIX and ISO/IEC WDTR 24731-2 extension.  */
      12    scanf ("%ms", sp);
      13    scanf ("%mS", lsp);
      14    scanf ("%mls", lsp);
      15    scanf ("%m[bcd]", sp);
      16    scanf ("%ml[bcd]", lsp);
      17    scanf ("%mc", sp);
      18    scanf ("%mlc", lsp);
      19    scanf ("%mC", lsp);
      20    scanf ("%*ms");
      21    scanf ("%*mS");
      22    scanf ("%*mls");	/* { dg-warning "assignment suppression and length modifier" } */
      23    scanf ("%*m[bcd]");
      24    scanf ("%*ml[bcd]");	/* { dg-warning "assignment suppression and length modifier" } */
      25    scanf ("%*mc");
      26    scanf ("%*mlc");	/* { dg-warning "assignment suppression and length modifier" } */
      27    scanf ("%*mC");
      28    scanf ("%10ms", sp);
      29    scanf ("%5mS", lsp);
      30    scanf ("%9mls", lsp);
      31    scanf ("%25m[bcd]", sp);
      32    scanf ("%41ml[bcd]", lsp);
      33    scanf ("%131mc", sp);
      34    scanf ("%27mlc", lsp);
      35    scanf ("%2mC", lsp);
      36    scanf ("%*10ms");
      37    scanf ("%*5mS");
      38    scanf ("%*9mls");	/* { dg-warning "assignment suppression and length modifier" } */
      39    scanf ("%*25m[bcd]");
      40    scanf ("%*41ml[bcd]"); /* { dg-warning "assignment suppression and length modifier" } */
      41    scanf ("%*131mc");
      42    scanf ("%*27mlc");	/* { dg-warning "assignment suppression and length modifier" } */
      43    scanf ("%*2mC");
      44  
      45    scanf ("%md", ip);	/* { dg-warning "flag used with" } */
      46    scanf ("%mi", ip);	/* { dg-warning "flag used with" } */
      47    scanf ("%mo", ip);	/* { dg-warning "flag used with" } */
      48    scanf ("%mu", ip);	/* { dg-warning "flag used with" } */
      49    scanf ("%mx", ip);	/* { dg-warning "flag used with" } */
      50    scanf ("%ma", fp);	/* { dg-warning "flag used with" } */
      51    scanf ("%mA", fp);	/* { dg-warning "flag used with" } */
      52    scanf ("%me", fp);	/* { dg-warning "flag used with" } */
      53    scanf ("%mf", fp);	/* { dg-warning "flag used with" } */
      54    scanf ("%mg", fp);	/* { dg-warning "flag used with" } */
      55    scanf ("%mp", pp);	/* { dg-warning "flag used with" } */
      56  }