modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/fprintf-1.c (about)

     1  /* { dg-skip-if "requires io" { freestanding } }  */
     2  
     3  #include <stdio.h>
     4  #include <stdlib.h>
     5  
     6  int
     7  main (void)
     8  {
     9  #define test(ret, args...) \
    10    fprintf (stdout, args); 		\
    11    if (fprintf (stdout, args) != ret)	\
    12      abort ();
    13    test (5, "hello");
    14    test (6, "hello\n");
    15    test (1, "a");
    16    test (0, "");
    17    test (5, "%s", "hello");
    18    test (6, "%s", "hello\n");
    19    test (1, "%s", "a");
    20    test (0, "%s", "");
    21    test (1, "%c", 'x');
    22    test (7, "%s\n", "hello\n");
    23    test (2, "%d\n", 0);
    24    return 0;
    25  }