mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-06 07:49:02 +00:00
Fix writing fact table file names in .module_dep files.
Commit 5f50259d16 inadvertently wrote out
the list of fact table file names in a .module_dep file without quoting,
so the .module_dep parser would fail to read it back.
compiler/make.module_dep_file.m:
Write fact table file names in .module_dep files as quoted strings.
tests/mmc_make/Mmakefile:
tests/mmc_make/factt.m:
tests/mmc_make/factt_examples:
Add a test case.
This commit is contained in:
committed by
Julien Fischer
parent
45ca31b2d3
commit
49190a8463
@@ -400,9 +400,10 @@ do_write_module_dep_file_to_stream(Stream, Globals, Baggage, AugCompUnit,
|
||||
MaybeTopModule = Baggage ^ mb_maybe_top_module,
|
||||
NestedSubModules = get_nested_children_list_of_top_module(MaybeTopModule),
|
||||
get_fact_tables(ParseTreeModuleSrc, FactTableFilesSet),
|
||||
set.to_sorted_list(FactTableFilesSet, FactTableFiles),
|
||||
FactTableFilesStrs = list.map(term_io.quoted_string,
|
||||
set.to_sorted_list(FactTableFilesSet)),
|
||||
globals.get_backend_foreign_languages(Globals, BackendLangsList),
|
||||
BackendLangs = set.list_to_set(BackendLangsList),
|
||||
BackendLangs = set.list_to_set(BackendLangsList),
|
||||
get_foreign_code_langs(ParseTreeModuleSrc, CodeLangs),
|
||||
get_foreign_export_langs(ParseTreeModuleSrc, ExportLangs),
|
||||
set.intersect(BackendLangs, CodeLangs, BackendCodeLangs),
|
||||
@@ -445,7 +446,7 @@ do_write_module_dep_file_to_stream(Stream, Globals, Baggage, AugCompUnit,
|
||||
s(bracketed_sym_names_to_comma_list_string(ImpDeps)),
|
||||
s(bracketed_sym_names_to_comma_list_string(Children)),
|
||||
s(bracketed_sym_names_to_comma_list_string(NestedSubModules)),
|
||||
s(string.join_list(", ", FactTableFiles)),
|
||||
s(string.join_list(", ", FactTableFilesStrs)),
|
||||
s(string.join_list(", ", CodeLangStrs)),
|
||||
s(string.join_list(", ", FIMSpecStrs)),
|
||||
s(ContainsForeignExportStr),
|
||||
|
||||
@@ -10,7 +10,7 @@ MAYBE_J1 =
|
||||
|
||||
MMAKE_USE_MMC_MAKE=yes
|
||||
|
||||
PROGS = \
|
||||
PROGS0 = \
|
||||
bug489 \
|
||||
complex_test \
|
||||
hello \
|
||||
@@ -19,6 +19,15 @@ PROGS = \
|
||||
linkage_test \
|
||||
rebuild
|
||||
|
||||
ifeq "$(filter csharp% java%,$(GRADE))" ""
|
||||
C_ONLY_PROGS = \
|
||||
factt
|
||||
else
|
||||
C_ONLY_PROGS =
|
||||
endif
|
||||
|
||||
PROGS = $(PROGS0) $(C_ONLY_PROGS)
|
||||
|
||||
# These tests only work if the workspace was compiled with `--use-subdirs'.
|
||||
ifneq ($(origin WORKSPACE),undefined)
|
||||
ifeq ($(shell [ -d $(WORKSPACE)/library/Mercury ] || echo cannot_run),cannot_run)
|
||||
@@ -58,6 +67,13 @@ rebuild.runtest:
|
||||
# The compiler used to fail when invoked as `mmc --make build_object.o'.
|
||||
build_object.runtest: build_object.o
|
||||
|
||||
# Check that no errors occur while reading back the .module_dep file on the
|
||||
# second run.
|
||||
factt.runtest:
|
||||
$(MCM) --make factt
|
||||
$(MCM) --make factt >factt.err2 2>&1
|
||||
! grep -i 'Error' factt.err2
|
||||
|
||||
.PHONY: install_libs
|
||||
install_libs: start_runtests_local
|
||||
$(MMAKE) TESTS_FLAGS
|
||||
@@ -82,7 +98,7 @@ TESTS_FLAGS: ../TESTS_FLAGS
|
||||
realclean_local: realclean_mmc_make
|
||||
|
||||
realclean_mmc_make: TESTS_FLAGS
|
||||
rm -rf install include_file2.err rebuild.err2
|
||||
rm -rf install include_file2.err rebuild.err2 factt.err2
|
||||
# ./TESTS_FLAGS is expected by the following line.
|
||||
cd lib; $(MCM) complex_numbers.realclean linkage_test2.realclean
|
||||
rm -f TESTS_FLAGS
|
||||
|
||||
39
tests/mmc_make/factt.m
Normal file
39
tests/mmc_make/factt.m
Normal file
@@ -0,0 +1,39 @@
|
||||
%---------------------------------------------------------------------------%
|
||||
% vim: ts=4 sw=4 et ft=mercury
|
||||
%---------------------------------------------------------------------------%
|
||||
|
||||
:- module factt.
|
||||
:- interface.
|
||||
|
||||
:- import_module io.
|
||||
:- pred main(io::di, io::uo) is det.
|
||||
|
||||
%---------------------------------------------------------------------------%
|
||||
|
||||
:- implementation.
|
||||
|
||||
:- import_module int.
|
||||
:- import_module list.
|
||||
:- import_module string.
|
||||
|
||||
:- pred example(int::in, int::out, int::out) is semidet.
|
||||
:- pragma fact_table(example/3, "factt_examples").
|
||||
|
||||
%---------------------------------------------------------------------------%
|
||||
|
||||
main(!IO) :-
|
||||
show_examples(1, !IO).
|
||||
|
||||
:- pred show_examples(int::in, io::di, io::uo) is det.
|
||||
|
||||
show_examples(Cur, !IO) :-
|
||||
( if Cur > 50 then
|
||||
true
|
||||
else
|
||||
( if example(Cur, A, B) then
|
||||
io.format("%2d %2d %2d\n", [i(Cur), i(A), i(B)], !IO)
|
||||
else
|
||||
io.format("%2d - -\n", [i(Cur)], !IO)
|
||||
),
|
||||
show_examples(Cur + 1, !IO)
|
||||
).
|
||||
4
tests/mmc_make/factt_examples
Normal file
4
tests/mmc_make/factt_examples
Normal file
@@ -0,0 +1,4 @@
|
||||
example(1,0,1).
|
||||
%to
|
||||
example(50,1,50).
|
||||
|
||||
Reference in New Issue
Block a user