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/] [c99-strftime-1.c] - Blame information for rev 154

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

Line No. Rev Author Line
1 149 jeremybenn
/* Test for strftime formats.  Formats using C99 features.  */
2
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
3
/* { dg-do compile } */
4
/* { dg-options "-std=iso9899:1999 -pedantic -Wformat -Wformat-y2k" } */
5
 
6
#include "format.h"
7
 
8
void
9
foo (char *s, size_t m, const struct tm *tp)
10
{
11
  /* See ISO/IEC 9899:1990 (E) subclause 7.12.3.5 (pages 174-175).  */
12
  /* Formats which are Y2K-compliant (no 2-digit years).  */
13
  strftime (s, m, "%a%A%b%B%C%d%e%F%G%h%H%I%j%m%M%p%R%S%t%T%u%U%V%w%W%X%Y%z%Z%%", tp);
14
  strftime (s, m, "%EC%EX%EY%Od%Oe%OH%OI%Om%OM%OS%Ou%OU%OV%Ow%OW", tp);
15
  /* Formats with 2-digit years.  */
16
  strftime (s, m, "%D", tp); /* { dg-warning "only last 2" "2-digit year" } */
17
  strftime (s, m, "%g", tp); /* { dg-warning "only last 2" "2-digit year" } */
18
  strftime (s, m, "%y", tp); /* { dg-warning "only last 2" "2-digit year" } */
19
  strftime (s, m, "%Oy", tp); /* { dg-warning "only last 2" "2-digit year" } */
20
  /* Formats with 2-digit years in some locales.  */
21
  strftime (s, m, "%c", tp); /* { dg-warning "some locales" "2-digit year" } */
22
  strftime (s, m, "%Ec", tp); /* { dg-warning "some locales" "2-digit year" } */
23
  strftime (s, m, "%x", tp); /* { dg-warning "some locales" "2-digit year" } */
24
  strftime (s, m, "%Ex", tp); /* { dg-warning "some locales" "2-digit year" } */
25
  /* %Ey is explicitly an era offset not a 2-digit year; but in some
26
     locales the E modifier may be ignored.
27
  */
28
  strftime (s, m, "%Ey", tp); /* { dg-warning "some locales" "2-digit year" } */
29
  /* Bad uses of %E and %O.  */
30
  strftime (s, m, "%EEY", tp); /* { dg-warning "multiple|repeated" "multiple %E/%O" } */
31
  strftime (s, m, "%EOy", tp); /* { dg-warning "multiple|together" "multiple %E/%O" } */
32
  strftime (s, m, "%OEy", tp); /* { dg-warning "multiple|together" "multiple %E/%O" } */
33
  strftime (s, m, "%OOV", tp); /* { dg-warning "multiple|repeated" "multiple %E/%O" } */
34
  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 31 } */
35
  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 32 } */
36
  strftime (s, m, "%Ea", tp); /* { dg-warning "flag|modifier" "bad %Ea" } */
37
  strftime (s, m, "%EA", tp); /* { dg-warning "flag|modifier" "bad %EA" } */
38
  strftime (s, m, "%Eb", tp); /* { dg-warning "flag|modifier" "bad %Eb" } */
39
  strftime (s, m, "%EB", tp); /* { dg-warning "flag|modifier" "bad %EB" } */
40
  strftime (s, m, "%Ed", tp); /* { dg-warning "flag|modifier" "bad %Ed" } */
41
  strftime (s, m, "%ED", tp); /* { dg-warning "flag|modifier" "bad %ED" } */
42
  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 41 } */
43
  strftime (s, m, "%Ee", tp); /* { dg-warning "flag|modifier" "bad %Ee" } */
44
  strftime (s, m, "%EF", tp); /* { dg-warning "flag|modifier" "bad %EF" } */
45
  strftime (s, m, "%Eg", tp); /* { dg-warning "flag|modifier" "bad %Eg" } */
46
  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 45 } */
47
  strftime (s, m, "%EG", tp); /* { dg-warning "flag|modifier" "bad %EG" } */
48
  strftime (s, m, "%Eh", tp); /* { dg-warning "flag|modifier" "bad %Eh" } */
49
  strftime (s, m, "%EH", tp); /* { dg-warning "flag|modifier" "bad %EH" } */
50
  strftime (s, m, "%EI", tp); /* { dg-warning "flag|modifier" "bad %EI" } */
51
  strftime (s, m, "%Ej", tp); /* { dg-warning "flag|modifier" "bad %Ej" } */
52
  strftime (s, m, "%Em", tp); /* { dg-warning "flag|modifier" "bad %Em" } */
53
  strftime (s, m, "%EM", tp); /* { dg-warning "flag|modifier" "bad %EM" } */
54
  strftime (s, m, "%En", tp); /* { dg-warning "flag|modifier" "bad %En" } */
