OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [format/] [ms_no-exargs-2.c] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* Test for warnings for extra format arguments being disabled by
2
   -Wno-format-extra-args.  Test which warnings still apply with $
3
   operand numbers.  */
4
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
5
/* { dg-do compile { target { *-*-mingw* } } } */
6
/* { dg-options "-std=gnu99 -Wformat -Wno-format-extra-args" } */
7
 
8
#define USE_SYSTEM_FORMATS
9
#include "format.h"
10
 
11
void
12
foo (int i, int *ip, va_list va)
13
{
14
  printf ("%3$d%1$d", i, i, i); /* { dg-warning "before used" "unused $ operand" } */
15
  printf ("%2$d%1$d", i, i, i);
16
  vprintf ("%3$d%1$d", va); /* { dg-warning "before used" "unused $ operand" } */
17
  /* With scanf formats, gaps in the used arguments are allowed only if the
18
     arguments are all pointers.  In such a case, should only give the lesser
19
     warning about unused arguments rather than the more serious one about
20
     argument gaps.  */
21
  scanf ("%3$d%1$d", ip, ip, ip);
22
  /* If there are non-pointer arguments unused at the end, this is also OK.  */
23
  scanf ("%3$d%1$d", ip, ip, ip, i);
24
  scanf ("%3$d%1$d", ip, i, ip); /* { dg-warning "before used" "unused $ scanf non-pointer operand" } */
25
  /* Can't check the arguments in the vscanf case, so should suppose the
26
     lesser problem.  */
27
  vscanf ("%3$d%1$d", va);
28
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.