Fix various C99+ conformance issues and bugs in test cases.

The main changes made to most tests are:

*Declarations always include explicit types, not relying on implicit int. The declaration of main in most test programs is changed to be "int main (void) {...}", adding an explicit return type and a prototype. (There are still some non-prototyped functions, though.)

*Functions are always declared before use, either by including a header or by providing a declaration for the specific function. The latter approach is usually used for printf, to avoid requiring ORCA/C to process stdio.h when compiling every test case (which might make test runs noticeably slower).

*Make all return statements in non-void functions (e.g. main) return a value.

*Avoid some instances of undefined behavior and type errors in printf and scanf calls.

Several miscellaneous bugs are also fixed.

There are still a couple test cases that intentionally rely on the C89 behavior, to ensure it still works.
This commit is contained in:
Stephen Heumann 2022-10-17 17:50:42 -05:00
parent b3c30b05d8
commit 91d33b586d
389 changed files with 1444 additions and 928 deletions

View File

@ -6,18 +6,18 @@
struct foo {
int i;
const j;
volatile k;
int const j;
volatile int k;
} ;
main ()
int main (void)
{
int i,j;
j = 4;
i = (const) j;
i = (volatile) j;
i = (const int) j;
i = (int volatile) j;
printf ("Passed Conformance Test 11.4.2.1\n");
}

View File

