mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 01:43:35 +00:00
Estimated hours taken: 8
Various changes to get things to work with the DEC Alpha OSF1 C
compiler in grade hlc.gc.
compiler/equiv_type.m:
Change the code for equiv_type__replace_item_in_item_list
so that it is tail recursive, by using an accumulator and
calling list__reverse at the end. This is needed to avoid
a stack overflow (with the default 2M stack limit) when
bootstrapping with the DEC Alpha OSF1 C compiler in grade hlc.gc.
The dec-alpha-osf3.2 `cc' was generating code that used
280 bytes of space per stack frame for this procedure.
compiler/fact_table.m:
Ensure that there is a statement after every label, since
ANSI/ISO C doesn't allow labels at the end of a block without
an empty statement following them.
library/exception.m:
Use a different name for the local typedef in different functions.
This allows the code to work with the DEC Alpha OSF1 C in
`-std' ("ANSI C with popular extensions") mode, rather than
the `-std1' (strict ANSI/ISO C). The supposedly popular
extension here is treating local typedefs as if they were
global. It's probably not worth expending much effort to
cater for non-ANSI modes of compilers, but in this case the
effort is small and arguably the different names are more
descriptive anyway.
runtime/mercury.c:
Avoid the use of a GNU C extension (returning void values).
runtime/mercury_deep_copy.c:
Change `#undef FOO(ARGS)' to `#undef FOO', since the former
is not allowed in ANSI/ISO C.
trace/mercury_trace_internal.c:
Change `#endif FOO' to `#endif /* FOO */', since the former
is not allowed in ANSI/ISO C.
tests/hard_coded/pragma_c_code.m:
tests/hard_coded/type_tables.m:
Use `\\n' rather than `\n' for newlines in strings inside
`pragma c_code'. This is needed because the first level of
slashes gets processed when converting from Mercury to C, and
ANSI/ISO C doesn't allow literal newlines in strings.
The Mercury test suite is (dis)organized into a directory hierarchy. Each subdirectory has a script named "runtests" that runs the tests in that subdirectory; these indicate the presence of any errors by returning a nonzero exit status. The runtests script in each directory invokes the runtests scripts in all subdirectories, and propagates any nonzero exit status upwards. Both the bootcheck script and the nightly script use the main runtests script to run all the tests. benchmarks This directory contains Mercury versions of the benchmarks. These tests work by comparing the output of the Mercury and the NU-Prolog versions. debugger This directory is for testing mdb, the Mercury debugger. Programs are compiled with deep tracing turned on. The tests in this directory are not performed if the base grade is `jump' or `fast'. debugger/declarative This directory is for testing the declarative debugging features of mdb. general This directory is for general test cases. (It might be a good idea to split this into tests of particular features and regression tests that check for old bugs. But for the moment, just about everything goes in here.) These tests work by comparing the output of the Mercury and the NU-Prolog versions. hard_coded This directory is for tests of features that don't work in NU-Prolog. The expected output of the program has to be hard-coded in a hand-written `.exp' file, rather having the `.exp' file be generated automatically using NU-Prolog. valid This directory is for test cases that are not complete programs. We just check that the files compile. invalid This directory is for test cases that are invalid programs. We check that the files do *not* compile. warnings This directory is for tests of compiler warnings. These work by comparing the warnings emitted by the compiler with those given in the hand-written `.exp' file. To regenerate the expected output files for the benchmark and general directories, execute the "generate_exp" script in this directory.