Commit Graph

505 Commits

Author SHA1 Message Date
Zoltan Somogyi
e08b8505e9 Import the parents of *all* imported modules. 2019-03-29 12:56:35 +11:00
Zoltan Somogyi
d49f6eab84 Add missing imports of parent modules.
These imports were missing from source files, but were included in imported
modules' .int3 files. An upcoming change will delete these from those .int3
files.
2019-03-20 03:57:10 +11:00
Peter Wang
5686126f21 Use non-minified copies of jQuery and jsTree.
The Debian packaging system complains about minified files not being
built from non-minified sources so distribute and install the
non-minified sources instead. Fixes Mantis bug #473.

scripts/jquery.slim.js
    Add non-minified copy of jQuery slim 3.3.1 from https://jquery.com/

scripts/jstree.js
scripts/jstree.style.css
    Add non-minified copy of jsTree 3.2.1 from https://www.jstree.com/

scripts/jquery.slim.min.js:
scripts/jstree.min.js:
scripts/jstree.style.min.css:
    Delete old minified files.

LICENSE:
browser/term_to_html.m:
scripts/Mmakefile
    Update paths.
2018-11-19 11:42:45 +11:00
Zoltan Somogyi
1f8d8aeabf Warn about non-contiguous clauses in the Mercury system by default.
configure.ac:
    Require the installed compiler to have the recent bug fix to
    contiguity warnings, since without that bug fix, we get warnings
    for code that is actually perfectly ok.

browser/MDB_FLAGS.in:
compiler/COMP_FLAGS.in:
deep_profiler/DEEP_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
mfilterjavac/MFILTERJAVAC_FLAGS.in:
profiler/PROF_FLAGS.in:
slice/SLICE_FLAGS.in:
ssdb/SSDB_FLAGS.in:
    Specify both --warn-non-contiguous-clauses and
    --warn-non-contiguous-foreign-procs as the default in each directory.

library/Mercury.options:
    Disable the warnings for exception.m and io.m, which are have not
    been cleaned up yet wrt these warnings.
2018-11-14 18:56:13 +11:00
Zoltan Somogyi
c7f8ebbe2f Avoid warnings from --warn-non-contiguous-{clauses,foreign-procs}.
browser/collect_lib.m:
browser/declarative_execution.m:
browser/dl.m:
browser/io_action.m:
compiler/make.util.m:
compiler/pickle.m:
compiler/process_util.m:
compiler/prog_event.m:
library/array.m:
library/benchmarking.m:
library/bit_buffer.m:
library/builtin.m:
library/char.m:
library/deconstruct.m:
library/dir.m:
library/erlang_rtti_implementation.m:
library/int.m:
library/int16.m:
library/int32.m:
library/int64.m:
library/int8.m:
library/io.m:
library/math.m:
library/mutvar.m:
library/private_builtin.m:
library/profiling_builtin.m:
library/rtti_implementation.m:
library/store.m:
library/string.format.m:
library/string.m:
library/table_builtin.m:
library/term_size_prof_builtin.m:
library/thread.m:
library/time.m:
library/type_desc.m:
library/uint16.m:
library/uint32.m:
library/uint64.m:
library/uint8.m:
ssdb/ssdb.m:
    As above. This mostly involved two things.

    The first was grouping foreign_procs by predicate instead of by language.
    In a few cases, this revealed that some predicates *had* no foreign_proc
    for a language, while related predicates did have one that just aborted
    if called. This diff adds similar aborting foreign_procs to predicate/
    language combinations that were missing them, when this seemed obviously
    the right thing to do.

    The second was moving pragmas about a predicate from the middle of the
    block of clauses of that predicate to the start of that block.
2018-10-19 11:01:33 +11:00
Julien Fischer
c5ac31fdcb Enable --warn-suspicious-foreign-code.
Enable the recently added --warn-suspicious-foreign-code warning by default for
the Mercury system.

configure.ac:
    Check that --warn-suspicious-foreign-code is supported by the bootstrap
    compiler

browser/MDB_FLAGS.in:
compiler/COMP_FLAGS.in:
deep_profiler/DEEP_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
slice/SLICE_FLAGS.in:
ssdb/SSDB_FLAGS.in:
profiler/PROF_FLAGS.in:
     Enable the option.
2018-10-08 09:33:24 +00:00
Zoltan Somogyi
4d37389b7a Reorder structure args to enable better packing. 2018-09-05 09:40:44 +10:00
Zoltan Somogyi
2bfe4d402c Compile everything with --halt-at-warn-if-possible. 2018-08-02 14:45:42 +10:00
Julien Fischer
46fbdba449 Workaround limitations of the Roslyn C# compiler on non-Windows systems.
Signing assemblies with a strong name does not work with the Rosyln C# compiler
on non-Windows systems.  Delay sign assemblies on non-Windows system instead
when using this compiler.  (This is what the Mono documentation currently
recommends.)

