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/] [c90-printf-3.c] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Test for printf formats.  Test that the C90 functions get their default
2
   attributes in strict C90 mode, but the C99 and gettext functions
3
   do not.
4
*/
5
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
6
/* { dg-do compile } */
7
/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
8
 
9
#include "format.h"
10
 
11
void
12
foo (int i, char *s, size_t n, va_list v0, va_list v1, va_list v2, va_list v3,
13
     va_list v4, va_list v5, va_list v6, va_list v7, va_list v8)
14
{
15
  fprintf (stdout, "%d", i);
16
  fprintf (stdout, "%ld", i); /* { dg-warning "format" "fprintf" } */
17
  printf ("%d", i);
18
  printf ("%ld", i); /* { dg-warning "format" "printf" } */
19
  /* The "unlocked" functions shouldn't warn in c90 mode.  */
20
  fprintf_unlocked (stdout, "%ld", i); /* { dg-bogus "format" "fprintf_unlocked" } */
21
  printf_unlocked ("%ld", i); /* { dg-bogus "format" "printf_unlocked" } */
22
  sprintf (s, "%d", i);
23
  sprintf (s, "%ld", i); /* { dg-warning "format" "sprintf" } */
24
  vfprintf (stdout, "%d", v0);
25
  vfprintf (stdout, "%Y", v1); /* { dg-warning "format" "vfprintf" } */
26
  vprintf ("%d", v2);
27
  vprintf ("%Y", v3); /* { dg-warning "format" "vprintf" } */
28
  /* The following used to give a bogus warning.  */
29
  vprintf ("%*.*d", v8);
30
  vsprintf (s, "%d", v4);
31
  vsprintf (s, "%Y", v5); /* { dg-warning "format" "vsprintf" } */
32
  snprintf (s, n, "%d", i);
33
  snprintf (s, n, "%ld", i);
34
  vsnprintf (s, n, "%d", v6);
35
  vsnprintf (s, n, "%Y", v7);
36
  printf (gettext ("%d"), i);
37
  printf (gettext ("%ld"), i);
38
  printf (dgettext ("", "%d"), i);
39
  printf (dgettext ("", "%ld"), i);
40
  printf (dcgettext ("", "%d", 0), i);
41
  printf (dcgettext ("", "%ld", 0), i);
42
}

powered by: WebSVN 2.1.0

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