summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/builtins/fputs-lib.c
blob: c2292a7818ca84740a54d895721264b26a90d793 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
#include <stddef.h>
extern void abort (void);
extern int inside_main;
extern size_t strlen(const char *);
int
fputs(const char *string, FILE *stream)
{
  size_t n = strlen(string);
  size_t r;
#if defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__
  if (inside_main)
    abort();
#endif
  r = fwrite (string, 1, n, stream);
  return n > r ? EOF : 0;
}

/* Locking stdio doesn't matter for the purposes of this test.  */
int
fputs_unlocked(const char *string, FILE *stream)
{
  return fputs (string, stream);
}