blob: 2f8c133177c438f073cccd72fe198d2c9c329161 [file] [log] [blame]
#include <stdio.h>
#include <stdarg.h>
extern void abort (void);
extern int inside_main;
int
printf (const char *string, ...)
{
va_list ap;
int r;
#ifdef __OPTIMIZE__
if (inside_main)
abort();
#endif
va_start (ap, string);
r = vprintf (string, ap);
va_end (ap);
return r;
}
/* Locking stdio doesn't matter for the purposes of this test. */
int
printf_unlocked (const char *string, ...)
{
va_list ap;
int r;
#ifdef __OPTIMIZE__
if (inside_main)
abort();
#endif
va_start (ap, string);
r = vprintf (string, ap);
va_end (ap);
return r;
}