summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/format/builtin-1.c
blob: ba1cab6473a7936aa1e8f1b733496690076fe6fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* Test for format extensions.  Test that the __builtin functions get their
   default attributes even with -ffreestanding.
*/
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* { dg-do compile } */
/* { dg-options "-std=gnu99 -Wformat -ffreestanding" } */

#include "format.h"

void
foo (int i)
{
  __builtin_fprintf (stdout, "%d", i);
  __builtin_fprintf (stdout, "%ld", i); /* { dg-warning "format" "__builtin_fprintf" } */
  __builtin_printf ("%d", i);
  __builtin_printf ("%ld", i); /* { dg-warning "format" "__builtin_printf" } */

  __builtin_fprintf_unlocked (stdout, "%d", i);
  __builtin_fprintf_unlocked (stdout, "%ld", i); /* { dg-warning "format" "__builtin_fprintf_unlocked" } */
  __builtin_printf_unlocked ("%d", i);
  __builtin_printf_unlocked ("%ld", i); /* { dg-warning "format" "__builtin_printf_unlocked" } */
}