mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-18 03:29:49 +00:00
91d33b586d
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.
46 lines
1.5 KiB
C++
46 lines
1.5 KiB
C++
/* Special Conformance Test 4.5.3.2: Verfication of external array */
|
|
/* declarations: arrays of pointers */
|
|
/* */
|
|
/* Other files needed: spc4532.1.cc - separately compiled file */
|
|
/* containing test of arrays */
|
|
/* spc4532.h - header file containing extern */
|
|
/* declarations needed by second file */
|
|
/* spc4532.exec - EXEC file which separately compiles*/
|
|
/* links and executes test 4.5.3.0.2 */
|
|
|
|
int printf(const char *, ...);
|
|
|
|
int *i1 [50]; /* all basic types */
|
|
long *L1 [9];
|
|
comp *c1 [3];
|
|
char *ch1 [10];
|
|
float *f1 [3];
|
|
double *d1 [8];
|
|
extended *e1 [9];
|
|
|
|
unsigned int *ui3 [4] [5] [1], *ui1 [7];
|
|
unsigned long *ul2 [5] [3], *ul1 [1];
|
|
|
|
/* conglomerate types */
|
|
struct s { int a;
|
|
float f; };
|
|
struct s *s1 [10], S;
|
|
|
|
enum colors { red, black, green };
|
|
enum colors *en [6], C;
|
|
|
|
union longOrShort { int first;
|
|
long second; };
|
|
union longOrShort *u1 [12], U;
|
|
|
|
|
|
int main (void)
|
|
{
|
|
extern int TestEm (void);
|
|
|
|
if (TestEm)
|
|
printf ("Passed Special Conformance Test 4.5.3.2\n");
|
|
else
|
|
printf ("Failed Special Conformance Test 4.5.3.2\n");
|
|
}
|