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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [format/] [c99-printf-2.c] - Blame information for rev 801

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

Line No. Rev Author Line
1 689 jeremybenn
/* Test for printf formats.  Formats using extensions to the standard
2
   should be rejected in strict pedantic mode.
3
*/
4
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
5
/* { dg-do compile } */
6
/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */
7
 
8
#include "format.h"
9
 
10
void
11
foo (int i, long long ll, size_t z, wint_t lc, wchar_t *ls)
12
{
13
  /* The length modifiers q, Z and L as applied to integer formats are
14
     extensions.
15
  */
16
  printf ("%qd", ll); /* { dg-warning "C" "%q length" } */
17
  printf ("%Ld", ll); /* { dg-warning "C" "%L length" } */
18
  printf ("%Zd", z); /* { dg-warning "C" "%Z length" } */
19
  /* The conversion specifiers C and S are X/Open extensions; the
20
     conversion specifier m is a GNU extension.
21
  */
22
  printf ("%m"); /* { dg-warning "C" "printf %m" } */
23
  printf ("%C", lc); /* { dg-warning "C" "printf %C" } */
24
  printf ("%S", ls); /* { dg-warning "C" "printf %S" } */
25
  /* The flag character ', and the use of operand number $ formats, are
26
     X/Open extensions.
27
  */
28
  printf ("%'d", i); /* { dg-warning "C" "printf ' flag" } */
29
  printf ("%1$d", i); /* { dg-warning "C" "printf $ format" } */
30
  /* The flag character I is a GNU extension.  */
31
  printf ("%Id", i); /* { dg-warning "C" "printf I flag" } */
32
}

powered by: WebSVN 2.1.0

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