OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gcc.dg/] [format/] [multattr-1.c] - Blame information for rev 298

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

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

powered by: WebSVN 2.1.0

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