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");
return;
return 0;
Fail3:
printf ("Error while reading file for Conformance Test 17.5.0.1\n");
return;
return 0;
Fail4:
printf ("Could not close file for Conformance Test 17.5.0.1\n");
return;
return 0;
}

View File

@ -2,8 +2,9 @@
/* functions for text files */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
FILE *f1; /* file pointer */
int i, j, m;
@ -44,7 +45,7 @@ main ()
j = fseek (f1, 0L, SEEK_END);
if (j)
goto Fail;
j = fscanf (f1, "%c", &m);
j = fscanf (f1, "%c", (char*)&m);
if (j != EOF)
goto Fail3;
@ -108,25 +109,25 @@ main ()
goto Fail4;
printf ("Passed Conformance Test 17.5.0.2\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.5.0.2\n");
return;
return 0;
Fail1:
printf ("Could not open tmp file for Conformance Test 17.5.0.2\n");
return;
return 0;
Fail2:
printf ("Could not write to file for Conformance Test 17.5.0.2\n");
return;
return 0;
Fail3:
printf ("Error while reading file for Conformance Test 17.5.0.2\n");
return;
return 0;
Fail4:
printf ("Could not close file for Conformance Test 17.5.0.2\n");
return;
return 0;
}

View File

@ -3,7 +3,7 @@
#include <stdio.h>
main ()
int main (void)
{
FILE *f1;
int i, j;
@ -84,25 +84,25 @@ main ()
goto Fail4;
printf ("Passed Conformance Test 17.6.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.6.0.1\n");
return;
return 0;
Fail1:
printf ("Unable to open temp file for Conformance Test 17.6.0.1\n");
return;
return 0;
Fail2:
printf ("Unable to write to temp file for Conformance Test 17.6.0.1\n");
return;
return 0;
Fail3:
printf ("Unable to seek to temp file for Conformance Test 17.6.0.1\n");
return;
return 0;
Fail4:
printf ("Unable to close temp file for Conformance Test 17.6.0.1\n");
return;
return 0;
}

View File

@ -3,7 +3,7 @@
#include <stdio.h>
main ()
int main (void)
{
FILE *f1;
int i, j;
@ -53,25 +53,25 @@ main ()
goto Fail4;
printf ("Passed Conformance Test 17.6.0.2\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.6.0.2\n");
return;
return 0;
Fail1:
printf ("Unable to open temp file for Conformance Test 17.6.0.2\n");
return;
return 0;
Fail2:
printf ("Unable to write to temp file for Conformance Test 17.6.0.2\n");
return;
return 0;
Fail3:
printf ("Unable to seek to temp file for Conformance Test 17.6.0.2\n");
return;
return 0;
Fail4:
printf ("Unable to close temp file for Conformance Test 17.6.0.2\n");
return;
return 0;
}

View File

@ -1,8 +1,9 @@
/* Conformance Test 17.7.0.1: Verification of fgets function, text stream */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
FILE *f1;
int i;
@ -60,21 +61,21 @@ main ()
goto Fail3;
printf ("Passed Conformance Test 17.7.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.7.0.1\n");
return;
return 0;
Fail1:
printf ("Unable to open temp file for Conformance Test 17.7.0.1\n");
return;
return 0;
Fail2:
printf ("Unable to write to temp file for Conformance Test 17.7.0.1\n");
return;
return 0;
Fail3:
printf ("Unable to close temp file for Conformance Test 17.7.0.1\n");
return;
return 0;
}

View File

@ -1,8 +1,9 @@
/* Conformance Test 17.7.0.2: Verification of fgets function, binary stream */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
FILE *f1;
int i;
@ -60,21 +61,21 @@ main ()
goto Fail3;
printf ("Passed Conformance Test 17.7.0.2\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.7.0.2\n");
return;
return 0;
Fail1:
printf ("Unable to open temp file for Conformance Test 17.7.0.2\n");
return;
return 0;
Fail2:
printf ("Unable to write to temp file for Conformance Test 17.7.0.2\n");
return;
return 0;
Fail3:
printf ("Unable to close temp file for Conformance Test 17.7.0.2\n");
return;
return 0;
}