55
  strftime (s, m, "%Ep", tp); /* { dg-warning "flag|modifier" "bad %Ep" } */
56
  strftime (s, m, "%Er", tp); /* { dg-warning "flag|modifier" "bad %Er" } */
57
  strftime (s, m, "%ER", tp); /* { dg-warning "flag|modifier" "bad %ER" } */
58
  strftime (s, m, "%ES", tp); /* { dg-warning "flag|modifier" "bad %ES" } */
59
  strftime (s, m, "%Et", tp); /* { dg-warning "flag|modifier" "bad %Et" } */
60
  strftime (s, m, "%ET", tp); /* { dg-warning "flag|modifier" "bad %ET" } */
61
  strftime (s, m, "%Eu", tp); /* { dg-warning "flag|modifier" "bad %Eu" } */
62
  strftime (s, m, "%EU", tp); /* { dg-warning "flag|modifier" "bad %EU" } */
63
  strftime (s, m, "%EV", tp); /* { dg-warning "flag|modifier" "bad %EV" } */
64
  strftime (s, m, "%Ew", tp); /* { dg-warning "flag|modifier" "bad %Ew" } */
65
  strftime (s, m, "%EW", tp); /* { dg-warning "flag|modifier" "bad %EW" } */
66
  strftime (s, m, "%Ez", tp); /* { dg-warning "flag|modifier" "bad %Ez" } */
67
  strftime (s, m, "%EZ", tp); /* { dg-warning "flag|modifier" "bad %EZ" } */
68
  strftime (s, m, "%E%", tp); /* { dg-warning "flag|modifier" "bad %E%" } */
69
  strftime (s, m, "%Oa", tp); /* { dg-warning "flag|modifier" "bad %Oa" } */
70
  strftime (s, m, "%OA", tp); /* { dg-warning "flag|modifier" "bad %OA" } */
71
  strftime (s, m, "%Ob", tp); /* { dg-warning "flag|modifier" "bad %Ob" } */
72
  strftime (s, m, "%OB", tp); /* { dg-warning "flag|modifier" "bad %OB" } */
73
  strftime (s, m, "%Oc", tp); /* { dg-warning "flag|modifier" "bad %Oc" } */
74
  /* { dg-warning "in some locales" "2-digit year" { target *-*-* } 73 } */
75
  strftime (s, m, "%OC", tp); /* { dg-warning "flag|modifier|C" "bad %OC" } */
76
  strftime (s, m, "%OD", tp); /* { dg-warning "flag|modifier" "bad %OD" } */
77
  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 76 } */
78
  strftime (s, m, "%OF", tp); /* { dg-warning "flag|modifier" "bad %OF" } */
79
  strftime (s, m, "%Og", tp); /* { dg-warning "flag|modifier|C" "bad %Og" } */
80
  /* { dg-warning "only last 2" "2-digit year" { target *-*-* } 79 } */
81
  strftime (s, m, "%OG", tp); /* { dg-warning "flag|modifier|C" "bad %OG" } */
82
  strftime (s, m, "%Oh", tp); /* { dg-warning "flag|modifier" "bad %Oh" } */
83
  strftime (s, m, "%Oj", tp); /* { dg-warning "flag|modifier|C" "bad %Oj" } */
84
  strftime (s, m, "%On", tp); /* { dg-warning "flag|modifier" "bad %On" } */
85
  strftime (s, m, "%Op", tp); /* { dg-warning "flag|modifier" "bad %Op" } */
86
  strftime (s, m, "%Or", tp); /* { dg-warning "flag|modifier" "bad %Or" } */
87
  strftime (s, m, "%OR", tp); /* { dg-warning "flag|modifier" "bad %OR" } */
88
  strftime (s, m, "%Ot", tp); /* { dg-warning "flag|modifier" "bad %Ot" } */
89
  strftime (s, m, "%OT", tp); /* { dg-warning "flag|modifier" "bad %OT" } */
90
  strftime (s, m, "%Ox", tp); /* { dg-warning "flag|modifier" "bad %Ox" } */
91
  /* { dg-warning "in some locales" "2-digit year" { target *-*-* } 90 } */
92
  strftime (s, m, "%OX", tp); /* { dg-warning "flag|modifier" "bad %OX" } */
93
  strftime (s, m, "%OY", tp); /* { dg-warning "flag|modifier|C" "bad %OY" } */
94
  strftime (s, m, "%Oz", tp); /* { dg-warning "flag|modifier|C" "bad %Oz" } */
95
  strftime (s, m, "%OZ", tp); /* { dg-warning "flag|modifier" "bad %OZ" } */
96
  strftime (s, m, "%O%", tp); /* { dg-warning "flag|modifier" "bad %O%" } */
97
}

powered by: WebSVN 2.1.0

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