summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/format/nonlit-1.c
blob: af0cd372381fd6761c3c8cb43bd5f6cfd7568889 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
/* Test for warnings for non-string-literal formats.  */
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* { dg-do compile } */
/* { dg-options "-std=gnu99 -Wformat -Wformat-nonliteral" } */

#include "format.h"

void
foo (char *s, size_t i)
{
  printf ((const char *)i, i); /* { dg-warning "argument types" "non-literal" } */
  printf (s, i); /* { dg-warning "argument types" "non-literal" } */
}