View File

@ -2,7 +2,7 @@
#include <stdio.h>
main ()
int main (void)
{
FILE *f1;
short i1, i3;
@ -74,17 +74,17 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.8.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.1\n");
return;
return 0;
Fail1:
printf ("Unable to open input file for Conformance Test 17.8.0.1\n");
return;
return 0;
Fail2:
printf ("Unable to close input file for Conformance Test 17.8.0.1\n");
return;
return 0;
}

View File

@ -2,7 +2,7 @@
#include <stdio.h>
main ()
int main (void)
{
char string [] = " 327678 D 4294967295m 32767722 ";
int i;
@ -37,9 +37,9 @@ main ()
goto Fail;
printf ("Passed Conformance Test 17.8.0.10\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.10\n");
return;
return 0;
}

View File

@ -2,7 +2,7 @@
#include <stdio.h>
main ()
int main (void)
{
char string [] = " 777778 D 37777777777m 117777526 ";
int i;
@ -37,9 +37,9 @@ main ()
goto Fail;
printf ("Passed Conformance Test 17.8.0.11\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.11\n");
return;
return 0;
}

View File

@ -2,7 +2,7 @@
#include <stdio.h>
main ()
int main (void)
{
char string [] = " 327678 0x0 D 0xFFFFFFFFm 0x7fEd0X10 ";
int i;
@ -39,9 +39,9 @@ main ()
goto Fail;
printf ("Passed Conformance Test 17.8.0.12\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.12\n");
return;
return 0;
}

View File

@ -3,7 +3,7 @@
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
char sstr [] = "bten chars!andMore";
int i;
@ -11,22 +11,22 @@ main ()
ch = 'a'; /* no assignment should be made */
i = sscanf (sstr, "%*hc"); /* h ignored */
i = sscanf (sstr, "%*c");
if (i != 0)
goto Fail;
if (ch != 'a')
goto Fail;
i = sscanf (&sstr [1], "%10lc", string); /* test assignment to string*/
if (i != 1) /* l ignored */
i = sscanf (&sstr [1], "%10c", string); /* test assignment to string*/
if (i != 1)
goto Fail;
if (strncmp (string, "ten chars!", 10))
goto Fail;
printf ("Passed Conformance Test 17.8.0.13\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.13\n");
return;
return 0;
}

View File

@ -1,30 +1,31 @@
/* Conformance Test 17.8.0.14: Verification of sscanf, s format code */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
char sstr [] = " oneLongWord ten-chars!andMore";
int i, j;
char string [50] = "hey, hey!";
i = sscanf (&sstr[0], "%*hs"); /* no assignment made; h ignored */
i = sscanf (&sstr[0], "%*s"); /* no assignment made */
if (i != 0)
goto Fail;
if (strcmp (string, "hey, hey!"))
goto Fail;
i = sscanf (&sstr [14], "%10ls", string); /* test assignment to string*/
if (i != 1) /* l ignored */
i = sscanf (&sstr [14], "%10s", string); /* test assignment to string*/
if (i != 1)
goto Fail;
if (strcmp (string, "ten-chars!"))
goto Fail;
printf ("Passed Conformance Test 17.8.0.14\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.14\n");
return;
return 0;
}

View File

@ -3,7 +3,7 @@
#include <stdio.h>
#include <math.h>
main ()
int main (void)
{
char sstr [] = " 23 -3.8E20 - e- +25e- 00002.00008e000049.9 ";
float f1, f2, f3, f4;
@ -27,9 +27,9 @@ main ()
goto Fail;
printf ("Passed Conformance Test 17.8.0.15\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.15\n");
return;
return 0;
}

View File

