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/] [gcc_gfc-1.c] - Blame information for rev 823

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

Line No. Rev Author Line
1 149 jeremybenn
/* Test for gcc_gfc formats.  */
2
/* Origin: Kaveh Ghazi <ghazi@caip.rutgers.edu> */
3
/* { dg-do compile } */
4
/* { dg-options "-Wformat" } */
5
 
6
#include "format.h"
7
 
8
/* Magic identifier must be set before the attribute is used.  */
9
typedef struct locus locus;
10
 
11
extern int gfc_warn (const char *, ...) __attribute__ ((__format__ (__gcc_gfc__, 1, 2))) __attribute__ ((__nonnull__));
12
 
13
void
14
foo (int i, char *s, long int l, llong ll, locus *loc)
15
{
16
  /* Acceptable C90 specifiers, flags and modifiers.  */
17
  gfc_warn ("%%");
18
  gfc_warn ("%d%i%c%s%%", i, i, i, s);
19
 
20
  /* Extensions provided in gfc_warn.  */
21
  gfc_warn ("%C");
22
  gfc_warn ("%L", loc);
23
 
24
  /* Various tests of bad argument types.  */
25
  gfc_warn ("%d", l); /* { dg-warning "format" "bad argument types" } */
26
  gfc_warn ("%d", ll); /* { dg-warning "format" "bad argument types" } */
27
  gfc_warn ("%s", &i); /* { dg-warning "format" "bad argument types" } */
28
  gfc_warn ("%L", &i); /* { dg-warning "format" "bad argument types" } */
29
  gfc_warn ("%C", i); /* { dg-warning "format" "too many arguments" } */
30
}

powered by: WebSVN 2.1.0

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