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-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 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 } */
6
/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */
7
 
8
#include "format.h"
9
 
10
void
11
foo (int i, char *s, size_t n, va_list v0, va_list v1, va_list v2, va_list v3,
12
     va_list v4, va_list v5, va_list v6, va_list v7)
13
{
14
  fprintf (stdout, "%d", i);
15
  fprintf (stdout, "%ld", i); /* { dg-warning "format" "fprintf" } */
16
  printf ("%d", i);
17
  printf ("%ld", i); /* { dg-warning "format" "printf" } */
18
  /* The "unlocked" functions shouldn't warn in c99 mode.  */
19
  fprintf_unlocked (stdout, "%ld", i); /* { dg-bogus "format" "fprintf_unlocked" } */
20
  printf_unlocked ("%ld", i); /* { dg-bogus "format" "printf_unlocked" } */
21
  sprintf (s, "%d", i);
22
  sprintf (s, "%ld", i); /* { dg-warning "format" "sprintf" } */
23
  snprintf (s, n, "%d", i);
24
  snprintf (s, n, "%ld", i); /* { dg-warning "format" "snprintf" } */
25
  vfprintf (stdout, "%d", v0);
26
  vfprintf (stdout, "%Y", v1); /* { dg-warning "format" "vfprintf" } */
27
  vprintf ("%d", v0);
28
  vprintf ("%Y", v1); /* { dg-warning "format" "vprintf" } */
29
  vsprintf (s, "%d", v0);
30
  vsprintf (s, "%Y", v1); /* { dg-warning "format" "vsprintf" } */
31
  vsnprintf (s, n, "%d", v0);
32
  vsnprintf (s, n, "%Y", v1); /* { dg-warning "format" "vsnprintf" } */
33
  printf (gettext ("%d"), i);
34
  printf (gettext ("%ld"), i);
35
  printf (dgettext ("", "%d"), i);
36
  printf (dgettext ("", "%ld"), i);
37
  printf (dcgettext ("", "%d", 0), i);
38
  printf (dcgettext ("", "%ld", 0), i);
39
}

powered by: WebSVN 2.1.0

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