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/] [attr-7.c] - Blame information for rev 856

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

Line No. Rev Author Line
1 149 jeremybenn
/* Test for format attributes: test applying them to types.  */
2
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
3
/* { dg-do compile } */
4
/* { dg-options "-std=gnu99 -Wformat" } */
5
 
6
#include "format.h"
7
 
8
__attribute__((format(printf, 1, 2))) void (*tformatprintf0) (const char *, ...);
9
void (*tformatprintf1) (const char *, ...) __attribute__((format(printf, 1, 2)));
10
void (__attribute__((format(printf, 1, 2))) *tformatprintf2) (const char *, ...);
11
void (__attribute__((format(printf, 1, 2))) ****tformatprintf3) (const char *, ...);
12
 
13
char * (__attribute__((format_arg(1))) *tformat_arg) (const char *);
14
 
15
void
16
baz (int i)
17
{
18
  (*tformatprintf0) ("%d", i);
19
  (*tformatprintf0) ((*tformat_arg) ("%d"), i);
20
  (*tformatprintf0) ("%"); /* { dg-warning "format" "prefix" } */
21
  (*tformatprintf0) ((*tformat_arg) ("%")); /* { dg-warning "format" "prefix" } */
22
  (*tformatprintf1) ("%d", i);
23
  (*tformatprintf1) ((*tformat_arg) ("%d"), i);
24
  (*tformatprintf1) ("%"); /* { dg-warning "format" "postfix" } */
25
  (*tformatprintf1) ((*tformat_arg) ("%")); /* { dg-warning "format" "postfix" } */
26
  (*tformatprintf2) ("%d", i);
27
  (*tformatprintf2) ((*tformat_arg) ("%d"), i);
28
  (*tformatprintf2) ("%"); /* { dg-warning "format" "nested" } */
29
  (*tformatprintf2) ((*tformat_arg) ("%")); /* { dg-warning "format" "nested" } */
30
  (****tformatprintf3) ("%d", i);
31
  (****tformatprintf3) ((*tformat_arg) ("%d"), i);
32
  (****tformatprintf3) ("%"); /* { dg-warning "format" "nested 2" } */
33
  (****tformatprintf3) ((*tformat_arg) ("%")); /* { dg-warning "format" "nested 2" } */
34
}

powered by: WebSVN 2.1.0

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