Exemplo n.º 1
0
int main(void){

#ifdef ISASCII
   char ch = 'a';
   if(isascii(ch) == 0){
      printf("this is not ascii\n");
   }
   else{
      printf("this is ascii\n");
   }
#endif

#ifdef VSCANF
   //va_list ptr;
   int i;
   //printf("type an int:");
   vscanf(" %d ", NULL);
   printf("you typed: %d", i);
#endif

#ifdef GETCWD
   char buffer[256];
   unsigned long size = 256;
   getcwd(buffer, size);
   printf("current dir: %s\n",buffer);
#endif

   return 0;
}
Exemplo n.º 2
0
// error: formal x is shadowed by local x, hence can't be seen by va_start
void f(int x, ...) {
  { int x,y;
    va_list p;
    va_start(p,x);
    vscanf("FOO %d %d",p);
  }
}
Exemplo n.º 3
0
int main()
{
    FILE* fp = 0;
    fpos_t fpos = {0};
    size_t s = 0;
    char* cp = 0;
    va_list va;
    static_assert((std::is_same<decltype(remove("")), int>::value), "");
    static_assert((std::is_same<decltype(rename("","")), int>::value), "");
    static_assert((std::is_same<decltype(tmpfile()), FILE*>::value), "");
    static_assert((std::is_same<decltype(tmpnam(cp)), char*>::value), "");
    static_assert((std::is_same<decltype(fclose(fp)), int>::value), "");
    static_assert((std::is_same<decltype(fflush(fp)), int>::value), "");
    static_assert((std::is_same<decltype(fopen("", "")), FILE*>::value), "");
    static_assert((std::is_same<decltype(freopen("", "", fp)), FILE*>::value), "");
    static_assert((std::is_same<decltype(setbuf(fp,cp)), void>::value), "");
    static_assert((std::is_same<decltype(vfprintf(fp,"",va)), int>::value), "");
    static_assert((std::is_same<decltype(fprintf(fp," ")), int>::value), "");
    static_assert((std::is_same<decltype(fscanf(fp,"")), int>::value), "");
    static_assert((std::is_same<decltype(printf("\n")), int>::value), "");
    static_assert((std::is_same<decltype(scanf("\n")), int>::value), "");
    static_assert((std::is_same<decltype(snprintf(cp,0,"p")), int>::value), "");
    static_assert((std::is_same<decltype(sprintf(cp," ")), int>::value), "");
    static_assert((std::is_same<decltype(sscanf("","")), int>::value), "");
    static_assert((std::is_same<decltype(vfprintf(fp,"",va)), int>::value), "");
    static_assert((std::is_same<decltype(vfscanf(fp,"",va)), int>::value), "");
    static_assert((std::is_same<decltype(vprintf(" ",va)), int>::value), "");
    static_assert((std::is_same<decltype(vscanf("",va)), int>::value), "");
    static_assert((std::is_same<decltype(vsnprintf(cp,0," ",va)), int>::value), "");
    static_assert((std::is_same<decltype(vsprintf(cp," ",va)), int>::value), "");
    static_assert((std::is_same<decltype(vsscanf("","",va)), int>::value), "");
    static_assert((std::is_same<decltype(fgetc(fp)), int>::value), "");
    static_assert((std::is_same<decltype(fgets(cp,0,fp)), char*>::value), "");
    static_assert((std::is_same<decltype(fputc(0,fp)), int>::value), "");
    static_assert((std::is_same<decltype(fputs("",fp)), int>::value), "");
    static_assert((std::is_same<decltype(getc(fp)), int>::value), "");
    static_assert((std::is_same<decltype(getchar()), int>::value), "");
    static_assert((std::is_same<decltype(gets(cp)), char*>::value), "");
    static_assert((std::is_same<decltype(putc(0,fp)), int>::value), "");
    static_assert((std::is_same<decltype(putchar(0)), int>::value), "");
    static_assert((std::is_same<decltype(puts("")), int>::value), "");
    static_assert((std::is_same<decltype(ungetc(0,fp)), int>::value), "");
    static_assert((std::is_same<decltype(fread((void*)0,0,0,fp)), size_t>::value), "");
    static_assert((std::is_same<decltype(fwrite((const void*)0,0,0,fp)), size_t>::value), "");
    static_assert((std::is_same<decltype(fgetpos(fp, &fpos)), int>::value), "");
    static_assert((std::is_same<decltype(fseek(fp, 0,0)), int>::value), "");
    static_assert((std::is_same<decltype(fsetpos(fp, &fpos)), int>::value), "");
    static_assert((std::is_same<decltype(ftell(fp)), long>::value), "");
    static_assert((std::is_same<decltype(rewind(fp)), void>::value), "");
    static_assert((std::is_same<decltype(clearerr(fp)), void>::value), "");
#if !defined(feof)
    //check return type of feof only if it's not an macro which may be a compound expression
    static_assert((std::is_same<decltype(feof(fp)), int>::value), "");
#endif
#if !defined(ferror)
    //check return type of ferror only if it's not an macro which may be a compound expression
    static_assert((std::is_same<decltype(ferror(fp)), int>::value), "");
#endif
    static_assert((std::is_same<decltype(perror("")), void>::value), "");
}
Exemplo n.º 4
0
void
bar (const char *fmt, ...)
{
  va_list ap;
  va_start (ap, fmt);
  vscanf (fmt, ap); /* { dg-warning "candidate" "scanf attribute warning" { xfail *-*-vxworks* } } */
  va_end (ap);
}
Exemplo n.º 5
0
int ATCmdParser::scanf(const char *format, ...)
{
    va_list args;
    va_start(args, format);
    int res = vscanf(format, args);
    va_end(args);
    return res;
}
Exemplo n.º 6
0
int scanf(const char *format, ...)
{
	va_list ap;
	va_start(ap, format);
	int out = vscanf(format, ap);
	va_end(ap);
	return out;
};
Exemplo n.º 7
0
static int
xscanf (const char *fmt, ...)
{
  va_list ap;
  va_start (ap, fmt);
  int ret = vscanf (fmt, ap);
  va_end (ap);
  return ret;
}
Exemplo n.º 8
0
static int
call_vscanf (const char *format, ...)
{
  va_list ap;
  va_start (ap, format);
  int ret = vscanf (format, ap);
  va_end (ap);
  return ret;
}
Exemplo n.º 9
0
int scanf(const char *format,...)
{ /*Call the vscanf.*/
   va_list list;
   int retval;
   va_start(list,format);
   retval = vscanf(format,list);
   va_end(list);
   return retval;
}
Exemplo n.º 10
0
int wscanf(const wchar_t *format, ... )
{
    va_list  args;
    int      result;

    va_start (args, format);
    result = vscanf( (const char*)format, args );
    va_end (args);
    return result;
}
Exemplo n.º 11
0
int scanf(const char * fmt, ...) {
	va_list args;
	int read;

	va_start(args, fmt);
	read = vscanf(fmt, args);
	va_end(args);
	
	return read;
}
Exemplo n.º 12
0
int Scanf(char *format, ...)
{
    int ret;

    va_list ap;
    va_start(ap, format);
    ret = vscanf(format, ap);
    va_end(ap);
    return ret;
}
Exemplo n.º 13
0
Arquivo: ext-6.c Projeto: 0day-ci/gcc
void
foo (int i, char *s, size_t n, int *ip, va_list v0, va_list v1, va_list v2,
     va_list v3, va_list v4, va_list v5, va_list v6, va_list v7, va_list v8,
     va_list v9, va_list v10, va_list v11, va_list v12, va_list v13)
{
  fprintf (stdout, "%d", i);
  fprintf (stdout, "%ld", i); /* { dg-warning "format" "fprintf" } */
  printf ("%d", i);
  printf ("%ld", i); /* { dg-warning "format" "printf" } */
  fprintf_unlocked (stdout, "%d", i);
  fprintf_unlocked (stdout, "%ld", i); /* { dg-warning "format" "fprintf_unlocked" } */
  printf_unlocked ("%d", i);
  printf_unlocked ("%ld", i); /* { dg-warning "format" "printf_unlocked" } */
  sprintf (s, "%d", i);
  sprintf (s, "%ld", i); /* { dg-warning "format" "sprintf" } */
  snprintf (s, n, "%d", i);
  snprintf (s, n, "%ld", i); /* { dg-warning "format" "snprintf" } */
  vfprintf (stdout, "%d", v0);
  vfprintf (stdout, "%Y", v1); /* { dg-warning "format" "vfprintf" } */
  vprintf ("%d", v2);
  vprintf ("%Y", v3); /* { dg-warning "format" "vprintf" } */
  vsprintf (s, "%d", v4);
  vsprintf (s, "%Y", v5); /* { dg-warning "format" "vsprintf" } */
  vsnprintf (s, n, "%d", v6);
  vsnprintf (s, n, "%Y", v7); /* { dg-warning "format" "vsnprintf" } */
  fscanf (stdin, "%d", ip);
  fscanf (stdin, "%ld", ip); /* { dg-warning "format" "fscanf" } */
  scanf ("%d", ip);
  scanf ("%ld", ip); /* { dg-warning "format" "scanf" } */
  sscanf (s, "%d", ip);
  sscanf (s, "%ld", ip); /* { dg-warning "format" "sscanf" } */
  vfscanf (stdin, "%d", v8);
  vfscanf (stdin, "%Y", v9); /* { dg-warning "format" "vfscanf" } */
  vscanf ("%d", v10);
  vscanf ("%Y", v11); /* { dg-warning "format" "vscanf" } */
  vsscanf (s, "%d", v12);
  vsscanf (s, "%Y", v13); /* { dg-warning "format" "vsscanf" } */
}
Exemplo n.º 14
0
void
foo (int *ip, char *s, va_list v0, va_list v1, va_list v2, va_list v3,
     va_list v4, va_list v5)
{
  fscanf (stdin, "%d", ip);
  fscanf (stdin, "%ld", ip); /* { dg-warning "format" "fscanf" } */
  scanf ("%d", ip);
  scanf ("%ld", ip); /* { dg-warning "format" "scanf" } */
  sscanf (s, "%d", ip);
  sscanf (s, "%ld", ip); /* { dg-warning "format" "sscanf" } */
  vfscanf (stdin, "%d", v0);
  vfscanf (stdin, "%Y", v1); /* { dg-warning "format" "vfscanf" } */
  vscanf ("%d", v2);
  vscanf ("%Y", v3); /* { dg-warning "format" "vscanf" } */
  vsscanf (s, "%d", v4);
  vsscanf (s, "%Y", v5); /* { dg-warning "format" "vsscanf" } */
  scanf (gettext ("%d"), ip);
  scanf (gettext ("%ld"), ip);
  scanf (dgettext ("", "%d"), ip);
  scanf (dgettext ("", "%ld"), ip);
  scanf (dcgettext ("", "%d", 0), ip);
  scanf (dcgettext ("", "%ld", 0), ip);
}
Exemplo n.º 15
0
void test_variants(int *i, const char *s, ...) {
  FILE *f = 0;
  char buf[100];

  fscanf(f, "%ld", i); // expected-warning{{format specifies type 'long *' but the argument has type 'int *'}}
  sscanf(buf, "%ld", i); // expected-warning{{format specifies type 'long *' but the argument has type 'int *'}}
  my_scanf("%ld", i); // expected-warning{{format specifies type 'long *' but the argument has type 'int *'}}

  va_list ap;
  va_start(ap, s);

  vscanf("%[abc", ap); // expected-warning{{no closing ']' for '%[' in scanf format string}}
  vfscanf(f, "%[abc", ap); // expected-warning{{no closing ']' for '%[' in scanf format string}}
  vsscanf(buf, "%[abc", ap); // expected-warning{{no closing ']' for '%[' in scanf format string}}
}
Exemplo n.º 16
0
int uart_scanf(const char *fmt, ...){
    va_list ap;
    int count;

    va_start(ap, fmt);
	#ifndef SIMULATE
    count = uart_vscanf(fmt, ap);
	#else
    count = vscanf(fmt, ap);
	#endif

    va_end(ap);

    return count;
}
Exemplo n.º 17
0
void check_string_literal2( FILE* fp, const char* s, char *buf, ... ) {
  char * b;
  va_list ap;
  va_start(ap,buf);

  printf(s); // expected-warning {{format string is not a string literal}}
  vprintf(s,ap); // no-warning
  fprintf(fp,s); // expected-warning {{format string is not a string literal}}
  vfprintf(fp,s,ap); // no-warning
  asprintf(&b,s); // expected-warning {{format string is not a string lit}}
  vasprintf(&b,s,ap); // no-warning
  sprintf(buf,s); // expected-warning {{format string is not a string literal}}
  snprintf(buf,2,s); // expected-warning {{format string is not a string lit}}
  __builtin___vsnprintf_chk(buf,2,0,-1,s,ap); // no-warning

  vscanf(s, ap); // expected-warning {{format string is not a string literal}}
}
Exemplo n.º 18
0
int jvg_scanf(char *title, char *prompt, char *fmt, ...){
 int cnt;
 int x, y, h = 8, w, i, len, m, bb, bf;
 va_list  argptr;
 w = 20 + strlen(title);
 len = 5;
 for(i = 0; i < strlen(prompt); i++){
  if((prompt[i] == '\n')&&(prompt[i+1] == '\r')){
   h++;
   len = 0;
   i++;
  }
  if(len > w) w = len;
  len++;
 }
 x = (80 - w) / 2;
 y = (50 - h) / 2;
 guardar_estado();
 guardar_ventana();
 bf = JVGmarcf;
 bb = JVGmarcb;
 m = JVGmarco;
 m_borde(14);
 m_fondo(1);
 ajustarmarco(MARCO_DOBLE);
 gettext(x, y, x + w - 1, y + h - 1, JVGbuffer);
 marco(x, y, x + w - 1,y + h - 1);
 gotoxy(x + 1, y);
 cputs("(ž)");
 cputs(title);
 window(x + 2, y + 1, x + w, y + h - 2);
 cputs(prompt);
 ajustarmarco(m);
 restaurar_ventana();
 marco(x + 1, y + h - 4, x + w - 2, y + h - 2);
 gotoxy(x + 2, y + h - 3);
 va_start(argptr, fmt);
 cnt = vscanf(fmt, argptr);
 va_end(argptr);
 fflush(stdin);
 m_borde(bb);
 m_fondo(bf);
 restaurar_colores();
 puttext(x, y, x + w - 1, y + h - 1, JVGbuffer);
 return cnt;
}
Exemplo n.º 19
0
void check_string_literal( FILE* fp, const char* s, char *buf, ... ) {

  char * b;
  va_list ap;
  va_start(ap,buf);

  printf(s); // expected-warning {{format string is not a string literal}}
  // expected-note@-1{{treat the string as an argument to avoid this}}
  vprintf(s,ap); // expected-warning {{format string is not a string literal}}
  fprintf(fp,s); // expected-warning {{format string is not a string literal}}
  // expected-note@-1{{treat the string as an argument to avoid this}}
  vfprintf(fp,s,ap); // expected-warning {{format string is not a string literal}}
  asprintf(&b,s); // expected-warning {{format string is not a string lit}}
  // expected-note@-1{{treat the string as an argument to avoid this}}
  vasprintf(&b,s,ap); // expected-warning {{format string is not a string literal}}
  sprintf(buf,s); // expected-warning {{format string is not a string literal}}
  // expected-note@-1{{treat the string as an argument to avoid this}}
  snprintf(buf,2,s); // expected-warning {{format string is not a string lit}}
  // expected-note@-1{{treat the string as an argument to avoid this}}
  __builtin___sprintf_chk(buf,0,-1,s); // expected-warning {{format string is not a string literal}}
  // expected-note@-1{{treat the string as an argument to avoid this}}
  __builtin___snprintf_chk(buf,2,0,-1,s); // expected-warning {{format string is not a string lit}}
  // expected-note@-1{{treat the string as an argument to avoid this}}
  vsprintf(buf,s,ap); // expected-warning {{format string is not a string lit}}
  vsnprintf(buf,2,s,ap); // expected-warning {{format string is not a string lit}}
  vsnprintf(buf,2,global_fmt,ap); // expected-warning {{format string is not a string literal}}
  __builtin___vsnprintf_chk(buf,2,0,-1,s,ap); // expected-warning {{format string is not a string lit}}
  __builtin___vsnprintf_chk(buf,2,0,-1,global_fmt,ap); // expected-warning {{format string is not a string literal}}

  vscanf(s, ap); // expected-warning {{format string is not a string literal}}

  const char *const fmt = "%d"; // FIXME -- defined here
  printf(fmt, 1, 2); // expected-warning{{data argument not used}}

  // rdar://6079877
  printf("abc"
         "%*d", 1, 1); // no-warning
  printf("abc\
def"
         "%*d", 1, 1); // no-warning
         
  // <rdar://problem/6079850>, allow 'unsigned' (instead of 'int') to be used for both
  // the field width and precision.  This deviates from C99, but is reasonably safe
  // and is also accepted by GCC.
  printf("%*d", (unsigned) 1, 1); // no-warning  
}
Exemplo n.º 20
0
void
foo (int i, int *ip, va_list va)
{
  printf ("%3$d%1$d", i, i, i); /* { dg-warning "before used" "unused $ operand" } */
  printf ("%2$d%1$d", i, i, i);
  vprintf ("%3$d%1$d", va); /* { dg-warning "before used" "unused $ operand" } */
  /* With scanf formats, gaps in the used arguments are allowed only if the
     arguments are all pointers.  In such a case, should only give the lesser
     warning about unused arguments rather than the more serious one about
     argument gaps.  */
  scanf ("%3$d%1$d", ip, ip, ip);
  /* If there are non-pointer arguments unused at the end, this is also OK.  */
  scanf ("%3$d%1$d", ip, ip, ip, i);
  scanf ("%3$d%1$d", ip, i, ip); /* { dg-warning "before used" "unused $ scanf non-pointer operand" } */
  /* Can't check the arguments in the vscanf case, so should suppose the
     lesser problem.  */
  vscanf ("%3$d%1$d", va);
}
Exemplo n.º 21
0
/*************************************************************************
* Custom mscanf() routine
**************************************************************************/
int mscanf(char *format,...)
{
    char *new_format;
    int rc;
    va_list argp;

    gk_strstr_replace(format, D_PATTERN, D_SCAN_REPLACEMENT, "g", &new_format);

    /*mprintf("new_format: %s\n", new_format);*/

    va_start(argp, format);
    rc = vscanf((char *)new_format, argp);
    va_end(argp);

    gk_free((void **)&new_format, LTERM);

    return rc;
}
Exemplo n.º 22
0
Arquivo: scanf.c Projeto: elbing/apex
/*
 * Copyright (c) 2005-2014 Rich Felker, et al.
 * Copyright (c) 2015-2016 HarveyOS et al.
 *
 * Use of this source code is governed by a MIT-style
 * license that can be found in the LICENSE.mit file.
 */

