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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [format/] [attr-7.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 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
#define DONT_GNU_PROTOTYPE
7
#include "format.h"
8
 
9
__attribute__((format(gnu_attr_printf, 1, 2))) void (*tformatprintf0) (const char *, ...);
10
void (*tformatprintf1) (const char *, ...) __attribute__((format(gnu_attr_printf, 1, 2)));
11
void (__attribute__((format(gnu_attr_printf, 1, 2))) *tformatprintf2) (const char *, ...);
12
void (__attribute__((format(gnu_attr_printf, 1, 2))) ****tformatprintf3) (const char *, ...);
13
 
14
char * (__attribute__((format_arg(1))) *tformat_arg) (const char *);
15
 
16
void
17
baz (int i)
18
{
19
  (*tformatprintf0) ("%d", i);
20
  (*tformatprintf0) ((*tformat_arg) ("%d"), i);
21
  (*tformatprintf0) ("%"); /* { dg-warning "format" "prefix" } */
22
  (*tformatprintf0) ((*tformat_arg) ("%")); /* { dg-warning "format" "prefix" } */
23
  (*tformatprintf1) ("%d", i);
24
  (*tformatprintf1) ((*tformat_arg) ("%d"), i);
25
  (*tformatprintf1) ("%"); /* { dg-warning "format" "postfix" } */
26
  (*tformatprintf1) ((*tformat_arg) ("%")); /* { dg-warning "format" "postfix" } */
27
  (*tformatprintf2) ("%d", i);
28
  (*tformatprintf2) ((*tformat_arg) ("%d"), i);
29
  (*tformatprintf2) ("%"); /* { dg-warning "format" "nested" } */
30
  (*tformatprintf2) ((*tformat_arg) ("%")); /* { dg-warning "format" "nested" } */
31
  (****tformatprintf3) ("%d", i);
32
  (****tformatprintf3) ((*tformat_arg) ("%d"), i);
33
  (****tformatprintf3) ("%"); /* { dg-warning "format" "nested 2" } */
34
  (****tformatprintf3) ((*tformat_arg) ("%")); /* { dg-warning "format" "nested 2" } */
35
}

powered by: WebSVN 2.1.0

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