@ -1,8 +1,9 @@
/* Conformance Test 17.8.0.16: Verification of sscanf, % and [ format codes */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
char sstr [] = "% these are the ^only[ characters"
"*aaabbb a fine mess, you see! ddddfffffffff";
@ -10,34 +11,34 @@ main ()
char string [2] [50] = { {"hey, hey!"}, {"you, you"} };
i = sscanf (&sstr[0], "%*50h%"); /* no assignment made; * 50 h ignored */
i = sscanf (&sstr[0], "%%"); /* no assignment made */
if (i != 0)
goto Fail;
/* Create set of characters which can appear in the output string. */
i = sscanf (&sstr [1], "%45[thes aronlyc^[] %*[*ab]", &string [0]);
i = sscanf (&sstr [1], "%45[thes aronlyc^[] %*[*ab]", string [0]);
if (i != 1)
goto Fail;
if (strcmp (&string [0], " these are the ^only[ characters"))
if (strcmp (string [0], " these are the ^only[ characters"))
goto Fail;
/* Create set of characters which cannot appear in the output string. */
i = sscanf (&sstr [42], "%[^d] %10[df]", &string [0], &string [1]);
i = sscanf (&sstr [42], "%[^d] %10[df]", string [0], string [1]);
if (i != 2)
goto Fail;
if (strcmp (&string [0], " a fine mess, you see! "))
if (strcmp (string [0], " a fine mess, you see! "))
goto Fail;
if (strcmp (&string [1], "ddddffffff"))
if (strcmp (string [1], "ddddffffff"))
goto Fail;
printf ("Passed Conformance Test 17.8.0.16\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.16\n");
return;
return 0;
}

View File

@ -2,7 +2,7 @@
#include <stdio.h>
main ()
int main (void)
{
short i1, i3;
int i;
@ -79,13 +79,13 @@ main ()
goto Fail1;
printf ("Passed Conformance Test 17.8.0.17\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.17\n");
return;
return 0;
Fail1:
printf ("Unable to redirect stdin for Conformance Test 17.8.0.17\n");
return;
return 0;
}

View File

@ -2,7 +2,7 @@
#include <stdio.h>
main ()
int main (void)
{
int i;
unsigned short us1;
@ -53,13 +53,13 @@ main ()
goto Fail1;
printf ("Passed Conformance Test 17.8.0.18\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.18\n");
return;
return 0;
Fail1:
printf ("Unable to redirect stdin for Conformance Test 17.8.0.18\n");
return;
return 0;
}

View File

@ -2,7 +2,7 @@
#include <stdio.h>
main ()
int main (void)
{
int i;
unsigned short us1;
@ -53,13 +53,13 @@ main ()
goto Fail1;
printf ("Passed Conformance Test 17.8.0.19\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.19\n");
return;
return 0;
Fail1:
printf ("Unable to redirect stdin for Conformance Test 17.8.0.19\n");
return;
return 0;
}

View File

@ -2,7 +2,7 @@
#include <stdio.h>
main ()
int main (void)
{
FILE *f1;
int i;
@ -47,17 +47,17 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.8.0.2\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.2\n");
return;
return 0;
Fail1:
printf ("Unable to open input file for Conformance Test 17.8.0.2\n");
return;
return 0;
Fail2:
printf ("Unable to close input file for Conformance Test 17.8.0.2\n");
return;
return 0;
}

View File

@ -2,7 +2,7 @@
#include <stdio.h>
main ()
int main (void)
{
int i;
unsigned short us1;
@ -55,13 +55,13 @@ main ()
goto Fail1;
printf ("Passed Conformance Test 17.8.0.20\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.20\n");
return;
return 0;
Fail1:
printf ("Unable to redirect stdin for Conformance Test 17.8.0.20\n");
return;
return 0;
}

View File

