Commit Graph

13 Commits

Author SHA1 Message Date
Julien Fischer
1c8eece402 Avoid warnings from MSVC in tests.
tests/hard_coded/backend_external.m:
tests/hard_coded/backend_external_pred.m:
tests/hard_coded/c_write_string.m:
tests/hard_coded/ee_dummy.m:
tests/hard_coded/pragma_c_code.m:
tests/hard_coded/pragma_foreign_export.m:
tests/hard_coded/target_mlobjs.m:
tests/hard_coded/type_tables.m:
tests/submodules/sm_exp_bug.m:
    Use don't-care variables to handle the I/O state in foreign procs.
    Assigning the I/O state at the end of the foreign_proc body results
    in spurious warnings about uninitialized variables from MSVC.
2023-07-22 23:24:54 +10:00
Julien Fischer
5de97e355a Replace references to the c_header_code pragma.
tests/hard_coded/needs_init.m:
tests/hard_coded/pragma_c_code.m:
    As above.
2023-02-25 12:55:08 +11:00
Julien Fischer
1f6d83692a Update programming style in tests/hard_coded.
tests/hard_coded/*.m:
    Update programming style, unless doing so would change
    the meaning of the test, in particular:

    - use '.' as a module qualifier in place of '__'
    - use {write,print}_line where appropriate
    - use if-then-else in place of C -> T ; E
    - use state variables in place of DCGs

tests/hard_coded/dir_test.m:
    Document what the expected outputs correspond to.

    Use a uniform module qualifier in the output.

tests/hard_coded/dir_test.exp*:
    Conform to the above change.
2021-01-07 13:58:12 +11:00
Zoltan Somogyi
33eb3028f5 Clean up the tests in half the test directories.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
    Make these tests use four-space indentation, and ensure that
    each module is imported on its own line. (I intend to use the latter
    to figure out which subdirectories' tests can be executed in parallel.)

    These changes usually move code to different lines. For the debugger tests,
    specify the new line numbers in .inp files and expect them in .exp files.
2015-02-14 20:14:03 +11:00
Julien Fischer
790dabb2f4 Remove deprecated syntax from some test cases.
Estimated hours taken: 0.1
Branches: main

Remove deprecated syntax from some test cases.
(This was done on the release branch some time ago.)

tests/*/*.m:
	Replace deprecated syntax.
2005-09-12 09:22:52 +00:00
Peter Ross
b2ebe78ccb Add a missing .1 to the format string.
Estimated hours taken: 0.1
Branches: main

tests/hard_coded/pragma_c_code.m:
	Add a missing .1 to the format string.
2002-11-29 09:36:32 +00:00
Peter Ross
997dd45689 Get the tests in hard_coded to compile in the grade il.
Estimated hours taken: 3
Branches: main

Get the tests in hard_coded to compile in the grade il.  The tests may
still fail because of other reasons.

tests/hard_coded/constraint_order.m:
tests/hard_coded/copy_pred.m:
tests/hard_coded/copy_pred_2.m:
tests/hard_coded/dupcall_impurity.m:
tests/hard_coded/export_test.m:
tests/hard_coded/foreign_import_module.m:
tests/hard_coded/foreign_type3.m:
tests/hard_coded/ho_solns.m:
tests/hard_coded/ho_univ_to_type.m:
tests/hard_coded/impure_foreign.m:
tests/hard_coded/impure_prune.m:
tests/hard_coded/intermod_c_code2.m:
tests/hard_coded/intermod_multimode.m:
tests/hard_coded/multimode.m:
tests/hard_coded/no_inline.m:
tests/hard_coded/rnd.m:
	Provide C# implementation of C code.

tests/hard_coded/existential_types_test.m:
tests/hard_coded/frameopt_pragma_redirect.m:
tests/hard_coded/mode_choice.m:
tests/hard_coded/pragma_c_code.m:
tests/hard_coded/pragma_inline.m:
tests/hard_coded/target_mlobjs.m:
tests/hard_coded/unused_float_box_test.m:
	Provide Mercury implementation of C code.

tests/hard_coded/redoip_clobber.m:
	Provide MC++ implementation of C code.
2002-11-28 16:33:45 +00:00
Fergus Henderson
c74a7e5be4 Various changes to get things to work with the DEC Alpha OSF1 C
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.
2000-11-25 10:42:07 +00:00
Fergus Henderson
c81ffcf79c Add `#include <stdio.h>', to avoid warnings now that it is
Estimated hours taken: 0.25

tests/pragma_c_code.m:
tests/pragma_inline.m:
	Add `#include <stdio.h>', to avoid warnings now that it is
	no longer included by "imp.h".
1997-02-12 03:49:05 +00:00
Fergus Henderson
ba50c1320a Add a test of higher-order functions.
Estimated hours taken: 0.5

tests/hard_coded:
	Add a test of higher-order functions.
1996-05-14 12:48:12 +00:00
Fergus Henderson
4fa1a143b2 Fix bug detected by singleton variable warning.
Estimated hours taken: 0.25

tests/hard_coded/pragma_c_code.m:
	Fix bug detected by singleton variable warning.
	Work around name clash between variable name in
	pragma(c_code, ...) declaration and type defined
	in "imp.h".
1995-11-24 01:20:41 +00:00
David Jeffery
afebed3f93 Made the testing of the C interface a little more robust, and added tests of
Estimated hours taken: 1

Made the testing of the C interface a little more robust, and added tests of
the pragma(inline, ...) declaration.

pragma_c_code.m:
	Made the tests a little more rigorous.
pragma_c_code.exp:
	Changed the expected results to reflect changes to the .m file.
pragma_inline.m:
	Simple test of inlining:
pragma_inline.exp:
	Expected results for the inlining test.
1995-11-20 09:27:28 +00:00
Fergus Henderson
996275b0f0 General cleanup of the test suite directories.
tests/hard_coded:
	Add a new test case pragma_c_code.m.
1995-11-14 08:01:05 +00:00