#include <stdio.h>
#include <stdarg.h>
#include "libc.h"

int scanf(const char *restrict fmt, ...)
{
	int ret;
	va_list ap;
	va_start(ap, fmt);
	ret = vscanf(fmt, ap);
	va_end(ap);
	return ret;
}
Exemplo n.º 23
0
	void console::read(string format, ...)
	{
		va_list args;
		va_start(args, format);
		vscanf(format.c_str(), args);
	}
Exemplo n.º 24
0
int 
vsscanf (const unsigned char *buf, const char *fmt, va_list args){
    stream_buf_t u;
    stropen (&u, (unsigned char*) buf, 0);
    return vscanf ((stream_t*)&u.interface, fmt, args);
}
Exemplo n.º 25
0
void
foo (int i, unsigned int u, wint_t lc, wchar_t *ls, int *ip, double d,
     char *s, void *p, int *n, long int l, int i2, float *fp, long int *lp,
     va_list va)
{
  /* The conversion specifiers C and S, for both printf and scanf,
     are X/Open extensions.
  */
  printf ("%C", lc);
  printf ("%3C", lc);
  printf ("%.3C", lc); /* { dg-warning "precision" "precision with %C" } */
  printf ("%hC", lc); /* { dg-warning "length" "bad %hC" } */
  printf ("%hhC", lc); /* { dg-warning "length" "bad %hhC" } */
  printf ("%lC", lc); /* { dg-warning "length" "bad %lC" } */
  printf ("%llC", lc); /* { dg-warning "length" "bad %llC" } */
  printf ("%jC", lc); /* { dg-warning "length" "bad %jC" } */
  printf ("%zC", lc); /* { dg-warning "length" "bad %zC" } */
  printf ("%tC", lc); /* { dg-warning "length" "bad %tC" } */
  printf ("%LC", lc); /* { dg-warning "length" "bad %LC" } */
  printf ("%-C", lc);
  printf ("%+C", lc); /* { dg-warning "flag" "bad %+C" } */
  printf ("% C", lc); /* { dg-warning "flag" "bad % C" } */
  printf ("%#C", lc); /* { dg-warning "flag" "bad %#C" } */
  printf ("%0C", lc); /* { dg-warning "flag" "bad %0C" } */
  printf ("%'C", lc); /* { dg-warning "flag" "bad %'C" } */
  printf ("%S", ls);
  printf ("%3S", ls);
  printf ("%.3S", ls);
  printf ("%hS", ls); /* { dg-warning "length" "bad %hS" } */
  printf ("%hhS", ls); /* { dg-warning "length" "bad %hhS" } */
  printf ("%lS", ls); /* { dg-warning "length" "bad %lS" } */
  printf ("%llS", ls); /* { dg-warning "length" "bad %llS" } */
  printf ("%jS", ls); /* { dg-warning "length" "bad %jS" } */
  printf ("%zS", ls); /* { dg-warning "length" "bad %zS" } */
  printf ("%tS", ls); /* { dg-warning "length" "bad %tS" } */
  printf ("%LS", ls); /* { dg-warning "length" "bad %LS" } */
  printf ("%-S", ls);
  printf ("%+S", ls); /* { dg-warning "flag" "bad %+S" } */
  printf ("% S", ls); /* { dg-warning "flag" "bad % S" } */
  printf ("%#S", ls); /* { dg-warning "flag" "bad %#S" } */
  printf ("%0S", ls); /* { dg-warning "flag" "bad %0S" } */
  printf ("%'S", ls); /* { dg-warning "flag" "bad %'S" } */
  scanf ("%C", ls);
  scanf ("%S", ls);
  scanf ("%*C%*S");
  scanf ("%2C%3S", ls, ls);
  scanf ("%hC", ls); /* { dg-warning "length" "bad %hC" } */
  scanf ("%hhC", ls); /* { dg-warning "length" "bad %hhC" } */
  scanf ("%lC", ls); /* { dg-warning "length" "bad %lC" } */
  scanf ("%llC", ls); /* { dg-warning "length" "bad %llC" } */
  scanf ("%jC", ls); /* { dg-warning "length" "bad %jC" } */
  scanf ("%zC", ls); /* { dg-warning "length" "bad %zC" } */
  scanf ("%tC", ls); /* { dg-warning "length" "bad %tC" } */
  scanf ("%LC", ls); /* { dg-warning "length" "bad %LC" } */
  scanf ("%hS", ls); /* { dg-warning "length" "bad %hS" } */
  scanf ("%hhS", ls); /* { dg-warning "length" "bad %hhS" } */
  scanf ("%lS", ls); /* { dg-warning "length" "bad %lS" } */
  scanf ("%llS", ls); /* { dg-warning "length" "bad %llS" } */
  scanf ("%jS", ls); /* { dg-warning "length" "bad %jS" } */
  scanf ("%zS", ls); /* { dg-warning "length" "bad %zS" } */
  scanf ("%tS", ls); /* { dg-warning "length" "bad %tS" } */
  scanf ("%LS", ls); /* { dg-warning "length" "bad %LS" } */
  /* In C99 mode (even with extensions), %aS is a floating point
     format followed by an S.
  */
  scanf ("%aS", fp);
  /* The printf flag character ' is an X/Open extension.  */
  printf ("%'d%'i%'u%'f%'F%'g%'G", i, i, u, d, d, d, d);
  printf ("%'o", u); /* { dg-warning "flag" "bad use of ' flag" } */
  printf ("%'x", u); /* { dg-warning "flag" "bad use of ' flag" } */
  printf ("%'X", u); /* { dg-warning "flag" "bad use of ' flag" } */
  printf ("%'e", d); /* { dg-warning "flag" "bad use of ' flag" } */
  printf ("%'E", d); /* { dg-warning "flag" "bad use of ' flag" } */
  printf ("%'a", d); /* { dg-warning "flag" "bad use of ' flag" } */
  printf ("%'A", d); /* { dg-warning "flag" "bad use of ' flag" } */
  printf ("%'c", i); /* { dg-warning "flag" "bad use of ' flag" } */
  printf ("%'s", s); /* { dg-warning "flag" "bad use of ' flag" } */
  printf ("%'p", p); /* { dg-warning "flag" "bad use of ' flag" } */
  printf ("%'n", n); /* { dg-warning "flag" "bad use of ' flag" } */
  /* The use of operand number $ formats is an X/Open extension.  */
  scanf ("%1$d", ip);
  printf ("%1$d", i);
  printf ("%1$d", l); /* { dg-warning "arg 2|argument 2" "mismatched args with $ format" } */
  printf ("%3$*2$.*1$ld", i2, i, l);
  printf ("%4$ld%7$ld%5$d%6$d%3$d%1$d%2$d", i, i, i, l, i, i, l);
  scanf ("%4$ld%7$ld%5$d%6$d%3$d%1$d%2$d", ip, ip, ip, lp, ip, ip, lp);
  printf ("%1$d%d", i, i); /* { dg-warning "missing" "mixing $ and non-$ formats" } */
  printf ("%%%1$d%%%2$d", i, i);
  printf ("%d%2$d", i); /* { dg-warning "used after format" "mixing $ and non-$ formats" } */
  printf ("%1$*d", i, i); /* { dg-warning "missing" "mixing $ and non-$ formats" } */
  printf ("%*1$d", i); /* { dg-warning "missing" "mixing $ and non-$ formats" } */
  scanf ("%1$d%d", ip, ip); /* { dg-warning "missing" "mixing $ and non-$ formats" } */
  scanf ("%*f%%%1$d%%%2$d", ip, ip);
  printf ("%2$d", i); /* { dg-warning "operand" "$ number too large" } */
  printf ("%0$d", i); /* { dg-warning "operand" "$ number too small" } */
  printf ("%3$d%1$d", i, i, i); /* { dg-warning "before used" "unused $ operand" } */
  printf ("%2$d%1$d", i, i, i); /* { dg-warning "unused" "unused $ operand" } */
  vprintf ("%3$d%1$d", va); /* { dg-warning "before used" "unused $ operand" } */
  /* With scanf formats, gaps in the used arguments are allowed only if the
     arguments are all pointers.  In such a case, should only give the lesser
     warning about unused arguments rather than the more serious one about
     argument gaps.  */
  scanf ("%3$d%1$d", ip, ip, ip); /* { dg-bogus "before used" "unused $ scanf pointer operand" } */
  /* { dg-warning "unused" "unused $ scanf pointer operand" { target *-*-* } .-1 } */
  /* If there are non-pointer arguments unused at the end, this is also OK.  */
  scanf ("%3$d%1$d", ip, ip, ip, i); /* { dg-bogus "before used" "unused $ scanf pointer operand" } */
  /* { dg-warning "unused" "unused $ scanf pointer operand" { target *-*-* } .-1 } */
  scanf ("%3$d%1$d", ip, i, ip); /* { dg-warning "before used" "unused $ scanf non-pointer operand" } */
  /* Can't check the arguments in the vscanf case, so should suppose the
     lesser problem.  */
  vscanf ("%3$d%1$d", va); /* { dg-bogus "before used" "unused $ scanf pointer operand" } */
  /* { dg-warning "unused" "unused $ scanf pointer operand" { target *-*-* } .-1 } */
  scanf ("%2$*d%1$d", ip, ip); /* { dg-warning "operand" "operand number with suppression" } */
  printf ("%1$d%1$d", i);
  scanf ("%1$d%1$d", ip); /* { dg-warning "more than once" "multiple use of scanf argument" } */
}