@ -3,7 +3,7 @@
#include <string.h>
#include <stdio.h>
main ()
int main (void)
{
FILE *f1;
int i;
@ -23,14 +23,14 @@ main ()
goto Fail1;
ch = 'a'; /* no assignment should be made */
i = scanf ("%*hc"); /* h ignored */
i = scanf ("%*c");
if (i != 0)
goto Fail;
if (ch != 'a')
goto Fail;
i = scanf ("%10lc", string); /* test assignment to string*/
if (i != 1) /* l ignored */
i = scanf ("%10c", string); /* test assignment to string*/
if (i != 1)
goto Fail;
if (strncmp (string, "ten chars!", 10))
goto Fail;
@ -40,13 +40,13 @@ main ()
goto Fail1;
printf ("Passed Conformance Test 17.8.0.21\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.21\n");
return;
return 0;
Fail1:
printf ("Unable to redirect stdin for Conformance Test 17.8.0.21\n");
return;
return 0;
}

View File

@ -1,8 +1,9 @@
/* Conformance Test 17.8.0.22: Verification of scanf, s format code */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
int i, j;
char string [50] = "hey, hey!";
@ -21,14 +22,14 @@ main ()
if (stdin == NULL)
goto Fail1;
i = scanf ("%*hs"); /* no assignment made; h ignored */
i = scanf ("%*s"); /* no assignment made */
if (i != 0)
goto Fail;
if (strcmp (string, "hey, hey!"))
goto Fail;
i = scanf ("%10ls", string); /* test assignment to string*/
if (i != 1) /* l ignored */
i = scanf ("%10s", string); /* test assignment to string */
if (i != 1)
goto Fail;
if (strcmp (string, "ten_chars!"))
goto Fail;
@ -38,13 +39,13 @@ main ()
goto Fail1;
printf ("Passed Conformance Test 17.8.0.22\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.22\n");
return;
return 0;
Fail1:
printf ("Unable to redirect stdin for Conformance Test 17.8.0.22\n");
return;
return 0;
}

View File

@ -3,7 +3,7 @@
#include <stdio.h>
#include <math.h>
main ()
int main (void)
{
float f1, f2, f3, f4;
double d1, d2, d3;
@ -43,13 +43,13 @@ main ()
goto Fail1;
printf ("Passed Conformance Test 17.8.0.23\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.23\n");
return;
return 0;
Fail1:
printf ("Unable to redirect stdin for Conformance Test 17.8.0.23\n");
return;
return 0;
}

View File

@ -1,8 +1,9 @@
/* Conformance Test 17.8.0.24: Verification of scanf, % and [ format codes */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
int i;
char string [2] [50] = { {"hey, hey!"}, {"you, you"} };
@ -22,26 +23,26 @@ main ()
if (stdin == NULL)
goto Fail1;
i = scanf ("%*50h%"); /* no assignment made; * 50 h ignored */
i = scanf ("%%"); /* no assignment made */
if (i != 0)
goto Fail;
/* Create set of characters which can appear in the output string. */
i = scanf ("%45[thes arohnlyc^[] %*[*ab]", &string [0]);
i = scanf ("%45[thes arohnlyc^[] %*[*ab]", string [0]);
if (i != 1)
goto Fail;
if (strcmp (&string [0], " these are the ^only[ characters"))
if (strcmp (string [0], " these are the ^only[ characters"))
goto Fail;
/* Create set of characters which cannot appear in the output string. */
i = scanf ("%[^d] %10[df]", &string [0], &string [1]);
i = scanf ("%[^d] %10[df]", string [0], string [1]);
if (i != 2)
goto Fail;
if (strcmp (&string [0], " a fine mess, you see! "))
if (strcmp (string [0], " a fine mess, you see! "))
goto Fail;
if (strcmp (&string [1], "ddddffffff"))
if (strcmp (string [1], "ddddffffff"))
goto Fail;
stdin = freopen (".CONSOLE", "r", stdin); /* reset stdin and quit */
@ -49,13 +50,13 @@ main ()
goto Fail1;
printf ("Passed Conformance Test 17.8.0.24\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.24\n");
return;
return 0;
Fail1:
printf ("Unable to open input file for Conformance Test 17.8.0.24\n");
return;
return 0;
}

View File

