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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [format/] [ext-7.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 scanf formats.  %a and %m extensions.  */
2
/* { dg-do compile } */
3
/* { dg-options "-std=gnu89 -Wformat" } */
4
 
5
#include "format.h"
6
 
7
void
8
foo (char **sp, wchar_t **lsp, int *ip, float *fp, void **pp, double *dp)
9
{
10
  /* %a formats for allocation, only recognized in C90 mode, are a
11
     GNU extension.  Followed by other characters, %a is not treated
12
     specially.
13
  */
14
  scanf ("%as", sp);
15
  scanf ("%aS", lsp);
16
  scanf ("%las", dp);
17
  scanf ("%la", lsp);   /* { dg-warning "but argument 2 has type" } */
18
  scanf ("%las", lsp);  /* { dg-warning "but argument 2 has type" } */
19
  scanf ("%a[bcd]", sp);
20
  scanf ("%la[bcd]", dp);
21
  scanf ("%*as");
22
  scanf ("%*aS");
23
  scanf ("%*las");      /* { dg-warning "assignment suppression and length modifier" } */
24
  scanf ("%*a[bcd]");
25
  scanf ("%*la[bcd]");  /* { dg-warning "assignment suppression and length modifier" } */
26
  scanf ("%10as", sp);
27
  scanf ("%5aS", lsp);
28
  scanf ("%9las", dp);
29
  scanf ("%25a[bcd]", sp);
30
  scanf ("%48la[bcd]", dp);
31
  scanf ("%*10as");
32
  scanf ("%*5aS");
33
  scanf ("%*9las");     /* { dg-warning "assignment suppression and length modifier" } */
34
  scanf ("%*25a[bcd]");
35
  scanf ("%*48la[bcd]"); /* { dg-warning "assignment suppression and length modifier" } */
36
 
37
  /* m assignment-allocation modifier, recognized in both C90
38
     and C99 modes, is a POSIX and ISO/IEC WDTR 24731-2 extension.  */
39
  scanf ("%ms", sp);
40
  scanf ("%mS", lsp);
41
  scanf ("%mls", lsp);
42
  scanf ("%m[bcd]", sp);
43
  scanf ("%ml[bcd]", lsp);
44
  scanf ("%mc", sp);
45
  scanf ("%mlc", lsp);
46
  scanf ("%mC", lsp);
47
  scanf ("%*ms");
48
  scanf ("%*mS");
49
  scanf ("%*mls");      /* { dg-warning "assignment suppression and length modifier" } */
50
  scanf ("%*m[bcd]");
51
  scanf ("%*ml[bcd]");  /* { dg-warning "assignment suppression and length modifier" } */
52
  scanf ("%*mc");
53
  scanf ("%*mlc");      /* { dg-warning "assignment suppression and length modifier" } */
54
  scanf ("%*mC");
55
  scanf ("%10ms", sp);
56
  scanf ("%5mS", lsp);
57
  scanf ("%9mls", lsp);
58
  scanf ("%25m[bcd]", sp);
59
  scanf ("%41ml[bcd]", lsp);
60
  scanf ("%131mc", sp);
61
  scanf ("%27mlc", lsp);
62
  scanf ("%2mC", lsp);
63
  scanf ("%*10ms");
64
  scanf ("%*5mS");
65
  scanf ("%*9mls");     /* { dg-warning "assignment suppression and length modifier" } */
66
  scanf ("%*25m[bcd]");
67
  scanf ("%*41ml[bcd]"); /* { dg-warning "assignment suppression and length modifier" } */
68
  scanf ("%*131mc");
69
  scanf ("%*27mlc");    /* { dg-warning "assignment suppression and length modifier" } */
70
  scanf ("%*2mC");
71
 
72
  scanf ("%md", ip);    /* { dg-warning "flag used with" } */
73
  scanf ("%mi", ip);    /* { dg-warning "flag used with" } */
74
  scanf ("%mo", ip);    /* { dg-warning "flag used with" } */
75
  scanf ("%mu", ip);    /* { dg-warning "flag used with" } */
76
  scanf ("%mx", ip);    /* { dg-warning "flag used with" } */
77
  scanf ("%me", fp);    /* { dg-warning "flag used with" } */
78
  scanf ("%mf", fp);    /* { dg-warning "flag used with" } */
79
  scanf ("%mg", fp);    /* { dg-warning "flag used with" } */
80
  scanf ("%mp", pp);    /* { dg-warning "flag used with" } */
81
 
82
  scanf ("%mas", sp);   /* { dg-warning "flag together" } */
83
  scanf ("%maS", lsp);  /* { dg-warning "flag together" } */
84
  scanf ("%ma[bcd]", sp);       /* { dg-warning "flag together" } */
85
}

powered by: WebSVN 2.1.0

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