view gcc/testsuite/gcc.dg/format/builtin-1.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* 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" } */
}