doc/user_guide.texi:
List the detail letters for the --dump-hlds-options argument in
table; the current (lack of) arrangement is very difficult to read.
compiler/globals.m:
Set up a system that should eventually allow us to output most or all
compiler output to five streams, which can be individually directed
to module-specific files by users if needed.
compiler/options.m:
Add the five options that give users this control.
doc/user_guide.text:
Document the (user-visible) new options.
compiler/mercury_compile_main.m:
Close any module-specific output streams that we opened.
compiler/polymorphism.m:
A first use of this system.
The 'browse --xml' command has not worked with current versions of
xsltproc for quite some time, but we have not received any bug reports,
nor has anyone tried to fix it. We have a method for interactively
exploring a term in 'browse --web' so IMHO there is no need to keep
support for 'browse --xml'.
browser/browse.m:
browser/browser_info.m:
browser/declarative_user.m:
trace/mercury_trace_browse.c:
trace/mercury_trace_browse.h:
trace/mercury_trace_cmd_browsing.c:
trace/mercury_trace_cmd_parameter.c:
trace/mercury_trace_cmd_parameter.h:
trace/mercury_trace_internal.c:
Delete code.
doc/mdb_categories:
doc/user_guide.texi:
Delete documentation.
configure.ac:
Don't search for a XUL browser and xsltproc.
scripts/mdbrc.in:
Delete 'xml_browser_cmd' and 'xml_tmp_filename' lines.
scripts/xul_tree.xsl:
Delete now unused file.
scripts/Mmakefile:
Conform to deletions.
tests/debugger/Mmakefile:
tests/debugger/browser_test.exp:
tests/debugger/browser_test.exp3:
tests/debugger/browser_test.inp:
tests/debugger/mdb_command_test.inp:
tests/debugger/save.exp2:
tests/declarative_debugger/browse_arg.exp:
tests/declarative_debugger/browse_arg.inp:
Don't test 'browse --xml' any longer.
extras/xml_stylesheets/README:
Delete reference to 'browse --xml' command.
NEWS:
Announce change.
browser/listing.m
Add list_file_with_command which calls an external command to print
source listings instead of doing it internally. The implementation
is incomplete in that the external command's standard output and
standard error streams are not redirected into OutStrm and ErrStrm.
Rename mercury_stream_to_c_FILE_star to
mercury_stream_to_c_file_ptr.
Consolidate some output calls with string.format.
trace/mercury_trace_cmd_parameter.c:
trace/mercury_trace_cmd_parameter.h:
trace/mercury_trace_internal.c:
Add a 'list_cmd' command which sets or prints the current
external listing command.
trace/mercury_trace_cmd_browsing.c:
Make 'list' command call list_file_with_command if an external
listing command was set.
doc/user_guide.texi:
Document 'list_cmd' command.
tests/debugger/completion.exp:
tests/debugger/mdb_command_test.inp:
Update for new command.
NEWS:
Announce changes.
NEWS:
doc/reference_manual.texi:
Document the new attribute, which, if specified on a pragma memo,
shuts up the warning that the compiler would otherwise generate
about that pragma if it had to ignore it because the targeted backend
does not support memoing.
compiler/prog_data_pragma.m:
Add the new attributes to the set of tabling attributes.
Add the new attribute to the eval_memo eval_method as an argument
in order to preserve it until table_gen.m can act on it. (The other
tabling attributes are implemented way before that, so the attribute
structure itself doesn't survive to reach table_gen.m.)
compiler/parse_pragma.m:
Parse the new pragma, and copy it to the eval method.
compiler/table_gen.m:
Generate a warning about ignoring a pragma memo only if the new attribute
does not disable that warning.
compiler/options.m:
Provide a simple way for the configure script to test whether
the installed compiler contains this diff.
compiler/hlds_out_module.m:
compiler/hlds_out_pred.m:
compiler/hlds_pred.m:
compiler/item_util.m:
compiler/layout_out.m:
compiler/parse_tree_out_pragma.m:
compiler/prog_out.m:
compiler/tabling_analysis.m:
Conform to the changes above.
browser/help.m:
Simplify the data types representing the nested structure
of help information. Simplify the code of the predicates
that work on that structure.
Simplify some of the predicates, e.g. by having a search predicate
do *just* search.
Give types and predicates more meaningful names. Make argument order
more suitable for state-variables. Move a predicate next to its
only call site.
browser/declarative_user.m:
Conform to the change in help.m.
Replace two bools with values of bespoke types.
browser/declarative_debugger.m:
browser/declarative_oracle.m:
Conform to the changes in help.m and declarative_user.m.
doc/generate_mdb_doc:
Fix the vim modeline.
trace/mercury_trace_declarative.c:
trace/mercury_trace_help.c:
Conform to the changes in the browser directory.
util/info_to_mdb.c:
Switch from /**/ to // for comments.
Give a macro a meaningful name.
Fix indentation.
doc/user_guide.texi:
mmake now assumes the use of GNU make.
Document the .dll and .exe files generated when we target C#.
Document that the .exe extension will be used for executables
when targeting C on Windows.
Add paragraphs describing what is generated for executables
by the C#, Java and Erlang backends.
Despite its name, mgnuc works with all (supported) C compilers
not just GNU C.
Mention the .dylib extension used for shared libraries on macOS.
Uncomment the documentation for C# libraries.
Update the section on Java libraries; the existing text describes
a very old state of affairs.
README.Java:
Add a missing word.
On Windows the name 'mmc' is also used for the executable for Microsoft
Management Console. For the MSVC port on the Windows command line we have long
provided a batch file named 'mercury' as an alternative to `mmc' in order to
avoid this clash. (Re-arranging your PATH to avoid the clash is not always an
option.)
Provide a shell script named 'mercury' that serves the same purpose elsewhere.
Its main use is to avoid the name clash on MinGW/MSYS, Cygwin etc., but
making the name available everywhere should avoid unnecessary changes in build
scripts and alike.
Document the issue with the name clash in the appropriate chapter of the user's
guide and also in the top-level Windows README file.
scripts/mercury.in:
Add a template for the 'mercury' script.
configure.ac:
Create the 'mercury' wrapper script.
scripts/Mmakefile:
Add 'mercury' to the list of scripts.
doc/user_guide.texi:
Add a paragraph describing the 'mmc' name clash on Windows and what
to do about it.
Unrelated change: ':' is no longer a module qualifier.
README.MS-Windows:
Point users to the relevant chapter of the user's guide for ways
to deal with the `mmc' name clash.
NEWS:
Announce the addition.
And add tests for how the compiler handles both valid and invalid
options files.
compiler/options_file.m:
This diff rewrites options_file.m in a straightforward, direct style that
returns indications of errors as error_specs rather than as exceptions.
A recent diff started on this task; this diff finishes it.
The new approach has several advantages.
- The control flow is much simpler, and therefore more understandable.
Correctness arguments for propositions such as "this code closes
all the file streams that it opens" are now much simpler to make.
- We now report errors using error_specs, which contain context
information, while previously, each error was described only
by a string, without context info.
- Once we detect and report one error, we can continue to read the
rest of the input. This allows a single compiler invocation to find
and report several errors, not just the first.
- Since we now return the gathered set of error_specs instead of printing
them, the predicates of this file don't have to take globals structures
as arguments, which allows our callers to avoid constructing those
structures.
- Deep profiling, which cannot handle exceptions, now works on
the code of this module.
Change over to using trace goals for debugging prints, since continuing
to use debug_make_msg would require a globals structure.
Add an XXX on a likely bug.
Add a mechanism for writing out a database of variable names and values.
compiler/mercury_compile_main.m:
Conform to the changes in options_file.m. Document where exactly
we could avoid constructing a globals just for options_file.m.
If the right option is given, get options_file to write out the database
of variable names and values it has just read in, to enable the
functionality of this module to be tested.
compiler/options.m:
doc/user_guide.texi:
Add a new developer option, --dump-options-file, to control the above.
compiler/make.build.m:
compiler/make.m:
compiler/make.program_target.m:
Conform to the changes in options_file.m.
compiler/file_util.m:
Fix an error message.
tests/Mmakefile:
tools/bootcheck:
List options_file and invalid_options_file as two new test directories.
Fix a command in bootcheck.
tests/options_file/Mmakefile:
Add a mechanism for testing whether options_file.m builds mapping
from make variable names to values that we expect.
tests/Mmake.common:
Provide a mechanism for comparing dumped options_files against
their expected contents, for use by tests/invalid_options_file/Mmakefile.
Fix a comment.
tests/options_file/basic_test.m:
tests/options_file/basic_test.optfile_exp:
tests/options_file/basic_test.options_file:
tests/options_file/basic_test.options_file.sub0:
tests/options_file/basic_test.options_file.sub1:
A simple test case for exercising all the usual options_file constructs.
tests/invalid_options_file/Mmakefile:
Add a mechanism for testing whether options_file.m generates
the error messages we expect for various kinds of errors in options files.
tests/invalid_options_file/no_assign.{m,options_file,err_exp}:
tests/invalid_options_file/no_var.{m,options_file,err_exp}:
tests/invalid_options_file/nonexistent_file.{m,options_file,err_exp}:
tests/invalid_options_file/undefined_var.{m,options_file,err_exp}:
tests/invalid_options_file/unterminated_string.{m,options_file,err_exp}:
tests/invalid_options_file/unterminated_var.{m,options_file,err_exp}:
Six test cases to test six different kinds of errors that can be
detected by options_file.m.
doc/user_guide.texi:
Document the recent change that mmc -f *.m is needed if a module's
file name does not match the fully qualified module name.
Mention that the discussion of .c and .o files applies only
to grades targeting C.
Mention that LLDS details such as MERCURY_OPTIONS governing stack sizes
apply only in (non-stseg) LLDS grades.
Mention that mmake does not support Java, C# and Erlang grades,
but comment out these mentions since I am not sure about exactly
what we *can* say about this.
Delete mention of the --assume-gmake option.
Minor English improvements.
compiler/options.m:
Delete the --assume-gmake option. It has long been unused.
runtime/mercury_wrapper.c:
Add a reminder to update user_guide.texi if the default stack sizes
are changed.
When specified, the compiler will generate an overview of the sequence
of predicates and functions in the module being compiled, and put it
in a file with the suffix ".defn_extents". For tests/benchmarks/nrev,
this file looks like this:
main/2 26 to 26
main1/1 28 to 30
main3/3 35 to 37
data/1 42 to 42
nreverse/2 48 to 50
concatenate/3 55 to 57
print_list/3 62 to 64
print_list_2/3 76 to 80
This overview can help spot situations in which related predicates
and functions are not grouped together.
compiler/options.m:
Add the new option.
compiler/mercury_compile_main.m:
If the new option is specified, invoke hlds_defns.m to do the task
that it asks for.
compiler/hlds_defns.m:
Implement the new option, mostly by slightly generalizing the old code
that implements the related option --show-definition-line-counts,
and wrapping it up in a small amount of new code.
doc/user_guide.texi:
NEWS:
Document and announce the new option.
doc/reference_manual.texi:
Document the restrictions that the parse_type_defn.m implements
(or at least tries to).
Fix three bugs in one of the "supposed to be correct" examples,
as well as the formatting that previously made the bugs harder to see.
compiler/parse_type_defn.m:
Improve the wording of error messages for errors involving existentially
typed data constructors.
Simplify the structure of one of the predicates that generate such
messages.
compiler/parse_class.m:
Add a period to the end of an error message.
tests/invalid/bad_existential_data_type.{m,err_exp}:
A new test case for the updated error messages, most of which
weren't being tested before.
tests/invalid/Mmakefile:
Enable the new test case.
tests/invalid/fundeps_unbound_in_ctor.err_exp:
tests/invalid/type_vars.err_exp:
Update the expected wording of some error messages.
We used to describe each base grade and each grade modifier only very
briefly, in less than a sentence. Replace these sentence fragments
with paragraphs.
Delete redundant index entries.
The effect of --tags none is to tell the compiler not to use any primary
tag bits. The option is not needed when targeting Java, C# or Erlang,
since with these languages we can't use primary tags. It was effective
only in C grades. However, since using primary tags is always faster,
the only use case for --tags none was to measure *how much* faster.
This was useful in Mercury's early development, but has become obsolete
ages ago.
compiler/options.m:
doc/user_guide.texi:
Delete the --tags option. For non-C targets, it was never needed,
and with the deletion of first --tags high and now --tags none,
--tags low is the only supported value for C.
Change the documentation of the --num-ptag-bits option to emphasize
that name, not its older but less specific synonym, --num-tag-bits.
Document that the only reason to use this option is cross-compilation.
In user_guide.texi, also delete some references to long-deleted
options for reserved addresses and objects, and some duplicate lines
in comments.
NEWS:
Document the option removal.
compiler/globals.m:
Delete the tags_method field of the globals, since it is not
needed anymore.
compiler/handle_options.m:
Delete the code that converts the value of the --tags option to the
value of the tags_method field of the globals.
Ensure that the value of the num_ptag_bits option is (a) zero when
not targeting C, and (b) either 2 or 3 when targeting C.
compiler/du_type_layout.m:
Check that we are using 2 or 3 ptag bits when targeting C.
compiler/const_struct.m:
Conform to the changes above.
runtime/mercury_grade.h:
Generate an error if MR_TAGBITS is zero (which could happen
only with --tags none).
runtime/mercury_tags.h:
Delete the definitions of the list access macros for the MR_TAGBITS == 0
case.
The main objective of this change is to get bootchecks in the csharp
and java grades to actually build the slice, profiler, deep_profiler
and mfilterjavac directories, which (due to the bug this diff fixes)
they weren't doing before.
However, since one side effect of this change is to eliminate
one source of annoying warnings from mmake about references to undefined
variables, a subsidiary objective is to eliminate other sources of such
warnings as well, which mostly come from the rules for making tags files.
browser/Mmakefile:
deep_profiler/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
When creating stage 3, the bootcheck builds, in each directory,
only the files that it wants to compare against their stage 2 versions.
This means that it wants to build all the .c, .cs or .java files,
which it does via the cs, css and javas mmake targets.
The correct definitions of the rules of these targets depends on
whether mmc --make is being used or not, so we need at least two
sets of definitions: one for mmc --make, and for no mmc --make,
and conditionally selecting the appropriate one. The latter definition
has the problem that it refers to mmake variables that are intended
to be defined in .dv files created by mmc --generate-dependencies,
but until that has been run, those mmake variables are undefined.
Until now, the only directories that had both the mmc --make
and the no mmc --make definitions were the ones needed to build
the compiler. Bootchecks in the csharp and java grades, which
always use --make make, got errors when they tried to build
the directories that bootcheck builds after the compiler:
the slice, profiler, deep_prof and mfilterjavac directories.
This diff ensures that all directories we build in bootcheck
get all both versions of the os, cs, css, and javas targets.
In fact, they get two subversions of the no mmc --make version:
one for use in the presence of .dv files, and one for use in their
absence. The latter just builds the .dv files and invokes mmake
again. This avoids one source of warnings about undefined mmake
variables.
To avoid another source, make the rules for tags files and their
proxies depends on *.m instead of mmake variables such as $(mcov.ms),
since this makes sense even before making dependencies. The only price
is that any untracked Mercury source files in the directory have to
either be given some other suffix, or moved somewhere else.
Where relevant, make the mtags invocation prefer the master versions
of files that are copied from the mdbcomp directory to other directories,
since this is the only writeable version.
Make the os and cs rules consistently NOT build the _init.[co] files.
The way we use those files in bootcheck, we never need them;
when we need them, the right target to give is the executable anyway.
In the slice directory, don't put mcov between mtc_union and mtc_diff.
Eliminate unnecessary duplication, e.g. of sources in rules.
Eliminate double negatives in conditionals.
Fix formatting.
Mmake.common.in:
bindist/Mmakefile:
bytecode/Mmakefile:
compiler/Mmakefile:
doc/Mmakefile:
grade_lib/Mmakefile:
robdd/Mmakefile:
samples/Mmakefile:
scripts/Mmakefile:
tools/Mmakefile:
trace/Mmakefile:
util/Mmakefile:
Add "ft=make" to vim modelines. This is redundant for the files whose
names is Mmakefile, but it is needed for Mmake.common.
As we discussed, it has fallen into disuse. Its main purpose was to
pave the way for the .net backend and later for the java and csharp grades.
Now that the .net backend is ancient history and the java and csharp grades
are established, that purpose is gone, and for every other purpose,
hlc is better because it is simpler and faster.
compiler/options.m:
Delete the --high-level-data option. It is no longer needed,
bacause the data representation scheme is now a direct function
of the target language.
doc/user_guide.texi:
Delete references to the --high-level-data option.
NEWS:
Mention that --high-level-data is no longer supported.
compiler/compute_grade.m:
Delete references to the hl grade component, and conform
to the deletion of the --high-level-data option.
compiler/compile_target_code.m:
Give some predicates more meaningful names, and conform to the
deletion of the --high-level-data option.
compiler/const_struct.m:
compiler/du_type_layout.m:
compiler/globals.m:
compiler/handle_options.m:
compiler/lco.m:
compiler/mercury_compile_main.m:
compiler/ml_gen_info.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen_construct.m:
compiler/mlds_to_c_data.m:
compiler/mlds_to_c_func.m:
compiler/mlds_to_c_type.m:
compiler/mlds_to_c_util.m:
Conform to the deletion of the --high-level-data option.
grade_lib/grade_spec.m:
grade_lib/grade_vars.m:
Delete the datarep solver variable, since the data representation
is now a direct function of the target language.
Delete the requirements involving the deleted solver variable.
grade_lib/grade_structure.m:
Delete the datarep component of the representation of MLDS C grades,
since its value would now be fixed.
grade_lib/grade_solver.m:
grade_lib/grade_string.m:
grade_lib/try_all_grade_structs.m:
grade_lib/var_value_names.m:
Conform to the changes above.
grade_lib/Mmakefile:
Link the grade library's test programs statically, like we do
the executables in the other directories.
library/io.m:
library/robdd.m:
library/rtti_implementation.m:
runtime/mercury_conf_param.h:
runtime/mercury_grade.h:
runtime/mercury_hlc_types.h:
Remove references to MR_HIGHLEVEL_DATA, as well as any code
that was guarded by #ifdef MR_HIGHLEVEL_DATA.
scripts/Mmake.vars.in:
scripts/canonical_grade.sh-subr:
scripts/final_grade_options.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/mgnuc_file_opts.sh-subr:
scripts/mmake.in:
scripts/mmc.in:
scripts/mtc:
scripts/parse_grade_options.sh-subr:
scripts/parse_ml_options.sh-subr.in:
Remove references to --high-level-data options.
In canonical_grade.sh-subr, compute the base grade more directly.
Remove a few left-over references to the assembler backend.
Add or fix vim modelines where relevant.
Fix inconsistent indentation.
Add missing ;;s in case statements.
Switch to using ${var} references instead of just $var.
tests/invalid/Mercury.options:
Make the test_feature_set test case run in grade java instead of hl.gc.
tests/invalid/test_feature_set.err_exp:
Update the expected out for the grade change.
This fixes github issue #85.
A complication is that the compiler itself has code, in make.util.m,
in which a disjunct has no solutions in only one mode of a two mode
function, but in this case, the code works (though its programming style
is pretty bad), so to get this change to bootstrap, we also need
a way to disable the "this disjunct can't have solutions" warning
in a scope.
compiler/simplify_goal_disj.m:
When we generate a "this disjunct can't succeed" warning,
do not insist on all modes generating that warning.
We used to insist on that because in a multi-mode predicate,
such warnings can be inappropriate for other modes.
Instead, achieve the same objective of minimizing programmer
confusion by adding a codicil explicitly mentioninging
this possibility.
Make the generation of this warning conditional on a simplify task
that can be disabled by "disable_warnings" scope.
compiler/prog_data.m:
Add "no_solution_disjunct" as a warning kind that may be disabled.
compiler/parse_goal.m:
Parse the new kind of warning.
compiler/prog_out.m:
Output the new kind of warning.
Improve some adjacent though unrelated code.
compiler/make.util.m:
Add code disable this warning in the affected predicate.
Comment out this code until installed compilers know how
to parse it and understand it.
compiler/Mercury.options:
Don't turn warnings into errors for make.util.m until then.
compiler/simplify_goal_scope.m:
compiler/simplify_info.m:
compiler/simplify_tasks.m:
Provide the mechanism needed to make it possible to disable
warnings about no solution disjuncts.
doc/reference_manual.texi:
Document the new disable-able warning.
NEWS:
Document both the changed behavior of the old warning
and the new way to disable it.
tests/warnings/gh85.{m,exp}:
A regression test for the bug, based on the code in the
github issue. It also tests the way to disable the warning.
tests/warnings/Mmakefile:
Enable the new test case.
Replacing item blocks file-kind-specific kinds of section markers with
file-kind-specific parse trees has several benefits.
- It allows us to encode the structural invariants of each kind of file
we read in within the type of its representation. This makes the detection
of any accidental violations of those invariants trivial.
- Since each file-kind-specific parse tree has separate lists for separate
kinds of items, code that wants to operate on one or a few kinds of items
can just operate on those kinds of items, without having to traverse
item blocks containing many other kinds of items as well. The most
important consequence of this is not the improved efficiency, though
that is nice, but the increased clarity of the code.
- The new design is much more flexible. For example, it should be possible
to record that e.g. an interface file we read in as a indirect dependency
(i.e. a file we read not because its module was imported by the module
we are compiling, but because its module was imported by *another* imported
module) should be used *only* for the purpose it was read in for. This should
avoid situations where deleting an import of A from a module, because it
is not needed anymore, leads the compiler to generate an error message
about a missing import of module B. This can happen if (a) module B
always *should* have been imported, since it is used, but (b) module A's
import of module B lead to module B's interface being available *without*
an import of B.
Specifically, this flexibility should enable us to establish each module's
.int file as the single source of truth about how values of each type
defined in that module should be represented. When compiling each source
file, this approach requires the compiler to read in that module's .int file
but using only the type_repn items from that .int file, and nothing else.
- By recording a single parse tree for each file we have read, instead of
a varying number of item blocks, it should be significantly easier to
derive the contents of .d files directly from the records of those
parse trees, *without* having to maintain a separate set of fields
in the module_and_imports structure for that purpose. We could also
trivially avoid any possibility of inconsistencies between these two
different sources of truth. (We currently fill in the fields used to
drive the generation of .d files using two different pieces of code,
one used for --generate-dependencies and one used for all other invocations,
and these two *definitely* generate inconsistent results, as the significant
differences in .d files between (a) just after an invocation of
--generate-dependencies and (b) just after any other compiler invocation
can witness.)
This change is big and therefore hard to review. Therefore in many files,
this change adds "XXX CLEANUP" comments to draw attention to places that
have issues that should be fixed, but whose fixes should come later, in
separate diffs.
compiler/module_imports.m:
The compiler uses the module_and_imports structure defined here
to go from a raw compilation unit (essentially a module to be compiled)
to an augmented compilation unit (a raw compilation unit together
with all the interface and optimization files its compilation needs).
We used to store the contents of both the source file and of
the interface and optimization files in the module_and_imports structure
as item blocks. This diff replaces all those item blocks with
file-kind-specific parse trees, for the reasons mentioned above.
Separate out the .int0 files of ancestors modules from the .intN
files for N>0 of directly imported modules. (Their item blocks
used to be stored in the same list.)
Maintain a database of the source, interface and optimization files
we have read in so far. We use it to avoid reading in interface files
if we have already read in a file for the same module that contains
strictly more information (either an interface file with a smaller
number as a suffix, or the source file itself).
Shorten some field names.
compiler/prog_item.m:
Define data structures for storing information about include_module,
import_module and use_module declarations, both in a form that allows
the representation of possibly erroneous code in actual source files,
and in checked-and-cleaned-up form which is guaranteed to be free
of the relevant kinds of errors. Add a block comment at the start
of the module about the need for this distinction.
Define parse_tree_module_src, a data structure for representing
the source code of a single module. This is different from the existing
parse_tree_src type, which represents the contents of a single source file
but which may contain *more* than one module, and also different from
a raw_compilation_unit, which is based on item blocks and is thus
unable to express to invariants such as "no clauses in the interface".
Modify the existing parse_tree_intN types to express the distinction
mentioned just above, and to unify them "culturally", i.e. if they
store the same information, make them store it using the same types.
Fix a mistake by allowing promises to appear in .opt files.
I originally ruled them out because the code that generates .opt files
does not have any code to write out promises, but some of the predicates
whose clauses it writes out have goal_type_promise, which means that
they originated as promises, and get written out as promises.
Split the existing pragma item kind into three item kinds, which have
different invariants applying to them.
- The decl (short for declarative) pragmas give the compiler some
information, such as that a predicate is obsolete or that we
want to type specialize some predicate or function, that is in effect
part of the module's interface. Decl pragmas may appear in module
interfaces, and the compiler may put them into interface files;
neither statement is true of the other two kinds of pragmas.
- The impl (short for implementation) pragmas are named so
precisely because they may appear only in implementation sections.
They give the compiler information that is private to that module.
Examples include foreign_decls, foreign_codes, foreign_procs,
and promises of clause equivalence, and requests for inlining,
tabling etc. These will never be put into interface files,
though some of them can affect the compilation of other modules
by being included in .opt files.
- The gen (short for generated) pragmas can never (legally) appear
in source files at all. They record the results of compiler
analyses e.g. about which arguments of a predicate are unused,
or what exceptions a function can throw, and accordingly they
should only ever occur in compiler-generated interface files.
Use the new type differences between the three kinds of pragmas
to encode the above invariants about which kinds of pragmas can appear
where into the various kinds of parse trees.
Make the augmented compilation unit, which is computed from
the final module_and_imports structure, likewise switch from
storing item blocks to storing the whole parse trees of the
files that went into its construction. With each such parse tree,
record *why* we read it, since this controls what permissions
the source module being compiled has for access to the entities
in the parse tree.
Simplify the contains_foreign_code type, since one of three
function symbols was equivalent to one possible use of another
function symbol.
Provide a way to record which method of which class a compiler-generated
predicate is for. (See hlds_pred.m below.)
Move the code of almost all utility operations to item_util.m
(which is imported by many fewer modules than prog_item.m),
keeping just the most "popular" ones.
compiler/item_util.m:
Move most of the previously-existing utility operations here from
prog_item.m, most in a pretty heavily modified form.
Add a whole bunch of other utility operations that are needed
in more than one other module.
compiler/convert_parse_tree.m:
Provide predicates to convert from raw compilation units to
parse_tree_module_srcs, and vice versa (though the reverse
shouldn't be needed much longer).
Update the conversion operations between the general parse_tree_int
and the specific parse_tree_intN forms for the changes in prog_item.m
mentioned above. In doing so, use a consistent approach, based on
new operations in item_util.m, to detect errors such as duplicate
include_module and import/use_module declarations in all kinds
of parse trees.
Enforce the invariants that the types of parse trees of various kinds
can now express in types, generating error messages for their violations.
Delete some utility operations that have been moved to item_util.m
because now they are also needed by other modules.
compiler/grab_modules.m:
Delete code that did tests on raw compilation units that are now done
when that raw compilation unit is converted to a parse_tree_module_src.
Use the results of the checks done during that conversion to decide
which modules are imported/used and in which module section.
Record a single reason for why we reading in each interface and
optimization file. The code of make_hlds_separate_items.m will use
this reason to set up the appropriate permissions for each item
in those files.
Use separate code for handling different kinds of interface and
optimization files. Using generic traversal code was acceptable economy
when we used the same data structure for every kind of interface file,
but now that we *can* express different invariants for different kinds
of interface and optimization file, we want to execute not just different
code for each kind of file, but the data structures we want to work on
are also of different types. Using file-kind-specific code is a bit
longer, but it is significantly simpler and more robust, and it is
*much* easier to read and understand.
Delete the code that separates the parts of the implementation section
that are exported to submodules, and the part that isn't, since that task
is now done in make_hlds_separate_items.m.
Pass a database of the files we have read through the relevant predicates.
Give some predicates more meaningful names.
compiler/notes/interface_files.html:
Note a problem with the current operation of grab_modules.
compiler/get_dependencies.m:
Add operations to gather implicit references to builtin modules
(which have to be made available even without an explicit import_module
or use_module declaration) in all kinds of parse trees. These have
more code overall, but will be at runtime, since we need only look at
the item kinds that may *have* such implicit references.
Add a mechanism to record the result of these gathering operations
in import_and_or_use_maps.
Give some types, function symbols, predicates and variables
more meaningful names.
compiler/make_hlds_separate_items.m:
When we stored the contents of the source module and the
interface and optimization files we read in to augment it
in the module_and_imports structure as a bunch of item blocks,
the job of this module was to separate out the different kinds of items
in the item blocks, returning a single list of each kind of item,
with each such item being packaged up with its status (which encodes
a set of permissions saying what the source module is allowed
to do with it).
Now that the module_and_imports structure stores this info in
file-kind-specific parse trees, all of which have separate lists
for each kind of item and none of which contain item blocks,
the job of this module has changed. Now its job is to convert
the reason why each file was read in into the (one or more) statuses
that apply to the different kinds of items stored in it, wrap up
each item with its status, and return the resulting overall list
of status/item pairs for each kind of item.
compiler/read_modules.m:
Add predicates that, when reading an interface file, return its contents
in the tightest possible file-kind-specific parse tree.
Refine the database of files we have read to allow us to store
more file-kind-specific parse trees.
Don't require that files in the database have associated timestamps,
since in some cases, we read files we can put into the database
*without* getting their timestamps.
Allow the database to record that an attempt to read a file failed.
compiler/split_parse_tree_src.m:
Rearchitect how this module separates out nested submodules from within
the main module in a file.
Another of the jobs of this module is to generate error messages for
when module A includes module B twice, whether via nesting or via
include_module declarations, with one special exception for the case
where A's interface contains nested submodule A.B's interface,
and A's implementation contains nested submodule A.B's implementation.
The problem ironically was that while it reported duplicate include_module
declarations as errors, split_parse_tree_src.m also *generated*
duplicate include_module declarations. Since it replaced each nested
submodule occurrence with an include_module declaration, in the scenario
above, it generated two include_module declarations for A.B. Even worse,
the interface incarnation of submodule A.B could contain
(the interface of) its own nested submodule A.B.C, while its
implementation incarnation could contain (the implementation section of)
A.B.C. Each occurrence of A.B.C would be its only occurrence in the
including part of its parent A.B, which means local tests for duplicates
do not work. (I found this out the hard way.)
The solution we now adopt adds include_module declarations to the
parents of any submodule only once the parse tree of the entire
file has been processed, since only then do we know all the
includer/included relationships among nested modules. Until then,
we just record such relationships in a database as we discover them,
reporting duplicates when needed (e.g. when A includes B twice
*in the same section*), but not reporting duplicates when not needed
(e.g. when A.B includes A.B.C in *different* sections).
compiler/prog_data.m:
Add a new type, pf_sym_name_and_arity, that exactly specifies
a predicate or function. It is a clone of the existing simple_call_id
type, but its name does NOT imply that the predicate or function
is being called.
Add XXXs that call for some other improvements in type names.
compiler/prog_data_foreign.m:
Give a type, and the operations on that type, a more specific name.
compiler/error_util.m:
Add an id field to all error_specs, which by convention should be
filled in with $pred. Print out the value in this field if the compiler
is invoked with the developer-only option --print-error-spec-id.
This allows a person debugging the compiler find out where in the code
an undesired error message is coming from significantly easier
than was previously possible.
Most of the modules that have changes only "to conform to the changes
above" will be for this change. In many cases, the updated code
will also simplify the creation of the affected error_specs.
Fix a bug that looked for a phase in only one kind of error_spec.
Add some utility operations needed by other parts of this change.
Delete a previously internal function that has been moved to
mdbcomp/prim_data.m to make it accessible in other modules as well.
compiler/Mercury.options:
Ask the compiler to warn about dead predicates in every module
touched by this change (at least in one its earlier versions).
compiler/add_foreign_enum.m:
Replace a check for an inappropriately placed foreign_enum declaration
with a sanity check, since with this diff, the error should be caught
earlier.
compiler/add_mutable_aux_preds.m:
Delete a check for an inappropriately placed mutable declaration,
since with this diff, the error should be caught earlier.
compiler/add_pragma.m:
Instead of adding pass2 and pass3 pragmas, add decl and impl and
generated pragmas.
Delete the tests for generated pragma occurring anywhere except
.opt files, since those tests are now done earlier.
Shorten some too-long predicate names.
compiler/comp_unit_interface.m:
Operate on as specific kinds of parse trees as the interface of this
module will allow. (We could operate on more specific parse trees
if we changed the interface, but that is future work).
Use the same predicates for handling duplicate include_module,
import_module and use_module declarations as everywhere else.
Delete the code of an experiment that shouldn't be needed anymore.
compiler/equiv_type.m:
Replace code that operated on item blocks with code that operates
on various kinds of parse trees.
Move a giant block of comments to the front, where it belongs.
compiler/hlds_module.m:
Add a field to the module_info that lets us avoid generating
misleading error messages above missing definitions of predicates
or functions when those definitions were present but were not
added to the HLDS because they had errors.
Give a field and its access predicates a more specific name.
Mark a spot where an existing type cannot express everything
it is supposed to.
compiler/hlds_pred.m:
For predicates which the compiler creates to represent a class method
(the virtual function, in OOP terms), record not just this fact,
but the id of the class and of the method. Using this extra info
in progress messages (with mmc -V) prevents the compiler from printing e.g.
% Checking typeclass constraints on class method
% Checking typeclass constraints on class method
% Checking typeclass constraints on class method
when checking three such predicates.
compiler/make.m:
Provide a slot in the make_info structure to allow the database
of the files we have read in to be passed around.
compiler/make_hlds_error.m:
Delete predicates that are needed in just one other module,
and have therefore been moved there.
compiler/make_hlds_passes.m:
Add decl, impl and generated pragma separately, instead of adding
pass2 and pass3 pragmas separately.
Do not generate error messages for clauses, initialises or finalises
in module interfaces, since with this diff, such errors should be
caught earlier.
compiler/mercury_compile_main.m:
compiler/recompilation.check.m:
Explicitly pass around the expanded database of parse trees
of files that have been read in.
compiler/module_qual.collect_mq_info.m:
compiler/module_qual.m:
compiler/module_qual.qualify_items.m:
Collect module qualification information, and do module qualification
respectively on parse trees of various kinds, not item blocks.
Take information about what the module may do with the contents
of each interface or optimization file from the record of why
we read that file, not from the section markers in item blocks.
Break up some too-large predicates by carving smaller ones out of them.
compiler/options.m:
Add an option to control whether errors and/or warnings detecting
when deciding what should go into a .intN file be printed,
thus (potentially) preventing the creation of that file.
Add commented-out documentation for a previously totally undocumented
option.
doc/user_guide.texi:
Document the new option.
NEWS:
Announce the new option.
Mention that we now generate warnings for unused import_module and
use_module declarations in the interface even if the module has
submodules.
compiler/write_module_interface_files.m:
Let the new option control whether we filter out any messages generated
when deciding what should go into a .intN file.
compiler/parse_item.m:
Delete actually_read_module_opt, since it is no longer needed;
its callers now call actually_read_module_{plain,trans}_opt instead.
Delete unneeded arguments from some predicates.
compiler/parse_module.m:
Delete some long unused predicates.
compiler/parse_pragma.m:
When parsing pragmas, wrap them up in the new decl, impl or generated
pragma kinds.
compiler/parse_tree_out.m:
Add predicates to write out each of the file-kind-specific parse trees.
compiler/parse_tree_out_pragma.m:
Add predicates to write out decl, impl and generated pragmas.
compiler/polymorphism.m:
Add a conditionally-enabled progress message, which can be useful
in tracking down problems.
compiler/prog_item_stats.m:
Conform NOT to the changes above beyond what is needed to let this module
compile. Let that work be done the next time the functionality of
this module is needed, by which time the affected data structures
maybe have changed further.
compiler/typecheck.m:
Fix a performance problem. With intermodule optimization, we read in
.opt files, some of which (e.g. list.opt and int.opt) contain promises.
These promises are read in as predicates with goal_type_promise,
but they do not have declarations of the types of their arguments
(since promises do not have declarations as such). Those argument types
therefore have to be inferred. That inference replaces the original
"I don't know" argument types with their actual types.
The performance problem is that when we change the recorded argument types
of a predicate, we require another loop over all the predicates in the
module, so that any calls to this predicate can be checked against
the updated types. This is as it should be for callable predicates,
but promises are not callable. So if all the *only* predicates whose
recorded argument types change during the first iteration to fixpoint
are promises, then a second iteration is not needed, yet we used to do it.
The fix is to replace the "Have the recorded types of this predicate
changed?" boolean flag with a bespoke enum that says "Did the checking
of this predicate discover a need for another iteration", and not
setting it when processing predicates whose type is goal_type_promise.
compiler/typecheck_errors.m:
Do not generate an error message for a predicate missing its clauses
is the clauses existed but were not added to the HLDS because they were
in the interface section.
When reporting on ambiguities (when a call can match more than one
predicate or function), sort the possible matches before reporting
them.
compiler/accumulator.m:
compiler/add_class.m:
compiler/add_clause.m:
compiler/add_foreign_proc.m:
compiler/add_mode.m:
compiler/add_pragma_tabling.m:
compiler/add_pragma_type_spec.m:
compiler/add_pred.m:
compiler/add_type.m:
compiler/canonicalize_interface.m:
compiler/check_for_missing_type_defns.m:
compiler/check_parse_tree_type_defns.m:
compiler/check_promise.m:
compiler/check_raw_comp_unit.m:
compiler/check_typeclass.m:
compiler/common.m:
compiler/compile_target_code.m:
compiler/compiler_util.m:
compiler/dead_proc_elim.m:
compiler/deps_map.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/du_type_layout.m:
compiler/field_access.m:
compiler/find_module.m:
compiler/float_regs.m:
compiler/format_call.m:
compiler/goal_expr_to_goal.m:
compiler/handle_options.m:
compiler/hlds_out_module.m:
compiler/hlds_out_pred.m:
compiler/hlds_out_util.m:
compiler/inst_check.m:
compiler/intermod.m:
compiler/introduce_parallelism.m:
compiler/layout_out.m:
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make_hlds_warn.m:
compiler/mark_tail_calls.m:
compiler/mercury_compile_llds_back_end.m:
compiler/ml_top_gen.m:
compiler/mmakefiles.m:
compiler/mode_errors.m:
compiler/mode_robdd.equiv_vars.m:
compiler/modes.m:
compiler/module_qual.qual_errors.m:
compiler/oisu_check.m:
compiler/old_type_constraints.m:
compiler/options_file.m:
compiler/parse_class.m:
compiler/parse_dcg_goal.m:
compiler/parse_goal.m:
compiler/parse_inst_mode_defn.m:
compiler/parse_inst_mode_name.m:
compiler/parse_mutable.m:
compiler/parse_sym_name.m:
compiler/parse_type_defn.m:
compiler/parse_type_name.m:
compiler/parse_type_repn.m:
compiler/parse_types.m:
compiler/parse_util.m:
compiler/parse_vars.m:
compiler/post_term_analysis.m:
compiler/post_typecheck.m:
compiler/prog_event.m:
compiler/prog_mode.m:
compiler/purity.m:
compiler/qual_info.m:
compiler/recompilation.version.m:
compiler/resolve_unify_functor.m:
compiler/simplify_goal.m:
compiler/simplify_goal_call.m:
compiler/simplify_goal_disj.m:
compiler/simplify_goal_ite.m:
compiler/simplify_proc.m:
compiler/state_var.m:
compiler/stratify.m:
compiler/style_checks.m:
compiler/superhomogeneous.m:
compiler/table_gen.m:
compiler/term_constr_errors.m:
compiler/term_errors.m:
compiler/termination.m:
compiler/trace_params.m:
compiler/unused_args.m:
compiler/unused_imports.m:
compiler/write_deps_file.m:
compiler/xml_documentation.m:
Conform to the changes above.
mdbcomp/prim_data.m:
Move a utility function on pred_or_funcs here from a compiler module,
to make it available to other compiler modules as well.
scripts/compare_s1s2_lib:
A new script that helped debug this diff, and may help debug
similar diffs the future. It can compare (a) .int* files, (b) .*opt
files, (c) .mh/.mih files or (d) .c files between the stage 1 and
stage 2 library directories. The reason for the restriction
to the library directory is that any problems affecting the
generation of any of these kinds of files are likely to manifest
themselves in the library directory, and if they do, the bootcheck
won't go on to compile any of the other stage 2 directories.
tests/debugger/breakpoints.a.m:
tests/debugger/breakpoints.b.m:
Move import_module declarations to the implementation section
when they are not used in the interface. Until now, the compiler
has ignored this, but this diff causes the compiler to generate
a warning for such misplaced import_module declarations even modules
that have submodules. The testing of such warnings is not the point
of the breakpoints test.
tests/invalid/Mercury.options:
Since the missing_interface_import test case tests error messages
generated during an invocation of mmc --make-interface, add the
new option that *allows* that invocation to generate error messages.
tests/invalid/ambiguous_overloading_error.err_exp:
tests/invalid/max_error_line_width.err_exp:
tests/warnings/ambiguous_overloading.exp:
Expect the updated error messages for ambiguity, in which
the possible matches are sorted.
tests/invalid/bad_finalise_decl.m:
tests/invalid/bad_initialise_decl.m:
Fix programming style.
tests/invalid/bad_item_in_interface.err_exp:
Expect an error message for a foreign_export_enum item in the interface,
where it should not be.
tests/invalid/errors.err_exp:
Expect the expanded wording of a warning message.
tests/invalid/foreign_enum_invalid.err_exp:
Expect a different wording for an error message. It is more "standard"
but slightly less informative.
tests/invalid_submodules/children2.m:
Move a badly placed import_module declaration, to avoid having
the message the compiler now generates for it from affecting the test.
tests/submodules/parent2.m:
Move a badly placed import_module declaration, to avoid having
the message the compiler now generates for it from affecting the test.
Update programming style.
Until now, we have supported two variants of trailing grades, those that use a
fixed-size trail (.tr) and those that use trail segments (.trseg). This change
removes support for fixed sized trails, and renames the .trseg grade component
to .tr. The .trseg grade now acts a synonym for .tr; it is deprecated, since we
intend to eventually delete it. Until then, the behavior of the old .tr grade
component should be available, though to developers only, by compiling the
whole system with EXTRA_CFLAGS = -DMR_USE_FIXED_SIZE_TRAIL.
runtime/mercury_conf_param.h:
Delete the MR_TRAIL_SEGMENTS macro. Its effect is now implied by
MR_USE_TRAIL, unless a new macro, MR_USE_FIXED_SIZE_TRAIL, is defined.
Developers can use this new macro to disable trail segments, should the
need for doing that arise.
runtime/mercury_grade.h:
Add a new macro that defines a binary compatibility version number for
trailing; use that in the grade part for trailing.
Use "_trfix" or "_trseg" as the prefix of the trailing part of the
MR_GRADE_VAR depending on if MR_USE_FIXED_SIZE_TRAIL is defined or
not.
runtime/mercury_trail.[ch]:
runtime/mercury_context.h:
Enable trail segments by default, only disabling them if
MR_USE_FIXED_SIZE_TRAIL is enabled.
runtime/mercury_wrapper.c:
trace/mercury_trace_cmd_developer.c:
Conform to the above changes.
compiler/compile_target_code.m:
Do not pass options for trail segments to the C compiler.
compiler/compute_grade.m:
Treat trseg as a synonym for tr.
compiler/options.m:
Deprecate --trail-segments.
grade_lib/grade_spec.m:
grade_lib/grade_string.m:
grade_lib/grade_structure.m:
grade_lib/grade_vars.m:
grade_lib/try_all_grade_structs.m:
grade_lib/var_value_names.m:
Remove the trseg component.
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/parse_grade_options.sh-subr:
Remove support for the --trail-segments option.
doc/user_guide.texi:
Update the documentation for the --trail-segments.
Comment out the documentation of the --trail-size and --trail-size-kwords
runtime options; they are no longer useful to non-developers.
NEWS:
Announce this change.
Use the non-hyphenated forms of "submodule" and "fully qualified" throughout.
doc/reference_manual.texi:
doc/user_guide.texi:
compiler/add_type.m:
compiler/deps_map.m:
compiler/module_imports.m:
compiler/pred_table.m:
compiler/process_util.m:
compiler/status.m:
As above.
doc/reference_manual.texi:
Document the new requirement on `:- module' declarations for separate
submodules. Note that the implementation allows partial
qualification in the corresponding `:- end_module' declaration.
Clarify that a sentence applies to declarations for *nested*
submodules.
Reword the second of two paragraphs beginning with "Note that".
NEWS:
Announce the change.
This should fix Mantis bug #489, which shows that without this,
the compiler can mistakenly believe that a file with a name such as lexer.m
contains a module of the standard library, rather than a submodule named
test.lexer.
compiler/parse_module.m:
Require that :- module declarations specify the expected name.
The name may be expected because it exactly matches the filename
(as above), or because mmc -f has recorded the actual name
as the expectation.
Factor report_module_has_unexpected_name out of
check_module_has_expected_name, since it is needed on its own.
Simplify its code.
Simplify the code for doing checks on :- end_module declarations.
doc/reference_manual.texi:
Document this change in the reference manual.texi.
Replace references to "the University of Melbourne Mercury implementation"
with just "the Melbourne Mercury implementation".
slice/Mmakefile:
Run mmc -f *.m before making dependencies, because the modules copied
from mdbcomp have non-fully-qualified filenames.
*/Mmakefile:
Delete inappropriate .PHONY directives from Mercury.modules targets.
Include Mercury.modules among the files to be deleted by clean_local
targets.
tests/submodules/ts.tsub.m:
Provide the full name of this module in its :- module declaration.
tests/submodules/initialise_parent.initialise_child.m:
Fix white space.
tests/submodules/*.*.m:
Move separate submodules to their fully qualified filenames.
NEWS:
As above.
doc/reference_manual.texi:
Document the syntax extension.
Use it in some later examples of inst use.
Change the definition of the maybeskel inst to do the same job for maybes
that the listskel inst does for lists, which is what its name suggests
it should have done all along.
doc/reference_manual.texi:
Do not compare tokens and terms in Mercury to those in ISO Prolog.
Unless the reader has a copy of the standard to hand doing so isn't all
that helpful -- it doesn't really add anything in any case. (The
transition guide already points out the differences for those coming
to Mercury from Prolog.)
library/parser.m:
Delete some irrelevant comments, viz. the parser is intended to
follow ISO Prolog, where Fergus was in relation to his copy of
the ISO draft and some stuff about NU-Prolog compatibility hacks
that were removed years ago.
Utilise the available space better.
While the existing obsolete pragma declares an entire predicate or function
obsolete, the new obsolete_proc pragma does this for only THE NAMED MODE
of a predicate or function.
NEWS:
doc/reference_manual.texi:
Mention and document the new pragma.
compiler/prog_item.m:
Add the new pragma. Rename the old pragma to "obsolete_pred". (This affects
only the compiler's internal name; the user visible name stays the same.)
Move a type definition next to its related types.
compiler/parse_pragma.m:
Read in the new pragma.
compiler/hlds_pred.m:
Create a slot in proc_infos for the information in the new pragma.
compiler/add_pragma.m:
Add the new pragma to the HLDS.
To avoid adding to the substantial existing code duplication in this
module, factor out two commonly recurring pieces of code: one that
looks up the (hopefully unique) pred_id specified by a pragma, and
one that looks up and (if found) transforms the procedure specified
by a pragma.
Use error-message phraseology consistent with that employed by
the newly-factored-out predicate even in places that cannot use them.
Move the code handling foreign_export pragma here from add_foreign_proc.m
to take advantage of the newly-factored out predicates.
compiler/add_foreign_proc.m:
Delete the code moved to add_pragma.m.
Fix the structure of the remaining code by putting related code fragments
next to each other.
compiler/simplify_goal_call.m:
Generate warnings to obsolete procedures as well as obsolete predicates.
compiler/parse_tree_out_pragma.m:
Output the new pragma.
Factor out existing common code.
compiler/hlds_code_util.m:
Put a predicate's arguments into a more meaningful order.
compiler/make_hlds_error.m:
Allow the caller of report_undefined_pred_or_func_error to specify
whether the error applies to a predicate or a function. Most callers
don't have that info, but some do, and using this info when available
allows us to generate a more specific error message.
compiler/add_clause.m:
Conform to the changes above.
Make a predicate easier to read by moving unimportant code out-of-line.
compiler/intermod.m:
Conform to the changes above. Do this in a way that is adaptable to
making intermod.m generate lists of items instead of simply writing
stuff out, even though this makes the diff to this file more complex
than immediately necessary.
compiler/add_mutable_aux_preds.m:
compiler/add_pragma_type_spec.m:
compiler/canonicalize_interface.m:
compiler/equiv_type.m:
compiler/get_dependencies.m:
compiler/item_util.m:
compiler/make_hlds_passes.m:
compiler/make_hlds_separate_items.m:
compiler/module_qual.qualify_items.m:
compiler/prog_data_pragma.m:
compiler/prog_item_stats.m:
compiler/recompilation.version.m:
Conform to the changes above.
compiler/options.m:
Provide a simple way for the configure script to test for the presence
of this new addition.
tests/invalid/obsolete_proc_pragma.{m,err_exp}:
A test case for the new pragma.
tests/invalid/Mmakefile:
tests/invalid/Mercury.options:
Enable the new test case, and set it to run with --halt-at-warn.
tests/invalid/bug83.err_exp:
tests/invalid/require_tailrec_invalid.err_exp:
Update these two files to expect updated error messages.
doc/user_guide.texi:
Libraries that import their modules in the interface get warnings
for such unused-in-the-interface imports, so recommend that
library writers put these imports into the implementation section.
Mention how to avoid a warning for empty interface sections, which may
result from following this advice.
Import and include modules one per line.
compiler/parse_tree_out.m:
As a first step toward disallowing any module qualification on the names
of constants in foreign_enum pragmas, do not generate any such qualifiers
when writing foreign_enum pragmas to interface files.
compiler/parse_pragma.m:
When reading in constant names in foreign_enum pragmas, insist on any
module qualification to be for the current module. This is to allow
the checks for this error to be removed from the rest of the compiler,
which will be needed when the representation of foreign_enums is changed
to store constant names as just strings, not sym_names.
compiler/options.m:
Provide a mechanism to test whether the installed compiler has this change.
The second step of this change will require this first step in order to
avoid problems with module qualified constant names in .int files.
doc/reference_manual.texi:
Make the proposed rule against module qualification of constants
in foreign_enums explicit.
tests/hard_coded/foreign_enum_mod2.m:
Delete qualifiers on constant names.
Until now, we have generated warnings about occurs check violations
in the HLDS. Since the HLDS is in superhomogeneous form, this means
we warn for X = f(X), but not for Xs = [X1, X2 | Xs]. The reason is
that the latter expands to Xs = [X1 | Xs1], Xs1 = [X2 | Xs],
and neither of those two unifications fails the occurs check by itself.
This diff switches to having that warning be generated during the creation
of the HLDS, by code that works on the original parse tree. That means
we can now generate warnings for code such as Xs = [X1, X2 | Xs].
NEWS:
Mention that fact.
compiler/superhomogeneous.m:
While expanding terms into superhomogeneous form, keep track
of which variables have been unified with a term *or an ancestor
of that term*. In the case above, we know that Xs1 is *part of* Xs,
so unifying it with [X2 | Xs] is an occurs check violation.
Conditionally generate a warning for such violations. This is only
a warning, because in the parse tree, function symbols can be not just
data constructors but also function applications, and we can't
say which is which. While X = f(X) is a real problem if f is
a data constructor, it may be perfectly ok code (a test for a
fixpoint) if f is a function.
compiler/modecheck_unify.m:
Disable the HLDS version of this warning, to avoid warning
about the problem twice. (This diff leaves the infrastructure
supporting the HLDS warning remains in place, in case we want
to enable it again.)
compiler/options.m:
Add the new warning option that the new warning is conditional on.
compiler/prog_data.m:
Add the new warning to the list of warnings that may be disabled
by a disable_warnings scope.
Change code to avoid the new warning.
compiler/goal_expr_to_goal.m:
Disable the new warning in goals inside a disable_warnings scope
that asks for it to be disabled.
compiler/parse_goal.m:
Parse the new warning in disable_warnings scopes.
compiler/prog_out.m:
Output the new warning in disable_warnings scopes.
compiler/simplify_goal_scope.m:
Ignore the new warning in disable_warnings scopes, since it is not
for use here.
library/term_to_xml.m:
Change code to avoid the new warning.
doc/reference_manual.texi:
doc/user_guide.texi:
Document the new warning option, and the means of suppressing the
warning using a disable_warnings scope.
tests/invalid/ambiguous_overloading_error.err_exp:
tests/invalid/max_error_line_width.err_exp:
tests/invalid/occurs.err_exp:
tests/warnings/unify_x_f_x.exp:
Update these expected outputs to expect the new warning,
and (in some cases) not to expect its HLDS version.
tests/warnings/occurs.{m,exp}:
A new test case to test not just the warning (the tests above do that
already) but also its suppression.
tests/warnings/Mmakefile:
Enable the new test case.
doc/reference_manual.texi:
NEWS:
Document the extension.
compiler/prog_item.m:
Add a field to the representation of obsolete pragmas to hold
an optional list of suggested possible replacements.
compiler/parse_pragma.m:
Parse the optional second argument in obsolete pragmas.
Improve the error messages we generate for several kinds of errors
we may encounter when parsing pragmas by making them more specific.
compiler/hlds_pred.m:
Since an obsolete pragma now contains more than one bit of information
(present vs not present), change their representation from a simple marker
to a field containing the possible replacements.
Make a comment about access stats more useful by sorting its contents
on frequency of access, and putting it before the structure it is about.
compiler/simplify_goal_call.m:
When generating warnings about calls to obsolete predicates or functions,
mention the suggested replacements, if there are any.
compiler/add_pragma.m:
Fill in the new field when adding an obsolete pragma to the HLDS.
compiler/globals.m:
Add a function for use by new codee in parse_pragma.m.
compiler/canonicalize_interface.m:
compiler/equiv_type.m:
compiler/get_dependencies.m:
compiler/hlds_out_pred.m:
compiler/intermod.m:
compiler/item_util.m:
compiler/make_hlds_separate_items.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out_pragma.m:
compiler/prog_item_stats.m:
compiler/recompilation.version.m:
compiler/table_gen.m:
Conform to the changes above.
tests/invalid/bad_foreign_code.err_exp:
tests/invalid/bad_foreign_enum.err_exp:
tests/invalid/bad_foreign_export.err_exp:
Expect the improved error messages from parse_pragma.m.
tests/warnings/simple_code.{m,exp}:
Add tests of the new forms of the obsolete pragma.
Update the description of the --auto-comments option to reflect that it also
applies to the non-C backends as well as the C backends.
compiler/options.m:
As above.
doc/user_guide.texi:
Update description of --auto-comments.
Delete a couple of stray references to the IL backend.