OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gcc.dg/] [format/] [ms_c90-printf-3.c] - Diff between revs 298 and 384

Only display areas with differences | Details | Blame | View Log

Rev 298 Rev 384
/* Test for printf formats.  Test that the C90 functions get their default
/* Test for printf formats.  Test that the C90 functions get their default
   attributes in strict C90 mode, but the C99 and gettext functions
   attributes in strict C90 mode, but the C99 and gettext functions
   do not.
   do not.
*/
*/
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* { dg-do compile { target { *-*-mingw* } } } */
/* { dg-do compile { target { *-*-mingw* } } } */
/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
 
 
#define USE_SYSTEM_FORMATS
#define USE_SYSTEM_FORMATS
#include "format.h"
#include "format.h"
 
 
void
void
foo (int i, char *s, size_t n, va_list v0, va_list v1, va_list v2, va_list v3,
foo (int i, char *s, size_t n, va_list v0, va_list v1, va_list v2, va_list v3,
     va_list v4, va_list v5, va_list v6, va_list v7, va_list v8)
     va_list v4, va_list v5, va_list v6, va_list v7, va_list v8)
{
{
  fprintf (stdout, "%d", i);
  fprintf (stdout, "%d", i);
  fprintf (stdout, "%ld", i); /* { dg-warning "format" "fprintf" } */
  fprintf (stdout, "%ld", i); /* { dg-warning "format" "fprintf" } */
  printf ("%d", i);
  printf ("%d", i);
  printf ("%ld", i); /* { dg-warning "format" "printf" } */
  printf ("%ld", i); /* { dg-warning "format" "printf" } */
  /* The "unlocked" functions shouldn't warn in c90 mode.  */
  /* The "unlocked" functions shouldn't warn in c90 mode.  */
  fprintf_unlocked (stdout, "%ld", i);
  fprintf_unlocked (stdout, "%ld", i);
  printf_unlocked ("%ld", i);
  printf_unlocked ("%ld", i);
  sprintf (s, "%d", i);
  sprintf (s, "%d", i);
  sprintf (s, "%ld", i); /* { dg-warning "format" "sprintf" } */
  sprintf (s, "%ld", i); /* { dg-warning "format" "sprintf" } */
  vfprintf (stdout, "%d", v0);
  vfprintf (stdout, "%d", v0);
  vfprintf (stdout, "%Y", v1); /* { dg-warning "format" "vfprintf" } */
  vfprintf (stdout, "%Y", v1); /* { dg-warning "format" "vfprintf" } */
  vprintf ("%d", v2);
  vprintf ("%d", v2);
  vprintf ("%Y", v3); /* { dg-warning "format" "vprintf" } */
  vprintf ("%Y", v3); /* { dg-warning "format" "vprintf" } */
  /* The following used to give a bogus warning.  */
  /* The following used to give a bogus warning.  */
  vprintf ("%*.*d", v8);   /* { dg-bogus "format" "vprintf" } */
  vprintf ("%*.*d", v8);   /* { dg-bogus "format" "vprintf" } */
  vsprintf (s, "%d", v4);
  vsprintf (s, "%d", v4);
  vsprintf (s, "%Y", v5); /* { dg-warning "format" "Y is invalid" } */
  vsprintf (s, "%Y", v5); /* { dg-warning "format" "Y is invalid" } */
  snprintf (s, n, "%d", i);
  snprintf (s, n, "%d", i);
  snprintf (s, n, "%ld", i);
  snprintf (s, n, "%ld", i);
  vsnprintf (s, n, "%d", v6);
  vsnprintf (s, n, "%d", v6);
  vsnprintf (s, n, "%Y", v7);
  vsnprintf (s, n, "%Y", v7);
  printf (gettext ("%d"), i);
  printf (gettext ("%d"), i);
  printf (gettext ("%ld"), i);
  printf (gettext ("%ld"), i);
  printf (dgettext ("", "%d"), i);
  printf (dgettext ("", "%d"), i);
  printf (dgettext ("", "%ld"), i);
  printf (dgettext ("", "%ld"), i);
  printf (dcgettext ("", "%d", 0), i);
  printf (dcgettext ("", "%d", 0), i);
  printf (dcgettext ("", "%ld", 0), i);
  printf (dcgettext ("", "%ld", 0), i);
}
}
 
 

powered by: WebSVN 2.1.0

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