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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 689 jeremybenn
/* Test for multiple format attributes.  Test for printf and scanf attributes
2
   together, in different places on the declarations.  */
3
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
4
/* { dg-do compile { target { *-*-mingw* } } } */
5
/* { dg-options "-std=gnu99 -Wformat" } */
6
 
7
#define USE_SYSTEM_FORMATS
8
#include "format.h"
9
 
10
/* If we specify multiple attributes for a single function, they should
11
   all apply, wherever they are placed on the declarations.  */
12
 
13
extern __attribute__((__format__(__ms_printf__, 1, 0))) void
14
     my_vprintf_scanf (const char *, va_list, const char *, ...)
15
     __attribute__((__format__(__ms_scanf__, 3, 4)));
16
 
17
extern void (__attribute__((__format__(__ms_printf__, 1, 0))) my_vprintf_scanf2)
18
     (const char *, va_list, const char *, ...)
19
     __attribute__((__format__(__ms_scanf__, 3, 4)));
20
 
21
extern __attribute__((__format__(__ms_scanf__, 3, 4))) void
22
     (__attribute__((__format__(__ms_printf__, 1, 0))) my_vprintf_scanf3)
23
     (const char *, va_list, const char *, ...);
24
 
25
void
26
foo (va_list ap, int *ip, long *lp)
27
{
28
  my_vprintf_scanf ("%d", ap, "%d", ip);
29
  my_vprintf_scanf ("%d", ap, "%ld", lp);
30
  my_vprintf_scanf ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */
31
  my_vprintf_scanf ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */
32
  my_vprintf_scanf2 ("%d", ap, "%d", ip);
33
  my_vprintf_scanf2 ("%d", ap, "%ld", lp);
34
  my_vprintf_scanf2 ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */
35
  my_vprintf_scanf2 ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */
36
  my_vprintf_scanf3 ("%d", ap, "%d", ip);
37
  my_vprintf_scanf3 ("%d", ap, "%ld", lp);
38
  my_vprintf_scanf3 ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */
39
  my_vprintf_scanf3 ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */
40
}

powered by: WebSVN 2.1.0

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