1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-15 07:31:32 +00:00
cc65/test/ref/custom-reference-error.c
Kugel Fuhr cd4357057f The change from #2495 didn't take into account that recursive calls to main()
are legal in C. With the changes from #2495, such calls will usually crash the
machine. But recursive calls to main() are rare and on the 6502 every byte
saved is precious. So this change limits the effect of #2495 to cc65 mode and
at the same time disallows recursive calls to main() in this mode. If
recursive calls to main() are actually required, the code must be compiled in
c89 or c99 mode.
2024-09-02 10:39:42 +02:00

27 lines
768 B
C

/*
this is an example (not actually a regression test) that shows how to
make a check that compares the compiler (error-) output with a provided
reference.
to produce a reference file, first make sure your program "works" as intended,
then "make" in this directory once and copy the produced compiler output to
the reference:
$ cp ../../testwrk/ref/custom-reference-error.g.6502.out custom-reference-error.cref
and then "make" again to confirm
*/
typedef short return_t;
#error This is an/* produce an error */error
return_t main(int argc, char* argv[])
{
printf("%02x", 0x42); /* produce an error */
n = 0; /* produce an error */
/* produce a warning */
}
int b = 0;
int arr[b]; /* produce an error */