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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [format/] [null-1.c] - Blame information for rev 801

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

Line No. Rev Author Line
1 689 jeremybenn
/* Test for some aspects of null format string handling.  */
2
/* Origin: Jason Thorpe <thorpej@wasabisystems.com> */
3
/* { dg-do compile } */
4
/* { dg-options "-std=gnu99 -Wformat" } */
5
 
6
#define DONT_GNU_PROTOTYPE
7
#include "format.h"
8
 
9
extern void my_printf (const char *, ...) __attribute__((format(gnu_attr_printf,1,2)));
10
extern const char *my_format (const char *, const char *)
11
  __attribute__((format_arg(2)));
12
 
13
void
14
foo (int i1)
15
{
16
  /* Warning about a null format string has been decoupled from the actual
17
     format check.  However, we still expect to be warned about any excess
18
     arguments after a null format string.  */
19
  my_printf (NULL);
20
  my_printf (NULL, i1); /* { dg-warning "too many" "null format with arguments" } */
21
 
22
  my_printf (my_format ("", NULL));
23
  my_printf (my_format ("", NULL), i1); /* { dg-warning "too many" "null format_arg with arguments" } */
24
 
25
  /* While my_printf allows a null argument, dgettext does not, so we expect
26
     a null argument warning here.  */
27
  my_printf (dgettext ("", NULL)); /* { dg-warning "null" "null format with dgettext" } */
28
}

powered by: WebSVN 2.1.0

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