@ -2,7 +2,7 @@
#include <stdio.h>
main ()
int main (void)
{
FILE *f1;
int i;
@ -47,17 +47,17 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.8.0.3\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.3\n");
return;
return 0;
Fail1:
printf ("Unable to open input file for Conformance Test 17.8.0.3\n");
return;
return 0;
Fail2:
printf ("Unable to close input file for Conformance Test 17.8.0.3\n");
return;
return 0;
}

View File

@ -2,7 +2,7 @@
#include <stdio.h>
main ()
int main (void)
{
FILE *f1;
int i;
@ -49,17 +49,17 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.8.0.4\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.4\n");
return;
return 0;
Fail1:
printf ("Unable to open input file for Conformance Test 17.8.0.4\n");
return;
return 0;
Fail2:
printf ("Unable to close input file for Conformance Test 17.8.0.4\n");
return;
return 0;
}

View File

@ -3,7 +3,7 @@
#include <string.h>
#include <stdio.h>
main ()
int main (void)
{
FILE *f1;
int i;
@ -17,14 +17,14 @@ main ()
rewind(f1);
ch = 'a'; /* no assignment should be made */
i = fscanf (f1, "%*hc"); /* h ignored */
i = fscanf (f1, "%*c");
if (i != 0)
goto Fail;
if (ch != 'a')
goto Fail;
i = fscanf (f1, "%10lc", string); /* test assignment to string*/
if (i != 1) /* l ignored */
i = fscanf (f1, "%10c", string); /* test assignment to string*/
if (i != 1)
goto Fail;
if (strncmp (string, "ten chars!", 10))
goto Fail;
@ -34,17 +34,17 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.8.0.5\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.5\n");
return;
return 0;
Fail1:
printf ("Unable to open input file for Conformance Test 17.8.0.5\n");
return;
return 0;
Fail2:
printf ("Unable to close input file for Conformance Test 17.8.0.5\n");
return;
return 0;
}

View File

@ -1,8 +1,9 @@
/* Conformance Test 17.8.0.6: Verification of fscanf, s format code */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
FILE *f1;
int i, j;
@ -15,14 +16,14 @@ main ()
fprintf(f1, " oneLongWord ten_chars!andMore");
rewind(f1);
i = fscanf (f1, "%*hs"); /* no assignment made; h ignored */
i = fscanf (f1, "%*s"); /* no assignment made */
if (i != 0)
goto Fail;
if (strcmp (string, "hey, hey!"))
goto Fail;
i = fscanf (f1, "%10ls", string); /* test assignment to string*/
if (i != 1) /* l ignored */
i = fscanf (f1, "%10s", string); /* test assignment to string */
if (i != 1)
goto Fail;
if (strcmp (string, "ten_chars!"))
goto Fail;
@ -32,17 +33,17 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.8.0.6\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.6\n");
return;
return 0;
Fail1:
printf ("Unable to open input file for Conformance Test 17.8.0.6\n");
return;
return 0;
Fail2:
printf ("Unable to close input file for Conformance Test 17.8.0.6\n");
return;
return 0;
}

View File

@ -3,7 +3,7 @@
#include <stdio.h>
#include <math.h>
main ()
int main (void)
{
FILE *f;
float f1, f2, f3, f4;
@ -37,17 +37,17 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.8.0.7\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.7\n");
return;
return 0;
Fail1:
printf ("Unable to open input file for Conformance Test 17.8.0.7\n");
return;
return 0;
Fail2:
printf ("Unable to close input file for Conformance Test 17.8.0.7\n");
return;
return 0;
}

View File