configure.ac:
browser/MDB_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
ssdb/SSDB_FLAGS.in:
   As above.
2018-07-29 00:51:54 +10:00
Julien Fischer
f54fe5f846 Update references to the IL backend.
browser/Mmakefile:
compiler/options.m:
library/array.m:
    As above.
2018-06-15 07:48:56 -04:00
Mark Brown
d465fa53cb Update the COPYING.LIB file and references to it.
Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.

COPYING.LIB:
    Add a special linking exception to the LGPL.

*:
    Update references to COPYING.LIB.

    Clean up some minor errors that have accumulated in copyright
    messages.
2018-06-09 17:43:12 +10:00
Zoltan Somogyi
310048037c Try to guard against future bitrot.
tools/bootcheck:
    Build the dependencies for auxiliary programs, and the programs themselves,
    in the browser and profiler directories.

Mmakefile:
    Provide targets for bootcheck to use to make dependencies for the
    auxiliary programs in the browser and profiler directories.

browser/Mmakefile:
    Take the two aux programs in this directory out of the "all" target.
    Due to past bitrot, one gets errors during compilation, the other
    during linking. (The "all" target is not used by default, which is why
    this has not been a problem.)

    Add depend_aux and aux targets that should build these programs
    if they are ever fixed. The aux target is empty for now; the depend_aux
    target does make dependencies for both aux programs (since that still
    works, and we want to keep it that way).

profiler/Mmakefile:
    Add depend_aux and aux targets that build the one auxiliary program
    in this directory that works now. Add a comment about the other program
    that doesn't.
2018-01-09 01:05:42 +11:00
Zoltan Somogyi
5a7809b69c Document some bitrot.
browse_test.m:
    Fix all compilation errors in this test program. Some link errors
    remain.

declarative_test.m:
    Fix some compilation errors in this test program. (I don't know what
    the right fix is for the remaining errors.)

Mmakefile:
    Document the fact that neither program compiles cleanly anymore.
2017-12-30 15:18:37 +11:00
Zoltan Somogyi
bb3ef7de5d Fix indentation. 2017-12-30 15:17:20 +11:00
Zoltan Somogyi
014ca2144b Enable --warn-insts-with-functors-without-type.
configure.ac:
    Require that the installed compiler support this option (which I added
    about two weeks ago).

browser/MDB_FLAGS.in:
compiler/COMP_FLAGS.in:
deep_profiler/DEEP_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
mfilterjavac/MFILTERJAVAC_FLAGS.in:
profiler/PROF_FLAGS.in:
slice/SLICE_FLAGS.in:
ssdb/SSDB_FLAGS.in:
    Specify this option by default for every directory that contains
    Mercury code.
