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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [format/] [multattr-2.c] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 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 } */
5
/* { dg-options "-std=gnu99 -Wformat" } */
6
 
7
#include "format.h"
8
 
9
/* If we specify multiple attributes for a single function, they should
10
   all apply, wherever they are placed on the declarations.  */
11
 
12
extern __attribute__((__format__(__printf__, 1, 0))) void
13
     my_vprintf_scanf (const char *, va_list, const char *, ...)
14
     __attribute__((__format__(__scanf__, 3, 4)));
15
 
16
extern void (__attribute__((__format__(__printf__, 1, 0))) my_vprintf_scanf2)
17
     (const char *, va_list, const char *, ...)
18
     __attribute__((__format__(__scanf__, 3, 4)));
19
 
20
extern __attribute__((__format__(__scanf__, 3, 4))) void
21
     (__attribute__((__format__(__printf__, 1, 0))) my_vprintf_scanf3)
22
     (const char *, va_list, const char *, ...);
23
 
24
void
25
foo (va_list ap, int *ip, long *lp)
26
{
27
  my_vprintf_scanf ("%d", ap, "%d", ip);
28
  my_vprintf_scanf ("%d", ap, "%ld", lp);
29
  my_vprintf_scanf ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */
30
  my_vprintf_scanf ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */
31
  my_vprintf_scanf2 ("%d", ap, "%d", ip);
32
  my_vprintf_scanf2 ("%d", ap, "%ld", lp);
33
  my_vprintf_scanf2 ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */
34
  my_vprintf_scanf2 ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */
35
  my_vprintf_scanf3 ("%d", ap, "%d", ip);
36
  my_vprintf_scanf3 ("%d", ap, "%ld", lp);
37
  my_vprintf_scanf3 ("%", ap, "%d", ip); /* { dg-warning "format" "printf" } */
38
  my_vprintf_scanf3 ("%d", ap, "%ld", ip); /* { dg-warning "format" "scanf" } */
39
}

powered by: WebSVN 2.1.0

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