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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [format/] [ms_c99-printf-3.c] - Blame information for rev 774

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

Line No. Rev Author Line
1 689 jeremybenn
/* Test for printf formats.  Test that the C99 functions get their default
2
   attributes in strict C99 mode, but the gettext functions do not.
3
*/
4
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
5
/* { dg-do compile { target { *-*-mingw* } } } */
6
/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */
7
 
8
#define USE_SYSTEM_FORMATS
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)
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 c99 mode.  */
20
  fprintf_unlocked (stdout, "%ld", i);
21
  printf_unlocked ("%ld", i);
22
  sprintf (s, "%d", i);
23
  sprintf (s, "%ld", i); /* { dg-warning "format" "sprintf" } */
24
  snprintf (s, n, "%d", i);
25
  snprintf (s, n, "%ld", i); /* { dg-warning "format" "snprintf" } */
26
  vfprintf (stdout, "%d", v0);
27
  vfprintf (stdout, "%Y", v1); /* { dg-warning "format" "vfprintf" } */
28
  vprintf ("%d", v0);
29
  vprintf ("%Y", v1); /* { dg-warning "format" "vprintf" } */
30
  vsprintf (s, "%d", v0);
31
  vsprintf (s, "%Y", v1); /* { dg-warning "format" "vsprintf" } */
32
  vsnprintf (s, n, "%d", v0);
33
  vsnprintf (s, n, "%Y", v1); /* { dg-warning "format" "vsnprintf" } */
34
  printf (gettext ("%d"), i);
35
  printf (gettext ("%ld"), (long) i);
36
  printf (dgettext ("", "%d"), i);
37
  printf (dgettext ("", "%ld"), (long) i);
38
  printf (dcgettext ("", "%d", 0), i);
39
  printf (dcgettext ("", "%ld", 0), (long) i);
40
}

powered by: WebSVN 2.1.0

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