@ -1,8 +1,9 @@
/* Conformance Test 17.8.0.8: Verification of fscanf, % and [ format codes */
#include <stdio.h>
#include <string.h>
main ()
int main (void)
{
FILE *f1;
int i;
@ -16,26 +17,26 @@ main ()
"you see! ddddfffffffff");
rewind(f1);
i = fscanf (f1, "%*50h%"); /* no assignment made; * 50 h ignored */
i = fscanf (f1, "%%"); /* no assignment made */
if (i != 0)
goto Fail;
/* Create set of characters which can appear in the output string. */
i = fscanf (f1, "%45[thes aronlyc^[h] %*[*ab]", &string [0]);
i = fscanf (f1, "%45[thes aronlyc^[h] %*[*ab]", string [0]);
if (i != 1)
goto Fail;
if (strcmp (&string [0], " these are the ^only[ characters"))
if (strcmp (string [0], " these are the ^only[ characters"))
goto Fail;
/* Create set of characters which cannot appear in the output string. */
i = fscanf (f1, "%[^d] %10[df]", &string [0], &string [1]);
i = fscanf (f1, "%[^d] %10[df]", string [0], string [1]);
if (i != 2)
goto Fail;
if (strcmp (&string [0], " a fine mess, you see! "))
if (strcmp (string [0], " a fine mess, you see! "))
goto Fail;
if (strcmp (&string [1], "ddddffffff"))
if (strcmp (string [1], "ddddffffff"))
goto Fail;
i = fclose (f1); /* close the file and quit */
@ -43,17 +44,17 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.8.0.8\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.8\n");
return;
return 0;
Fail1:
printf ("Unable to open input file for Conformance Test 17.8.0.8\n");
return;
return 0;
Fail2:
printf ("Unable to close input file for Conformance Test 17.8.0.8\n");
return;
return 0;
}

View File

@ -2,7 +2,7 @@
#include <stdio.h>
main ()
int main (void)
{
char string [] = " +327678 -0 -002147483647A 327677-22 123*";
short i1, i3;
@ -58,9 +58,9 @@ main ()
goto Fail;
printf ("Passed Conformance Test 17.8.0.9\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 17.8.0.9\n");
return;
return 0;
}

View File

@ -2,7 +2,7 @@
#include <stdio.h>
main ()
int main (void)
{
FILE *f1;
int i, j;
@ -62,21 +62,21 @@ main ()
goto Fail2;
printf ("Passed Conformance Test 17.9.0.1\n");
return;
return 0;
Fail:
fprintf (stderr, "Failed Conformance Test 17.9.0.1\n");
return;
return 0;
Fail1:
fprintf (stderr, "Unable to open input file for Conformance Test 17.9.0.1\n");
return;
return 0;
Fail2:
fprintf (stderr, "Unable to close input file for Conformance Test 17.9.0.1\n");
return;
return 0;
Fail3:
fprintf (stderr, "Unable to redirect stdout for Conformance Test 17.9.0.1\n");
return;
return 0;
}

View File

@ -3,16 +3,19 @@
#include <stddef.h>
#include <stdlib.h>
int printf(const char *, ...);
struct S { int i; extended e; char ch [40]; };
main ()
int main (void)
{
char *rgn;
char *rgn, *ptr1;
int i;
rgn = (char *) calloc (50, sizeof (struct S));
if (rgn == NULL)
goto Fail1;
ptr1 = rgn;
for (i = 0; i < 2600; i++)
{
@ -21,17 +24,17 @@ main ()
rgn += 1;
}
free (rgn);
free (ptr1);
printf ("Passed Conformance Test 18.1.0.1\n");
return;
return 0;
Fail:
printf("%u\n", i);
printf ("Failed Conformance Test 18.1.0.1\n");
return;
return 0;
Fail1:
printf ("Unable to allocate memory for Conformance Test 18.1.0.1\n");
return;
return 0;
}

View File

@ -2,11 +2,14 @@
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int printf(const char *, ...);
struct S { int i; extended e; char ch [40]; };
main ()
int main (void)
{
struct S *rgn, *ptr1;
struct S s [3] = { {1, 1.0, "hey"}, {2, 2.0, "you"}, {3, 3.0, "person!"} };
@ -57,13 +60,13 @@ main ()
printf ("Passed Conformance Test 18.3.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 18.3.0.1\n");
return;
return 0;
Fail1:
printf ("Unable to allocate memory for Conformance Test 18.3.0.1\n");
return;
return 0;
}