2017-11-22 01:48:36 +11:00
Zoltan Somogyi
d9e576a2b2 Specify the type for inst definitions.
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
library/*.m:
mdbcomp/*.m:
ssdb/*.m:
    Specify the type constructor for every inst definition that lists
    the functors that values of that type may be bound to.

    In library/maybe.m, delete the inst maybe_errors/1, because
    (a) its name is misleading, since it is for the maybe_error/1 type (no s),
    and (b) there is already an inst with the non-misleading name maybe_error
    which had an identical definition.

    In compiler/dep_par_conj.m, delete two insts that were duplicates
    of insts defined in hlds_goal.m, and replace references to them
    accordingly.
2017-11-08 16:54:18 +11:00
Julien Fischer
ba24a880fe Add targets for building stage 3 C# source files.
browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
    Add the 'css' target for building the C# source files.
2017-10-22 06:38:07 -04:00
Julien Fischer
345bdfff55 Add targets for building the Java source files only.
browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
mdbcomp/mdbcmp/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
    As above (required for stage 3).

    Delete residual references to the IL backend.
2017-10-21 21:36:40 -04:00
Peter Wang
c2a45192f4 Address Zoltan's review of the web-browser based term browser change.
browse.m:
    Remove the correct temporary file in
    save_and_browse_browser_term_web.

    Reword instructions when web_browser_cmd is not set.

term_to_html.m:
    Reword a comment.
2017-08-17 11:11:55 +10:00
Zoltan Somogyi
e5c7e1c92e Fix a namespace pollution problem.
browser/percent_encoding.m:
    Make this module a submodule of mdb.m. Without this, the Mercury compiler
    creates symbol names for its exported predicates that do not begin with
    one of the prefixes reserved for the Mercury implementation, thus
    potentially clashing with symbols that may be used by user code.

browser/mdb.m:
    Add the new module to this package.

browser/term_to_html.m:
    Update the import of percent_encoding.m.
2017-08-17 06:49:36 +10:00
Peter Wang
05c0847173 Delete unused option in browser_params_to_string.
browser/browser_info.m:
    browser_params_to_string supported an option to print the browser
    persistent state in a friendly format instead of as mdb commands.
    The option was never used, so delete it.

    (Fixes an unreachable bug where that unused code path did not print
    the web_browser_cmd value.)

trace/mercury_trace_browse.c:
trace/mercury_trace_browse.h:
trace/mercury_trace_cmd_misc.c:
    Update the caller.
2017-08-15 17:56:32 +10:00
Peter Wang
dff60fae93 Don't hex encode non-ASCII code points in JavaScript string literals.
term_to_html.m:
    Write non-ASCII code points in their UTF-8 encoding. There is no
    need to write them as hexadecimal escaped UTF-16 code units.
2017-08-15 17:41:59 +10:00
Peter Wang
0d273769fc Add web browser-based term browsing in the debugger.
browser/browse.m:
    Add save_and_browse_browser_term_web to be called when
    "browse --web" is entered at the mdb prompt.

    Add browser_term_to_html_flat_string, a helper predicate for
    term_to_html.

    Make portray_flat_write_browser_term work take a stream parameter
    instead of writing to the current output stream. It is called by
    browser_term_to_html_flat_string, writing to a string builder
    stream.

browser/browser_info.m:
    Add web_browser_cmd field to browser_persistent_state.

browser/mdb.m:
browser/term_to_html.m:
    Add new module to generate an HTML document. The document contains a
    JavaScript represention of a Mercury term.

    (The JavaScript string escaping code is adapted from Julien's
    mercury-json project.)

browser/percent_encoding.m:
    Add new module to perform percent-encoding.

scripts/mdb_term_browser.css:
scripts/mdb_term_browser.js:
    Add JavaScript and CSS files referenced by the generated HTML file
    to create a tree view of a Mercury term using jstree.

scripts/32px.png:
scripts/40px.png:
scripts/throbber.gif:
scripts/jstree.min.js:
scripts/jstree.style.min.css:
    Add local copy of jstree files <https://www.jstree.com/>

scripts/jquery.slim.min.js:
    Add local copy of jquery <https://jquery.com/>

scripts/Mmakefile:
    Install the new files into the same directory as mdbrc and other
    mdb-related files.

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:
    Add "browse --web" and "web_browser_cmd" commands.

doc/user_guide.texi:
    Document "browse --web" and "web_browser_cmd" commands.

configure.ac:
scripts/mdbrc.in:
    Set a reasonable default command to launch a web browser from mdb.
    (Only tested on Linux.)

NEWS:
    Announce the new feature.

.README.in:
    Mention jquery and jstree licensing.

tests/debugger/Mmakefile:
tests/debugger/completion.exp:
tests/debugger/mdb_command_test.inp:
tests/debugger/save.exp2:
    Update debugger tests for new commands.
2017-08-15 16:14:55 +10:00
Zoltan Somogyi
22eefb3c88 Shut up determinism warnings for "sorry" fallback clauses.
Many predicates that do their jobs via foreign_procs in C have a fallback
Mercury clause for non-C backends, which usually throws an exception.
When compiled in non-C grades, these often get a warning that their
determinism declaration could have been tigther, e.g. erroneous instead of det.

*.m:
    Add no_determinism_warnings pragmas before such fallback clauses.

library/dir.m:
    As above, but also remove the unnecessary "dir." prefix on many predicate
    declarations and clause heads.
2017-08-10 18:02:42 +02:00
Zoltan Somogyi
6ea8406ac8 Fix more warnings from --warn-inconsistent-pred-order-clauses.
browser/browse.m:
browser/browser_info.m:
browser/collect_lib.m:
browser/debugger_interface.m:
browser/declarative_analyser.m:
browser/declarative_debugger.m:
browser/declarative_edt.m:
browser/declarative_execution.m:
browser/declarative_oracle.m:
browser/declarative_test.m:
browser/declarative_tree.m:
browser/declarative_user.m:
browser/diff.m:
browser/dl.m:
browser/frame.m:
browser/help.m:
browser/interactive_query.m:
browser/io_action.m:
browser/listing.m:
browser/mdb.m:
browser/mer_browser.m:
browser/name_mangle.m:
browser/term_rep.m:
browser/tree234_cc.m:
    Fix inconsistencies between (a) the order in which functions and predicates
    are declared, and (b) the order in which they are defined.

    In most modules, either the order of the declarations or the order
    of the definitions made sense, and I changed the other to match.
    In some modules, neither made sense, so I changed *both* to an order
    that *does* make sense (i.e. it has related predicates together).

    In some places, put dividers between groups of related
    functions/predicates, to make the groups themselves more visible.

    In some places, fix comments or programming style.

browser/MDB_FLAGS.in:
    Since all the modules in this directory are now free from any warnings
    generated by --warn-inconsistent-pred-order-clauses, specify that option
    by default in this directory to keep it that way.
2017-04-29 14:08:50 +10:00
Zoltan Somogyi
baddfd37cd Make --warn-unused-imports the default for the Mercury system.
browser/MDB_FLAGS.in:
compiler/COMP_FLAGS.in:
deep_profiler/DEEP_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
mfilterjavac/MFILTERJAVAC_FLAGS.in:
profiler/PROF_FLAGS.in:
slice/SLICE_FLAGS.in:
ssdb/SSDB_FLAGS.in:
    Add --warn-unused-imports to the list of default compiler flags
    for each directory.

compiler/ml_tailcall.m:
library/io.m:
    Delete some unused imports.
2017-01-19 10:48:04 +11:00
Peter Wang
13bd996453 Only pass -install_name option on Darwin.
The -install_name option broke building with mmake --use-mmake-make on
other operating systems.

browser/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
ssdb/Mmakefile:
    As above.
2016-09-29 12:23:22 +10:00
Zoltan Somogyi
0d13ab5e18 Improve the interface of pretty_printer.m.
library/pretty_printer.m:
    Make the changes indicated by the NOTE_TO_IMPLEMENTORS notes
    in my previous change.

NEWS:
    Announce the changes.

browser/browse.m:
tests/hard_coded/test_pretty_printer.m:
    Conform to the above change.
2016-08-09 02:42:00 +02:00
Zoltan Somogyi
1da267e9f0 Fix a bug in handling instances with --warn-unused-imports.
This fixes Mantis bug #412.

compiler/unused_imports.m:
    Consider that an instance declaration makes a module "used" only if
    it occurs in the module being compiled, not in an imported or ancestor
    module. (Mantis bug 412 was caused by instance declarations in implicitly
    imported modules.)

    Fixing #412 also exposed another bug. When computing the set of modules
    used by predicates, we considered (besides some non-type entities)
    only the types of the predicate's arguments, not the types of non-argument
    variables. In one case in the compiler (mmc_analysis.m), this lead to
    some actually-used modules not being marked as such, which lead to
    false unused-import warnings to be generated for them. Fix this by scanning
    the types of all variables in all of a predicate's procedures, not just
    the arguments.

    Improve the infrastructure for debugging similar problems.

    Note some possibilities for future improvement.

    Change a predicate name to fit the naming scheme.

compiler/analysis.m:
    Add an XXX about a possible improvement.

compiler/hlds_out_module.m:
    Make the output we generate for instance methods more readable.
    As part of this, fix an old bug in the printing of the instance table:
    the first line of the first method of each concrete instance declaration
    was accidentally commented out.

compiler/parse_tree_out.m:
    Export a different utility predicate for hlds_out_module.m. Make its name
    conform to the scheme used by related predicates.

browser/browse.m:
compiler/add_mutable_aux_preds.m:
compiler/add_pred.m:
compiler/add_special_pred.m:
compiler/check_for_missing_type_defns.m:
compiler/check_promise.m:
compiler/exception_analysis.m:
compiler/handle_options.m:
compiler/inst_match.m:
compiler/mercury_to_mercury.m:
compiler/ml_tailcall.m:
compiler/module_qual.m:
compiler/op_mode.m:
compiler/parse_inst_mode_defn.m:
compiler/parse_tree_out_clause.m:
compiler/parse_tree_out_info.m:
compiler/parse_tree_out_inst.m:
compiler/parse_tree_out_pragma.m:
compiler/parse_tree_out_pred_decl.m:
compiler/parse_tree_out_term.m:
compiler/parse_type_defn.m:
compiler/parse_type_name.m:
compiler/parse_util.m:
compiler/parse_vars.m:
compiler/prog_ctgc.m:
compiler/recompilation.usage.m:
compiler/resolve_unify_functor.m:
compiler/term_constr_main.m:
compiler/term_constr_main_types.m:
compiler/write_deps_file.m:
library/bt_array.m:
    Delete unused imports.

compiler/module_qual.qual_errors.m:
    Import a module that the parent module_qual.m doesn't import anymore.

tests/warnings/bug412.{m,exp}:
    The test case for this bug.

tests/warnings/Mmakefile:
tests/warnings/Mercury.options:
    Enable the new test case.

tests/invalid/import_in_parent.err_exp:
    Update the expected output for this test case. The parent module
    does not use the imported module (bool) at all, so this is what the
    error message says after this diff, though its submodule does use bool.
2016-07-17 10:20:29 +02:00
Paul Bone
39da4409ec Add .dep_err files to .gitignore
browser/.gitignore:
compiler/.gitignore:
deep_profiler/.gitignore:
library/.gitignore:
mdbcomp/.gitignore:
mfilterjavac/.gitignore:
profiler/.gitignore:
slice/.gitignore:
ssdb/.gitignore:
    As above.
2016-05-25 15:42:53 +10:00
Zoltan Somogyi
056d2213af Avoid using some Mercury keywords.
browser/browser_info.m:
    Avoid using "output" (and "input", for the sake of symmetry)
    as function symbols.

browser/debugger_interface.m:
    Avoid using "pred" and "func" as function symbols by putting a prefix
    before each function symbol in the affected type.

browser/dl.m:
    Avoid using "local" (and "global", again for symbols) as function symbols.

profiler/output_prof_info.m:
    Avoid using "output" as a type name and as a function symbol.

browser/browse.m:
browser/collect_lib.m:
browser/declarative_user.m:
browser/interactive_query.m:
profiler/generate_output.m:
profiler/output.m:
    Conform to the changes above.

extras/morphine/source/browse.op:
extras/morphine/source/collect.op:
extras/morphine/source/current_arg.op:
extras/morphine/source/current_slots.op:
extras/morphine/source/exec_control.op:
extras/morphine/source/forward_move.op:
extras/morphine/source/interactive_queries.op:
    Conform to the renames of the function symbols in debugger_interface.m.

    Since this code is in Prolog, I cannot be sure that I changed all the
    places that should be changed, but that does not matter much.

    Since Morphine was designed to work with the Prolog dialects of 1999,
    had its last update in 2002, and we never test it, it is very likely
    that it hasn't worked in a long time. We keep it around because
    (a) it may interest someone, and (b) it doesn't require significant
    maintenance. The fact that it does not run may be regrettable, but
    it is not actually regretted by many would-be users, or (even) any at all.

    (I actually noticed and fixed a bug while doing the above change:
    it was a typo in a function symbol name.)
2016-05-13 09:07:58 +10:00
Julien Fischer
e7010327d9 Delete references to picreg.
browser/interactive_query.m:
extras/dynamic_linking/Mmakefile:
extras/graphics/mercury_glut/Mmakefile:
extras/graphics/mercury_glut/Mmakefile.MacOSX:
extras/graphics/samples/calc/Makefile:
extras/graphics/samples/gears/Mmakefile:
extras/graphics/samples/maze/Mmakefile:
extras/graphics/samples/pent/Mmakefile:
extras/morphine/non-regression-tests/Mmakefile:
extras/morphine/source/collect.op:
    As above.
2016-04-26 14:03:04 +10:00
Zoltan Somogyi
be553f9b16 Turn off lcmc for modules that it doesn't help. 2016-04-26 12:51:56 +10:00
Paul Bone
652d89cf38 Add take_while and drop_while to the list module
Add new predicates and functions take_while and drop_while to the list
module.

Deprecate takewhile/4, replacing it with take_while/4.

library/list.m:
    As above.

NEWS:
    Announce this change.

browser/parse.m:
compiler/compute_grade.m:
compiler/deforest.m:
compiler/mercury_compile_main.m:
compiler/ml_optimize.m:
compiler/mode_robdd.equiv_vars.m:
compiler/options_file.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/structure_reuse.domain.m:
compiler/structure_sharing.domain.m:
compiler/term_constr_data.m:
compiler/write_deps_file.m:
compiler/xml_documentation.m:
deep_profiler/read_profile.m:
deep_profiler/top_procs.m:
library/list.m:
    Conform to above changes.
2016-04-22 21:27:03 +10:00
Mark Brown
8e0eb72c15 Various improvements to mdb's interactive query mechanism.
Estimated hours taken: 26

Implement the following improvements:
  - Pass mdb variable bindings to the interactive query processor,
    allowing queries to make use of live values.
  - Catch exceptions thrown by queries, rather than crashing mdb.
  - Write outputs using io.write_cc/3.
  - Don't output underscore variables, avoiding spurious warnings.
  - More protection of the user's namespace.
  - Updated the cleanup code.

browser/interactive_query.m:
    The interface now accepts corresponding lists of names and values,
    which are matched up with variables occurring in the queries.

    Replace the code generator with one that supports passing data
    to and from the query, and catching exceptions from the query.
    Pass the appropriate data at the time the query predicate is called.
    Distinguish between failure of the query and failure of the dynamic
    casts used to instantiate the query inputs.

    Use module qualifiers to avoid clashing with user imports. (Should the
    generated code use use_module, just in case?)

    Perform I/O, failure handling and exception handling in the caller
    instead of in the generated code. This is faster, more maintainable,
    and means that errors are caught earlier.

    Place source_file and line directives more carefully so as to ensure
    more consistent error messages, and to help distinguish errors in the
    template from errors in the query.

    Factor out the query command parser to avoid double maintenance.

browser/debugger_interface.m:
    Conform to above changes.

trace/mercury_trace_vars.[ch]:
    Export MR_trace_return_bindings, which constructs Mercury lists
    of the variable names and values in the current environment.

trace/mercury_trace_browse.c:
    Pass bindings from trace/mercury_trace_vars through to the interactive
    query processor.

tests/debugger/interactive.{m,inp,exp}:
    Update for changes to existing functionality. Additionally test the
    new functionality.

doc/user_guide.texi:
    Document the new behaviour.

NEWS:
    Announce the new behaviour.
2016-02-07 04:09:04 +11:00
Julien Fischer
1b17ed4d6c Fix a problem on OS X when building using --use-mmc-make.
The install names for Mercury shared libraries in the system were not being set
when building using --use-mmc-make.  The existing code in the Mmakefiles that
does this only works for mmake, not mmc --make.

browser/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
ssdb/Mmakefile:
    When using --use-mmc-make set up the options to set the dylib install
    names in such a way that mmc --make can see them.

    Don't hardcode the library names in the definitions that set the
    library install names.
2016-01-08 23:58:25 +11:00
Julien Fischer
fa36892439 Fix a compilation error.
browser/browse.m:
    Rename the version of the I/O state used inside a trace goal
    in order to avoid a warning about it shadowing the version in
    the enclosing scope.
2016-01-01 20:31:11 +11:00
Zoltan Somogyi
9a55512345 Delete some unused predicates. 2015-12-31 23:29:58 +11:00
Zoltan Somogyi
f2a2271bfb Put some debugging code in a trace scope. 2015-12-31 23:29:07 +11:00
Zoltan Somogyi
5890311825 Fix some unused predicate warnings.
browser/browse.m:
browser/declarative_edt.m:
compiler/continuation_info.m:
compiler/hlds_out_goal.m:
compiler/llds_out_file.m:
compiler/make.dependencies.m:
compiler/ml_closure_gen.m:
compiler/ml_elim_nested.m:
compiler/options_file.m:
compiler/prog_io_pragma.m:
deep_profiler/html_format.m:
    Delete some dead predicates that won't be needed anymore.

compiler/hlds_goal.m:
compiler/jumpopt.m:
    Comment out some dead predicates that may be needed later.

compiler/matching.m:
compiler/typecheck.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
    Convert some dead predicates into live predicates by adding calls to them
    at their intended call sites. In some cases the missing call was a sort-of
    bug (the code worked, but not as well as it should have). In others, the
    call was intended only for debugging, and the new call is in a trace scope
    that is disabled by default.

compiler/ml_foreign_proc_gen.m:
    Add an XXX comment about a dead procedure.
2015-12-06 09:49:53 +11:00
Julien Fischer
5dd80b230d Delete or deprecate obsolete builtin insts, modes and predicates.
Update the list of changes in the NEWS file  that potentially break backwards
compatibility.

library/builtin.m:
    Delete the builtin inst synonyms 'old' and 'new'.

    Delete the builtin builtin modes 'oo' and 'no'.

    Add a comment stating that the modes input/0 and output/0 are deprecated.

    Add obsolete pragmas for promise_only_solution/1 and
    promise_only_solution_io/4.

    Shift the description of the 'any' inst into the comment describing
    the other builtin insts.   Add the higher-order 'any' insts to this
    comment.

    Fix a typo in the description of the builtin higher-order insts: the
    determinism is not required to be det.

browser/term_rep.m:
    Replace calls to promise_only_solutions/1 with promise_equivalent_solutions
    goals.

mdbcomp/trace_counts.m:
    Replace a call to promise_only_solution_io/4 with a
    promise_equivalent_solutions goal.

    Add an XXX comment about hardcoding executable names.

NEWS:
     Announce the deletion of 'old', 'new', '

     List the addition of the 'for' operator as a change that may break
     backwards compatibility.

     Announce that the compiler no longer allows builtin types, insts and
     modes to be redefined.
2015-12-03 13:39:50 +11:00
Julien Fischer
94535ec121 Fix spelling and formatting throughout the system.
configure.ac:
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
library/*.m:
ssdb/*.m:
runtime/mercury_conf.h.in:
runtime/*.[ch]:
scripts/Mmake.vars.in:
trace/*.[ch]:
util/*.c:
	Fix spelling and doubled-up words.

	Delete trailing whitespace.

	Convert tabs into spaces (where appropriate).
2015-12-02 18:46:14 +11:00
Zoltan Somogyi
cc9912faa8 Don't import anything in packages.
Packages are modules whose only job is to serve as a container for submodules.
Modules like top_level.m, hlds.m, parse_tree.m and ll_backend.m are packages
in this (informal) sense.

Besides the include_module declarations for their submodules, most of the
packages in the compiler used to import some modules, mostly other packages
whose component modules their submodules may need. For example, ll_backend.m
used to import parse_tree.m. This meant that modules in the ll_backend package
did not have to import parse_tree.m before importing modules in the parse_tree
package.

However, this had a price. When we add a new module to the parse_tree package,
parse_tree.int would change, and this would require the recompilation of ALL
the modules in the ll_backend package, even the ones that did NOT import ANY
of the modules in the parse_tree package.

This happened even at one remove. Pretty much all modules in every one
of the backend have to import one or more modules in the hlds package,
and they therefore have import hlds.m. Since hlds.m imported transform_hlds.m,
any addition of a new middle pass to the transform_hlds package required
the recompilation of all backend modules, even in the usual case of the two
having nothing to do with each other.

This diff removes all import_module declarations from the packages,
and replaces them with import_module declarations in the modules that need
them. This includes only a SUBSET of their child modules and of the non-child
modules that import them.
2015-11-13 15:03:20 +11:00
Zoltan Somogyi
0821b301f2 Require that types/insts/modes in interfaces be defined in the interface.
compiler/module_qual.m:
    The interface of a module A contains items (e.g. predicate declarations)
    that refer to entities such as types, insts, modes etc. They may refer
    to those entities if (a) they are defined in the interface of module A,
    (b) in a parent module of module A, or (c) if they are imported from
    another module, module B, which is imported into module A in the interface
    of module A.

    The old algorithm that attempted to enforce this requirement had a basic
    design fault: it based the decision as to whether the use of an entity
    in the interface was legal solely on the name of the module that defined
    that entity. This correctly implements tests (b) and (c), but it does
    not even attempt to implement the interface test part of (a).
    It therefore allowed exported items to refer to nonexported entities.

    This diff changes the whole design approach to the test. Instead of
    keeping a list of modules *all* of whose entities may be used in the
    interface of the current module, record for *every* entity whether
    it may be used in the interface. Set the permissions differently
    in the interface and implementation sections of the current module.

    Improve the formatting of the ambiguity error message.

NEWS:
    Announce the stricter enforcement of the documented language rules,
    in a new section for potentially compatibility-breaking changes.

compiler/check_typeclass.m:
    Delete a test for a special case of the situation that module_qual.m
    now tests for. If this problem occurs, module_qual.m will pick it up,
    and check_typeclass.m will never even be invoked, so this copy of the test
    can never succeed.

library/hash_table.m:
    Fix code that violated the language rules: we export a type that
    includes another type, but didn't export the second type. We now do.

browser/declarative_analyser.m:
browser/declarative_edt.m:
compiler/coverage_profiling.m:
    Fix code that violated the language rules. We used to export predicates
    and functions whose argument types included nonexported types. As it
    happens, none of those predicates and functions actually need to be
    exported, so keep them private.

    In coverage_profiling.m, don't abstract export a type that is not
    used outside the module, and give a function a name that doesn't
    clash with a type name.

tests/invalid/bug17.{m,err_exp}:
    A new test case to test the error message we get if the module interface
    refers to a nonexported type.

tests/invalid/bad_instance.err_exp:
    This test case used to get two kinds of errors, one of which was
    the illegal use of nonexported type in an exported abstract instance
    declaration. We now discover this error earlier, and stop after we
    do so. Update the expected error message.

tests/invalid/bad_instance2.{m,err_exp}:
    New test case: a modified copy of bad_instance.m, testing the other
    kind of error originally tested by bad_instance.m.

tests/invalid/instance_no_type.err_exp:
    Update the expected error message.

tests/invalid/Mmakefile:
    Enable the new test cases.

tests/benchmarks/query.m:
tests/hard_coded/unused_float_box_test.m:
tests/valid/bug300.m:
tests/valid/deforest_bug.m:
tests/valid/higher_order4.m:
tests/valid/lambda_recompute.m:
tests/valid/mert.m:
tests/valid/reuse_static.m:
tests/valid/switch_detection_bug2.m:
tests/valid/time_yaowl.m:
tests/warnings/unused_args_test.m:
    Fix code that violated the language rules, typically by exporting
    the type that previously, we illegally used in the module interface.

tests/recompilation/add_type_re.err_exp.2:
    Expect the updated ambiguity error message.
2015-11-11 14:28:57 +11:00
Zoltan Somogyi
5f8bd5f09d Delete unused imports. 2015-11-08 14:52:08 +11:00
Zoltan Somogyi
8f581354c7 Add a prefix to the names of browser_info's fields. 2015-11-02 18:37:49 +11:00
Zoltan Somogyi
981816771a Use separate types for directories with and without ".." steps.
browser/browser_info.m:
    Replace the old "dir" type and "dir_no_parent" inst with
    two distinct types: up_down_dir and down_dir.

browser/browse.m:
browser/declarative_user.m:
browser/parse.m:
    Replace uses of the old dir type with one of the new types,
    adding conversions as needed. The separate types make it much clearer
    where ".." dir steps may appear and where they may not.

    In one case, this extra clarity allows us to avoid calling simplify_dirs
    (which eliminates ".." dir steps) twice in a row.

    In some other cases, it allows us to replace three-way switches
    in which the .. case contained a "this can't happen" assertions
    with a two-way switch (between numbered and named child directories).
    This should be faster as well as safer. We now allow ".." dir steps
    only when the user types in directory paths, and we convert them to
    downward-only directory paths immediately afterward.

    Simplify the code that writes out directory paths.
2015-11-02 18:28:18 +11:00
Zoltan Somogyi
3c255eeac7 Don't allow putting functions with nondefault signatures into terms.
The code that takes the function out of the term can use the function
as if it had the default signature. If it doesn't, this can lead to
This fixes Mantis bug 264.

compiler/mode_errors.m:
    Provide a way to record such errors, and to print error messages for them.

compiler/modecheck_unify.m:
    Look for such errors when constructing terms.

browser/declarative_user.m:
    Don't put a function with a nondefault signature (it used a subtype)
    into a term. Enforce the subtype with a runtime assertion instead.

doc/reference_manual.texi:
    Document the new limitation.

tests/invalid/default_ho_inst.{m,err_exp}:
    The test case for Mantis bug 264.

tests/invalid/Mmakefile:
    Enable the new test case.

tests/valid/Mmakefile:
    Disable the old ho_func_call test case, since it RELIES on putting
    functions with nondefault modes into terms. It also uses I/O states
    in ui modes.
2015-11-02 13:09:37 +11:00
Zoltan Somogyi
2f6d49a1fc Delete more stuff needed only for the IL backend. 2015-09-23 11:13:00 +10:00
Julien Fischer
3dd02876a5 Delete the MLDS->IL backend.
compiler/mlds_to_il.m:
compiler/mlds_to_ilasm.m:
compiler/mlds_to_managed.m:
compiler/il_peephole.m:
compiler/ilasm.m:
compiler/ilds.m:
    Delete the modules making up the MLDS->IL code generator.

compiler/globals.m:
compiler/prog_data.m:
    Delete IL as a target and foreign language.

compiler/prog_io_pragma.m:
    Delete the max_stack_size/1 foreign proc attribute.  This was only
    ever required by the IL backend.

compiler/options.m
    Delete options used for the IL backend.

compiler/write_deps_file.m:
    Don't generate mmake targets for .il files etc.

compiler/*.m:
    Conform to the above changes.

compiler/notes/compiler_design.html
compiler/notes/work_in_progress.html
    Conform to the above changes.

library/*.m:
    Delete IL foreign_proc and foreign_export pragmas.

README.DotNet:
    Delete this file.

browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
mdbcomp/Mmakefile:
mfilterjavac/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
slice/Mmakefile:
    Conform the above changes.

configure.ac:
    Don't check that IL is a supported foreign language when performing the
    up-to-date check.

    Delete the '--enable-dotnet-grades' option.

scripts/Mmake.vars.in:
    Delete variables used for the IL backend (and in on case by the Aditi
    backend).

scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
scripts/Mmake.rules:
scripts/canonical_grade.sh-subr:
tools/bootcheck:
    Delete stuff related to the 'il' and 'ilc' grades.

doc/reference_manual.texi:
     Delete the documentation of the 'max_stack_size' option.

doc/user_guide.texi:
     Delete stuff related to the IL backend.

tests/hard_coded/csharp_test.{m,exp}:
tests/invalid/foreign_type_missing.{m,err_exp}:
tests/valid/csharp_hello.m:
	Delete these tests: they are no longer relevant.

tests/hard_coded/equality_pred_which_requires_boxing.m:
tests/hard_coded/foreign_import_module.m:
tests/hard_coded/foreign_import_module_2.m:
tests/hard_coded/foreign_type.m:
tests/hard_coded/foreign_type2.m:
tests/hard_coded/foreign_type3.m:
tests/hard_coded/intermod_foreign_type2.m:
tests/hard_coded/lp.m:
tests/hard_coded/user_compare.m:
tests/invalid/foreign_type_2.m:
tests/invalid/foreign_type_missing.{m,err_exp}:
tests/invalid/foreign_type_visibility.m:
tests/invalid/illtyped_compare.{m,err_exp}:
tests/submodules/external_unification_pred.m
tests/valid/big_foreign_type.m
tests/valid/solver_type_bug.m
tests/valid_seq/foreign_type_spec.m
tests/valid_seq/intermod_impure2.m
    Delete IL foreign_procs where necessary.

tests/hard_coded/Mmakefile
tests/invalid/Mercury.options
tests/invalid/Mmakefile
tests/submodules/Mmakefile
tests/valid/Mercury.options
tests/valid/Mmake.valid.common
tests/valid/Mmakefile
tests/valid_seq/Mmakefile
tests/valid_seq/Mercury.options
    Conform to the above changes.
2015-09-21 11:34:46 +10:00