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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [warn/] [format2.C] - Blame information for rev 801

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

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

powered by: WebSVN 2.1.0

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