View File

@ -3,7 +3,9 @@
#include <math.h>
#include <stdlib.h>
main ()
int printf(const char *, ...);
int main (void)
{
double d1 = -9.0;
int i = -8;
@ -23,7 +25,7 @@ main ()
goto Fail;
printf ("Passed Conformance Test 19.1.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 19.1.0.1\n");

View File

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

View File

@ -2,7 +2,9 @@
#include <stdlib.h>
main ()
int printf(const char *, ...);
int main (void)
{
div_t d1;
ldiv_t ld1;
@ -17,7 +19,7 @@ main ()
printf ("Passed Conformance Test 19.2.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 19.2.0.1\n");

View File

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

View File

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

View File

@ -2,7 +2,9 @@
#include <math.h>
main ()
int printf(const char *, ...);
int main (void)
{
double d1, d2;
int i;
@ -26,7 +28,7 @@ main ()
printf ("Passed Conformance Test 19.5.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 19.5.0.1\n");

View File

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

View File

@ -2,7 +2,9 @@
#include <stdlib.h>
main ()
int printf(const char *, ...);
int main (void)
{
int i, j, array1 [20], array30 [20];
@ -41,7 +43,7 @@ main ()
printf ("Passed Conformance Test 19.7.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 19.7.0.1\n");

View File

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

View File

@ -3,7 +3,9 @@
#include <math.h>
main ()
int printf(const char *, ...);
int main (void)
{
double d1;
@ -25,7 +27,7 @@ main ()
printf ("Passed Conformance Test 19.9.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 19.9.0.1\n");

View File

@ -1,5 +1,8 @@
/* Conformance Test 2.1.0.1: Verification of character set */
main ()
int printf(const char *, ...);
int main (void)
{
char string1 [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char string2 [] = "abcdefghijklmnopqrstuvwxyz";
@ -57,7 +60,7 @@ main ()
goto Fail;
printf ("Passed Conformance Test 2.1.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 2.1.0.1\n");

View File

@ -1,8 +1,12 @@
/* Conformance Test 2.1.0.2: Verification of ANSI C trigraphs */
#include <string.h>
int printf(const char *, ...);
??=define ten 10 /* ??= is '#' */
main ()
int main (void)
??< /* ??< is '{' */
int i;
char a, b??(10??) = "abc"; /* ??( is '[' */
@ -34,7 +38,7 @@ main ()
goto Fail;
printf ("Passed Conformance Test 2.1.0.2\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 2.1.0.2\n");

View File

@ -1,7 +1,9 @@
/* Conformance Test 2.1.0.3: Verification of ANSI C trigraphs in */
/* character constants */
main ()
int printf(const char *, ...);
int main (void)
{
char a;
@ -42,7 +44,7 @@ main ()
goto Fail;
printf ("Passed Conformance Test 2.1.0.3\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 2.1.0.3\n");

View File

@ -1,7 +1,11 @@
/* Conformance Test 2.1.0.4: Verification of ANSI C trigraphs in */
/* character string constants */
main ()
#include <string.h>
int printf(const char *, ...);
int main (void)
{
char a [] = "??=??/boh??'??!??-??(??<??)??>boy";
@ -9,7 +13,7 @@ main ()
goto Fail;
printf ("Passed Conformance Test 2.1.0.4\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 2.1.0.4\n");

View File

@ -1,7 +1,9 @@
/* Conformance Test 2.1.1.1: Verification of encoding for null */
#include <string.h>
main ()
int printf(const char *, ...);
int main (void)
{
char string [4];
@ -14,7 +16,7 @@ main ()
goto Fail;
printf ("Passed Conformance Test 2.1.1.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 2.1.1.1\n");

View File

@ -1,5 +1,10 @@
/* Conformance Test 2.1.1.2: Verification of newline character */
main ()
#include <string.h>
int printf(const char *, ...);
int main (void)
{
char string [10];
@ -16,7 +21,7 @@ main ()
goto Fail;
printf ("Passed Conformance Test 2.1.1.2\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 2.1.1.2\n");

View File

@ -1,2 +1,4 @@
main ( )
int printf(const char *, ...);
int main (void)
{ printf ("Passed Conformance Test 2.1.2.1\n"); }

View File

@ -1,5 +1,8 @@
/* Conformance Test 2.1.2.2: Ensure '\' can be used to continue source lines */
main ()
int printf(const char *, ...);
int main (void)
{
int i;
@ -28,7 +31,7 @@ main ()
goto Fail;
printf ("Passed Conformance Test 2.1.2.2\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 2.1.2.2\n");

View File

@ -4,7 +4,7 @@
<stdio.h>
#define CONSTANT \
5
main ()
int main (void)
{
if (CONSTANT != 5)
printf ("Failed Conformance Test 2.1.2.3\n");

View File

@ -1,5 +1,8 @@
/* Test 2.2.0.1: in-line comments */
main (/* This should be ignored */)
int printf(const char *, ...);
int main (/* This should be ignored */ void)
/*{ brackets should not be seen }*/
{
printf ("Passed Conformance Test 2.2.0.1\n");

View File

@ -1,5 +1,8 @@
/* Conformance Test 2.2.0.2: Comments crossing multiple lines */
main ()
int printf(const char *, ...);
int main (void)
{
/* Should ignore this
comment line

View File

@ -1,9 +1,12 @@
/* Conformance test 2.2.0.3: Comments in preprocessor lines */
int printf(const char *, ...);
#define ten /* ten:
one greater
than nine
*/ (2 * 5)
main ()
int main (void)
{
if (ten == 10)
{

View File

@ -1,6 +1,10 @@
/* Conformance test 2.2.0.4: Comment characters in strings */
main ()
#include <string.h>
int printf(const char *, ...);
int main (void)
{
if (strlen("/*") == 2)
printf ("Passed Conformance Test 2.2.0.4\n");

View File

@ -1,5 +1,8 @@
/* Conformance Test 2.4.0.1: Ensure =+ is assigment followed by unary plus */
main ()
int printf(const char *, ...);
int main (void)
{
int a;

View File

@ -1,5 +1,8 @@
/* Conformance Test 2.4.0.2: Ensure =- is assigment followed by unary minus */
main ()
int printf(const char *, ...);
int main (void)
{
int a;

View File

@ -1,6 +1,9 @@
/* Conformance Test 2.5.0.1: Test characters comprising identifiers for */
/* variables */
main ()
int printf(const char *, ...);
int main (void)
{
int a_______________000000000000000000000000000000;
short _____________________________________________9;
@ -58,7 +61,7 @@ Zabcdefghijklmnopqrstuvwxyz_____________0123456789987654321 != 3)
goto Fail;
printf ("Passed Conformance Test 2.5.0.1\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 2.5.0.1\n");

View File

@ -1,5 +1,8 @@
/* Conformance Test 2.5.0.2: Test characters comprising function identifiers */
main ()
int printf(const char *, ...);
int main (void)
{
extern double i_______________000000000000000000000000000000__________ ();
@ -33,7 +36,7 @@ ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_____________\
goto Fail;
printf ("Passed Conformance Test 2.5.0.2\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 2.5.0.2\n");

View File

@ -1,6 +1,9 @@
/* Conformance Test 2.5.0.3: Test characters comprising identifiers for */
/* user-defined types */
main ()
int printf(const char *, ...);
int main (void)
{
typedef short _____________________________________________9;
@ -41,7 +44,7 @@ Zabcdefghijklmnopqrstuvwxyz_____________0123456789987654321 y;
goto Fail;
printf ("Passed Conformance Test 2.5.0.3\n");
return;
return 0;
Fail:
printf ("Failed Conformance Test 2.5.0.3\n");

Some files were not shown because too many files have changed in this diff Show More