@ -3,9 +3,11 @@
#include <stddef.h>
int printf(const char *, ...);
extended e1 [800];
main ()
int main (void)
{
int i [10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int *i1 = i;
@ -28,7 +30,7 @@ main ()
goto Fail;
printf ("Passed Conformance Test 13.1.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 13.1.0.1\n");

View File

@ -3,7 +3,9 @@
#include <ctype.h>
main ()
int printf(const char *, ...);
int main (void)
{
int i, j;
char ch;
@ -141,7 +143,7 @@ main ()
}
printf ("Passed Conformance Test 14.1.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 14.1.0.1\n");

View File

@ -2,7 +2,9 @@
#include <ctype.h>
main ()
int printf(const char *, ...);
int main (void)
{
int i, j;
char ch;
@ -54,7 +56,7 @@ main ()
goto Fail;
printf ("Passed Conformance Test 14.2.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 14.2.0.1\n");

View File

@ -2,7 +2,9 @@
#include <ctype.h>
main ()
int printf(const char *, ...);
int main (void)
{
int i, j;
char ch;
@ -80,7 +82,7 @@ main ()
printf ("Passed Conformance Test 14.3.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 14.3.0.1\n");

View File

@ -2,7 +2,9 @@
#include <ctype.h>
main ()
int printf(const char *, ...);
int main (void)
{
int i, j;
char ch;
@ -71,7 +73,7 @@ main ()
goto Fail;
printf ("Passed Conformance Test 14.4.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 14.4.0.1\n");

View File

@ -2,7 +2,9 @@
#include <ctype.h>
main ()
int printf(const char *, ...);
int main (void)
{
int i, j;
char ch;
@ -33,7 +35,7 @@ main ()
}
printf ("Passed Conformance Test 14.5.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 14.5.0.1\n");

View File

@ -2,7 +2,9 @@
#include <ctype.h>
main ()
int printf(const char *, ...);
int main (void)
{
int i, j;
char ch;
@ -30,7 +32,7 @@ main ()
}
printf ("Passed Conformance Test 14.6.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 14.6.0.1\n");

View File

@ -2,7 +2,9 @@
#include <ctype.h>
main ()
int printf(const char *, ...);
int main (void)
{
int i, j;
char ch;
@ -67,7 +69,7 @@ main ()
printf ("Passed Conformance Test 14.7.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 14.7.0.1\n");

View File

@ -3,7 +3,7 @@
#include <ctype.h>
#include <stdio.h>
main ()
int main (void)
{
int i, j;
char ch;
@ -42,7 +42,7 @@ main ()
}
printf ("Passed Conformance Test 14.8.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 14.8.0.1\n");

View File

@ -3,7 +3,9 @@
#include <ctype.h>
main ()
int printf(const char *, ...);
int main (void)
{
int i, j;
char ch;
@ -53,7 +55,7 @@ main ()
printf ("Passed Conformance Test 14.9.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 14.9.0.1\n");

View File

@ -2,7 +2,9 @@
#include <string.h>
main ()
int printf(const char *, ...);
int main (void)
{
char s1 [80] = "this is the first string argument";
char s2 [80] = ", and this is the second string argument!";
@ -38,7 +40,7 @@ second string argument!"))
printf ("Passed Conformance Test 15.1.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 15.1.0.1\n");

View File

@ -2,7 +2,9 @@
#include <string.h>
main ()
int printf(const char *, ...);
int main (void)
{
int i;
@ -32,7 +34,7 @@ main ()
goto Fail;
printf ("Passed Conformance Test 15.2.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 15.2.0.1\n");

View File

@ -3,7 +3,9 @@
#include <stddef.h>
#include <string.h>
main ()
int printf(const char *, ...);
int main (void)
{
char s1 [80] = "this is the first string argument";
char s2 [80] = ", and this is the second string argument!";
@ -32,7 +34,7 @@ main ()
printf ("Passed Conformance Test 15.3.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 15.3.0.1\n");

View File

@ -4,7 +4,9 @@
#include <stddef.h>
#include <string.h>
main ()
int printf(const char *, ...);
int main (void)
{
char s1 [80] = "this is the first string argument";
char *strPtr;
@ -55,7 +57,7 @@ main ()
goto Fail;
printf ("Passed Conformance Test 15.5.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 15.5.0.1\n");

View File

@ -4,7 +4,9 @@
#include <stddef.h>
#include <string.h>
main ()
int printf(const char *, ...);
int main (void)
{
char s1 [80] = "a b c d e f g h i j k : ' - _ + ";
char *strPtr;
@ -72,7 +74,7 @@ main ()
printf ("Passed Conformance Test 15.6.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 15.6.0.1\n");

View File

@ -3,7 +3,9 @@
#include <stddef.h>
#include <string.h>
main ()
int printf(const char *, ...);
int main (void)
{
char string [] = " this is the source string, a source string";
char *strPtr;
@ -18,7 +20,7 @@ main ()
goto Fail;
printf ("Passed Conformance Test 15.7.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 15.7.0.1\n");

View File

@ -3,7 +3,9 @@
#include <stddef.h>
#include <string.h>
main ()
int printf(const char *, ...);
int main (void)
{
char string [] = " this is the source string, so creative! oh, yes";
char *strPtr;
@ -99,7 +101,7 @@ main ()
printf ("Passed Conformance Test 15.7.0.2\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 15.7.0.2\n");

View File

@ -4,7 +4,9 @@
#include <math.h>
#include <errno.h>
main ()
int printf(const char *, ...);
int main (void)
{
double d1;
char string [] = " -32767 0567 -3.4e+2 ";
@ -30,7 +32,7 @@ main ()
goto Fail;
printf ("Passed Conformance Test 15.8.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 15.8.0.1\n");

View File

@ -6,7 +6,7 @@
#include <string.h>
#include <stdio.h>
void main (void)
int main (void)
{
long L1;
unsigned long UL1;
@ -60,7 +60,7 @@ void main (void)
goto Fail;
printf ("Passed Conformance Test 15.8.0.2\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 15.8.0.2\n");

View File

@ -2,7 +2,9 @@
#include <stdlib.h>
main ()
int printf(const char *, ...);
int main (void)
{
double d1;
int i;
@ -22,7 +24,7 @@ main ()
goto Fail;
printf ("Passed Conformance Test 15.9.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 15.9.0.1\n");

View File

@ -5,7 +5,9 @@
#include <string.h>
#include <stdlib.h>
main ()
int printf(const char *, ...);
int main (void)
{
int i;
char *rgn, *ptr1;
@ -37,7 +39,7 @@ main ()
if (ptr1 != string+14)
goto Fail;
ptr1 = (char *) (memchr (string, 'Z', 88));
ptr1 = (char *) (memchr (string, 'Z', sizeof(string)));
if (ptr1 != NULL)
goto Fail;
@ -56,13 +58,13 @@ main ()
printf ("Passed Conformance Test 16.1.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 16.1.0.1\n");
return;
return 0;
Fail1:
printf ("Unable to allocate memory for Conformance Test 16.1.0.1\n");
return;
return 0;
}

View File

@ -4,7 +4,9 @@
#include <string.h>
#include <stdlib.h>
main ()
int printf(const char *, ...);
int main (void)
{
char *rgn, *ptr1;
@ -17,20 +19,20 @@ main ()
if (ptr1 != rgn)
goto Fail;
for (; rgn != ptr1; rgn++)
for (; rgn != ptr1 + 1024; rgn++)
if (*rgn != 'a')
goto Fail;
free (rgn);
free (ptr1);
printf ("Passed Conformance Test 16.4.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 16.4.0.1\n");
return;
return 0;
Fail1:
printf ("Unable to allocate memory for Conformance Test 16.4.0.1\n");
return;
return 0;
}

View File

@ -1,8 +1,9 @@
/* Conformance Test 17.10.0.1: Verification of fputs and puts */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
FILE *f1;
int i,j;
@ -53,21 +54,21 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.10.0.1\n");
return;
return 0;
Fail:
fprintf (stderr, "Failed Conformance Test 17.10.0.1\n");
return;
return 0;
Fail1:
fprintf (stderr, "Unable to open input file for Conformance Test 17.10.0.1\n");
return;
return 0;
Fail2:
fprintf (stderr, "Unable to close input file for Conformance Test 17.10.0.1\n");
return;
return 0;
Fail3:
fprintf (stderr, "Unable to redirect stdout for Conformance Test 17.10.0.1\n");
return;
return 0;
}

View File

@ -4,7 +4,7 @@
#include <string.h>
#include <stdio.h>
main ()
int main (void)
{
FILE *f1;
short i1;
@ -78,25 +78,25 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.11.0.1\n");
return;
return 0;
Fail:
fprintf (stderr, "Failed Conformance Test 17.11.0.1\n");
return;
return 0;
Fail1:
fprintf (stderr, "Unable to open output file for Conformance Test 17.11.0.1\n");
return;
return 0;
Fail2:
fprintf (stderr, "Unable to close output file for Conformance Test 17.11.0.1\n");
return;
return 0;
Fail3:
fprintf (stderr, "Unable to read output file for Conformance Test 17.11.0.1\n");
return;
return 0;
Fail4:
fprintf (stderr, "Unable to redirect stdout for Conformance Test 17.11.0.1\n");
return;
return 0;
}

View File

@ -2,8 +2,9 @@
/* g,G format codes */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
FILE *f1;
int i;
@ -75,25 +76,25 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.11.0.10\n");
return;
return 0;
Fail:
fprintf (stderr, "Failed Conformance Test 17.11.0.10\n");
return;
return 0;
Fail1:
fprintf (stderr, "Unable to open output file for Conformance Test 17.11.0.10\n");
return;
return 0;
Fail2:
fprintf (stderr, "Unable to close output file for Conformance Test 17.11.0.10\n");
return;
return 0;
Fail3:
fprintf (stderr, "Unable to read output file for Conformance Test 17.11.0.10\n");
return;
return 0;
Fail4:
fprintf (stderr, "Unable to redirect stdout for Conformance Test 17.11.0.10\n");
return;
return 0;
}

View File

@ -2,8 +2,9 @@
/* n and % format codes */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
FILE *f1;
int i, i1, i2;
@ -30,21 +31,21 @@ main ()
/* Write formatted output as string to the output files and sstring. */
i = fprintf (f1, "%% %hn %0+*.*le %s %% %ln N\n", &sh, i1, i2, e1,
i = fprintf (f1, "%% %hn %0+*.*Le %s %% %ln N\n", &sh, i1, i2, e1,
"a string", &l1);
if (i != 48)
goto Fail;
if ((sh != 3) || (l1 != 44)) /* check return values for n format */
goto Fail;
i = printf ("%% %hn %0+*.*le %s %% %ln N\n", &sh, i1, i2, e1,
i = printf ("%% %hn %0+*.*Le %s %% %ln N\n", &sh, i1, i2, e1,
"a string", &l1);
if (i != 48)
goto Fail;
if ((sh != 3) || (l1 != 44)) /* check return values for n format */
goto Fail;
i = sprintf (sstring, "%% %hn %0+*.*le %s %% %ln N\n", &sh, i1, i2, e1,
i = sprintf (sstring, "%% %hn %0+*.*Le %s %% %ln N\n", &sh, i1, i2, e1,
"a string", &l1);
if (i != 48)
goto Fail;
@ -81,25 +82,25 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.11.0.11\n");
return;
return 0;
Fail:
fprintf (stderr, "Failed Conformance Test 17.11.0.11\n");
return;
return 0;
Fail1:
fprintf (stderr, "Unable to open output file for Conformance Test 17.11.0.11\n");
return;
return 0;
Fail2:
fprintf (stderr, "Unable to close output file for Conformance Test 17.11.0.11\n");
return;
return 0;
Fail3:
fprintf (stderr, "Unable to read output file for Conformance Test 17.11.0.11\n");
return;
return 0;
Fail4:
fprintf (stderr, "Unable to redirect stdout for Conformance Test 17.11.0.11\n");
return;
return 0;
}

View File

@ -2,8 +2,9 @@
/* u format code */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
FILE *f1;
int i, i1, i2;
@ -76,28 +77,28 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.11.0.2\n");
return;
return 0;
Fail:
fprintf (stderr, "Failed Conformance Test 17.11.0.2\n");
return;
return 0;
Fail1:
fprintf (stderr,
"Unable to open output file for Conformance Test 17.11.0.2\n");
return;
return 0;
Fail2:
fprintf (stderr, "Unable to close output file for Conformance Test 17.11.0.2\n");
return;
return 0;
Fail3:
fprintf (stderr,
"Unable to read output file for Conformance Test 17.11.0.2\n");
return;
return 0;
Fail4:
fprintf (stderr,
"Unable to redirect stdout for Conformance Test 17.11.0.2\n");
return;
return 0;
}

View File

@ -2,8 +2,9 @@
/* o format code */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
FILE *f1;
int i, i1, i2;
@ -75,25 +76,25 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.11.0.3\n");
return;
return 0;
Fail:
fprintf (stderr, "Failed Conformance Test 17.11.0.3\n");
return;
return 0;
Fail1:
fprintf (stderr, "Unable to open output file for Conformance Test 17.11.0.3\n");
return;
return 0;
Fail2:
fprintf (stderr, "Unable to close output file for Conformance Test 17.11.0.3\n");
return;
return 0;
Fail3:
fprintf (stderr, "Unable to read output file for Conformance Test 17.11.0.3\n");
return;
return 0;
Fail4:
fprintf (stderr, "Unable to redirect stdout for Conformance Test 17.11.0.3\n");
return;
return 0;
}

View File

@ -2,8 +2,9 @@
/* x,X format codes */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
FILE *f1;
int i, i1, i2;
@ -75,25 +76,25 @@ if (strcmp (sstring, " 0x000000ffff 0X0000FFFF 00ffffffff C\n"))
goto Fail2;
printf ("Passed Conformance Test 17.11.0.4\n");
return;
return 0;
Fail:
fprintf (stderr, "Failed Conformance Test 17.11.0.4\n");
return;
return 0;
Fail1:
fprintf (stderr, "Unable to open output file for Conformance Test 17.11.0.4\n");
return;
return 0;
Fail2:
fprintf (stderr, "Unable to close output file for Conformance Test 17.11.0.4\n");
return;
return 0;
Fail3:
fprintf (stderr, "Unable to read output file for Conformance Test 17.11.0.4\n");
return;
return 0;
Fail4:
fprintf (stderr, "Unable to redirect stdout for Conformance Test 17.11.0.4\n");
return;
return 0;
}

View File

@ -2,8 +2,9 @@
/* c format code */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
FILE *f1;
int i, i1, i2;
@ -28,18 +29,18 @@ main ()
/* Write formatted output as string to the output file. */
i = fprintf (f1, " %#+ -010.10c %05.7hc %.6lc %+ *.*lc D\n",
ui1, ui1, ui2, i1, i2, 'd');
i = fprintf (f1, " %+ -10c %5c %c %+ *c D\n",
ui1, ui1, ui2, i1, 'd');
if (i != 30)
goto Fail;
i = printf (" %#+ -010.10c %05.7hc %.6lc %+ *.*lc D\n",
ui1, ui1, ui2, i1, i2, 'd');
i = printf (" %+ -10c %5c %c %+ *c D\n",
ui1, ui1, ui2, i1, 'd');
if (i != 30)
goto Fail;
i = sprintf (sstring, " %#+ -010.10c %05.7hc %.6lc %+ *.*lc D\n",
ui1, ui1, ui2, i1, i2, 'd');
i = sprintf (sstring, " %+ -10c %5c %c %+ *c D\n",
ui1, ui1, ui2, i1, 'd');
if (i != 30)
goto Fail;
@ -73,25 +74,25 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.11.0.5\n");
return;
return 0;
Fail:
fprintf (stderr, "Failed Conformance Test 17.11.0.5\n");
return;
return 0;
Fail1:
fprintf (stderr, "Unable to open output file for Conformance Test 17.11.0.5\n");
return;
return 0;
Fail2:
fprintf (stderr, "Unable to close output file for Conformance Test 17.11.0.5\n");
return;
return 0;
Fail3:
fprintf (stderr, "Unable to read output file for Conformance Test 17.11.0.5\n");
return;
return 0;
Fail4:
fprintf (stderr, "Unable to redirect stdout for Conformance Test 17.11.0.5\n");
return;
return 0;
}

View File

@ -2,8 +2,9 @@
/* s format code */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
FILE *f1;
int i, j, k;
@ -27,17 +28,17 @@ main ()
/* Write formatted output as string to the output files and sstring. */
i = fprintf (f1, " %#+ -10.10s %015.7hs %*.*s %s E\n",
i = fprintf (f1, " %+ -10.10s %15.7s %*.*s %s E\n",
arg1, arg1, j, k, arg2, "very short string");
if (i != 77)
goto Fail;
i = printf (" %#+ -10.10s %015.7hs %*.*s %s E\n",
i = printf (" %+ -10.10s %15.7s %*.*s %s E\n",
arg1, arg1, j, k, arg2, "very short string");
if (i != 77)
goto Fail;
i = sprintf (sstring, " %#+ -10.10s %015.7hs %*.*s %s E\n",
i = sprintf (sstring, " %+ -10.10s %15.7s %*.*s %s E\n",
arg1, arg1, j, k, arg2, "very short string");
if (i != 77)
goto Fail;
@ -75,25 +76,25 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.11.0.6\n");
return;
return 0;
Fail:
fprintf (stderr, "Failed Conformance Test 17.11.0.6\n");
return;
return 0;
Fail1:
fprintf (stderr, "Unable to open output file for Conformance Test 17.11.0.6\n");
return;
return 0;
Fail2:
fprintf (stderr, "Unable to close output file for Conformance Test 17.11.0.6\n");
return;
return 0;
Fail3:
fprintf (stderr, "Unable to read output file for Conformance Test 17.11.0.6\n");
return;
return 0;
Fail4:
fprintf (stderr, "Unable to redirect stdout for Conformance Test 17.11.0.6\n");
return;
return 0;
}

View File

@ -2,8 +2,9 @@
/* p format code */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
FILE *f1;
int i, j, k;
@ -27,17 +28,17 @@ main ()
/* Write formatted output as string to the output file. */
i = fprintf (f1, " %#+ -10.10b %015.7hb %*.*b %b E\n",
i = fprintf (f1, " %#+ -10.10b %015.7b %*.*b %b E\n",
arg1, arg1, j, k, arg2, "\pvery short string");
if (i != 77)
goto Fail;
i = printf (" %#+ -10.10b %015.7hb %*.*b %b E\n",
i = printf (" %#+ -10.10b %015.7b %*.*b %b E\n",
arg1, arg1, j, k, arg2, "\pvery short string");
if (i != 77)
goto Fail;
i = sprintf (sstring, " %#+ -10.10b %015.7hb %*.*b %b E\n",
i = sprintf (sstring, " %#+ -10.10b %015.7b %*.*b %b E\n",
arg1, arg1, j, k, arg2, "\pvery short string");
if (i != 77)
goto Fail;
@ -75,25 +76,25 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.11.0.7\n");
return;
return 0;
Fail:
fprintf (stderr, "Failed Conformance Test 17.11.0.7\n");
return;
return 0;
Fail1:
fprintf (stderr, "Unable to open output file for Conformance Test 17.11.0.7\n");
return;
return 0;
Fail2:
fprintf (stderr, "Unable to close output file for Conformance Test 17.11.0.7\n");
return;
return 0;
Fail3:
fprintf (stderr, "Unable to read output file for Conformance Test 17.11.0.7\n");
return;
return 0;
Fail4:
fprintf (stderr, "Unable to redirect stdout for Conformance Test 17.11.0.7\n");
return;
return 0;
}

View File

@ -2,8 +2,9 @@
/* f format code */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
FILE *f1;
int i;
@ -31,15 +32,15 @@ main ()
/* Write formatted output as string to the output files and sstring. */
i = fprintf (f1, " %# +012.7f %+-8.f %# 011lf T\n", d1, fl1, e1);
i = fprintf (f1, " %# +012.7f %+-8.f %# 011Lf T\n", d1, fl1, e1);
if (i != 40)
goto Fail;
i = printf (" %# +012.7f %+-8.f %# 011lf T\n", d1, fl1, e1);
i = printf (" %# +012.7f %+-8.f %# 011Lf T\n", d1, fl1, e1);
if (i != 40)
goto Fail;
i = sprintf (sstring, " %# +012.7f %+-8.f %# 011lf T\n", d1, fl1, e1);
i = sprintf (sstring, " %# +012.7f %+-8.f %# 011Lf T\n", d1, fl1, e1);
if (i != 40)
goto Fail;
@ -73,25 +74,25 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.11.0.8\n");
return;
return 0;
Fail:
fprintf (stderr, "Failed Conformance Test 17.11.0.8\n");
return;
return 0;
Fail1:
fprintf (stderr, "Unable to open output file for Conformance Test 17.11.0.8\n");
return;
return 0;
Fail2:
fprintf (stderr, "Unable to close output file for Conformance Test 17.11.0.8\n");
return;
return 0;
Fail3:
fprintf (stderr, "Unable to read output file for Conformance Test 17.11.0.8\n");
return;
return 0;
Fail4:
fprintf (stderr, "Unable to redirect stdout for Conformance Test 17.11.0.8\n");
return;
return 0;
}

View File

@ -2,8 +2,9 @@
/* e, E format codes */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
FILE *f1;
int i;
@ -33,15 +34,15 @@ main ()
/* Write formatted output as string to the output files and sstring. */
i = fprintf (f1, " %0+*.*le %- 15E %#0 .e E\n", i1, i2, e1, d1, fl1);
i = fprintf (f1, " %0+*.*Le %- 15E %#0 .e E\n", i1, i2, e1, d1, fl1);
if (i != 54)
goto Fail;
i = printf (" %0+*.*le %- 15E %#0 .e E\n", i1, i2, e1, d1, fl1);
i = printf (" %0+*.*Le %- 15E %#0 .e E\n", i1, i2, e1, d1, fl1);
if (i != 54)
goto Fail;
i = sprintf (sstring, " %0+*.*le %- 15E %#0 .e E\n", i1, i2, e1, d1, fl1);
i = sprintf (sstring, " %0+*.*Le %- 15E %#0 .e E\n", i1, i2, e1, d1, fl1);
if (i != 54)
goto Fail;
@ -75,25 +76,25 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.11.0.9\n");
return;
return 0;
Fail:
fprintf (stderr, "Failed Conformance Test 17.11.0.9\n");
return;
return 0;
Fail1:
fprintf (stderr, "Unable to open output file for Conformance Test 17.11.0.9\n");
return;
return 0;
Fail2:
fprintf (stderr, "Unable to close output file for Conformance Test 17.11.0.9\n");
return;
return 0;
Fail3:
fprintf (stderr, "Unable to read output file for Conformance Test 17.11.0.9\n");
return;
return 0;
Fail4:
fprintf (stderr, "Unable to redirect stdout for Conformance Test 17.11.0.9\n");
return;
return 0;
}

View File

@ -7,7 +7,7 @@ struct S { int i;
float f;
char c; };
main ()
int main (void)
{
struct S s [3] = { 1, 1.0, 'a', 2, 2.0, 'b', 3, 3.0, 'c' };
struct S buff [3];
@ -61,17 +61,17 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.13.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.13.0.1\n");
return;
return 0;
Fail1:
printf ("Unable to open temp file for Conformance Test 17.13.0.1\n");
return;
return 0;
Fail2:
printf ("Unable to close output file for Conformance Test 17.13.0.1\n");
return;
return 0;
}

View File

@ -6,7 +6,7 @@ struct S { int i;
float f;
char c; };
main ()
int main (void)
{
struct S s [3] = { 1, 1.0, 'a', 2, 2.0, 'b', 3, 3.0, 'c' };
struct S buff [3];
@ -47,17 +47,17 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.14.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.14.0.1\n");
return;
return 0;
Fail1:
printf ("Unable to open temp file for Conformance Test 17.14.0.1\n");
return;
return 0;
Fail2:
printf ("Unable to close output file for Conformance Test 17.14.0.1\n");
return;
return 0;
}

View File

@ -6,7 +6,7 @@ struct S { int i;
float f;
char c; };
main ()
int main (void)
{
struct S s [3] = { 1, 1.0, 'a', 2, 2.0, 'b', 3, 3.0, 'c' };
struct S buff [3];
@ -38,17 +38,17 @@ main ()
goto Fail;
printf ("Passed Conformance Test 17.15.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.15.0.1\n");
return;
return 0;
Fail1:
printf ("Unable to open temp file for Conformance Test 17.15.0.1\n");
return;
return 0;
Fail2:
printf ("Unable to close output file for Conformance Test 17.15.0.1\n");
return;
return 0;
}

View File

@ -6,7 +6,7 @@ struct S { int i;
float f;
char c; };
main ()
int main (void)
{
struct S s [3] = { 1, 1.0, 'a', 2, 2.0, 'b', 3, 3.0, 'c' };
struct S buff [3];
@ -87,17 +87,17 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.16.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.16.0.1\n");
return;
return 0;
Fail1:
printf ("Unable to open temp file for Conformance Test 17.16.0.1\n");
return;
return 0;
Fail2:
printf ("Unable to close output file for Conformance Test 17.16.0.1\n");
return;
return 0;
}

View File

@ -2,7 +2,7 @@
#include <stdio.h>
main ()
int main (void)
{
FILE *f1; /* file pointer */
int i, j, k, m;
@ -88,25 +88,25 @@ main ()
goto Fail4;
printf ("Passed Conformance Test 17.5.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.5.0.1\n");
return;
return 0;
Fail1:
printf ("Could not open tmp file for Conformance Test 17.5.0.1\n");
return;
return 0;
Fail2:
printf ("Could not write to file for Conformance Test 17.5.0.1\n");