Commit Graph

106 Commits

Author SHA1 Message Date
Zoltan Somogyi
a47de48c4d s/input_stream/text_input_stream/ ...
... and the same for output streams.
2023-04-24 14:59:20 +10:00
Peter Wang
5425965e16 Avoid C# unused variable warnings in catch clauses.
library/io.file.m:
ssdb/ssdb.m:
    Omit unused variables in catch clauses.
2022-03-11 15:45:16 +11:00
Zoltan Somogyi
c02eb5163e Carve io.{call_system,environment}.m out of io.m.
library/io.call_system.m:
    Move the code in the "system access predicates" section of io.m
    to this new module.

library/io.environment.m:
    Move the predicates dealing with environment variables in io.m
    to this new module.

library/io.m:
    Delete the code moved to the new modules.

    Leave behind in io.m "forwarding predicates", predicates that do nothing
    except call the moved predicates in the new modules, to provide backward
    compatibility. But do mark the forwarding predicates as obsolete,
    to tell people to update their (at their leisure, since the obsoleteness
    warning can be turned off).

    Also leave behind in io.m the definitions of the types used
    by some parameters of some of the moved predicates.

library/MODULES_DOC:
    List the new modules among the documented modules.

library/library.m:
    List the new modules, including io.file.m (added in a previous change)
    among the documented standard library modules.

NEWS:
    Announce the changes.

browser/browse.m:
browser/interactive_query.m:
compiler/fact_table.m:
compiler/handle_options.m:
compiler/make.module_target.m:
compiler/mercury_compile_main.m:
compiler/module_cmds.m:
compiler/optimize.m:
compiler/options_file.m:
deep_profiler/conf.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_test.m:
library/io.file.m:
mdbcomp/trace_counts.m:
ssdb/ssdb.m:
tests/general/environment.m:
tests/hard_coded/closeable_channel_test.m:
tests/hard_coded/setenv.m:
tests/hard_coded/system_sort.m:
    Call the moved predicates directly in their new modules,
    not indirectly through io.m.
2022-03-08 09:38:27 +11:00
Zoltan Somogyi
25b4b67403 Carve io.file.m out of io.m.
library/io.file.m:
library/io.m:
    Move two sections of io.m, the "file handling predicates" section
    and the "handling temporary files" section to the new submodule io.file.m.

    Leave behind in io.m "forwarding predicates", predicates that do nothing
    except call the moved predicates in io.file.m, to provide backward
    compatibility. But do mark the forwarding predicates as obsolete,
    to tell people to update their (at their leisure, since the obsoleteness
    warning can be turned off).

    Also leave behind in io.m the definitions of the two types used
    by some parameters of some of the moved predicates. Document the reason
    why this is done.

library/MODULES_DOC:
    List the new module among the documented modules.

NEWS:
    Announce the changes.

browser/browse.m:
browser/interactive_query.m:
browser/listing.m:
compiler/analysis.file.m:
compiler/compile_target_code.m:
compiler/export.m:
compiler/fact_table.m:
compiler/file_util.m:
compiler/handle_options.m:
compiler/make.build.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/mercury_compile_main.m:
compiler/module_cmds.m:
compiler/parse_module.m:
compiler/passes_aux.m:
compiler/prog_event.m:
compiler/recompilation.check.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
deep_profiler/conf.m:
deep_profiler/mdprof_cgi.m:
library/dir.m:
mdbcomp/program_representation.m:
ssdb/ssdb.m:
    Call the file operation predicates directly in io.file.m, not indirectly
    through io.m.

    In two modules, add a #include of fcntl.h in C code. These modules contain
    C code that needs this #include, but until now, they got it via a copy
    in an automatically generated C header file of a foreign_decl pragma
    in io.m that contained that #include. This diff moves that foreign_decl
    to io.file.m, removing that crutch.

tests/debugger/browser_test.m:
tests/hard_coded/bit_buffer_test.m:
tests/hard_coded/bitmap_test.m:
tests/hard_coded/construct_bug.m:
tests/hard_coded/dir_fold.m:
tests/hard_coded/dir_test.m:
tests/hard_coded/read_binary_int16.m:
tests/hard_coded/read_binary_int32.m:
tests/hard_coded/read_binary_int64.m:
tests/hard_coded/read_binary_uint16.m:
tests/hard_coded/read_binary_uint32.m:
tests/hard_coded/read_binary_uint64.m:
tests/hard_coded/read_bitmap_size.m:
tests/hard_coded/remove_file.m:
tests/hard_coded/write_binary.m:
tests/hard_coded/write_binary_int8.m:
tests/hard_coded/write_binary_multibyte_int.m:
tests/hard_coded/write_binary_uint8.m:
    Call the file operation predicates directly in io.file.m, not indirectly
    through io.m.
2022-03-08 06:01:21 +11:00
Zoltan Somogyi
adf6c55847 Shut up mmake actions for check_namespace.
This reduces the size of the output of tools/bootcheck by 3700+ lines,
or about 25%.

Mmake.common.in:
    Don't print the actions implementing namespace cleanliness checks.
    To allow the attribution of any violations of the namespace rules,
    print the name of the C module before any list of detected
    nonallowed symbols.

    To avoid mmake printing the actions for creating the .o files
    that some of the check_namespace actions later check, rename
    the affected object files .pseudo_o files, so that we can specify
    a rule for them that is a copy of the rule for .o files, differing
    only in not printing the compilation command.

    Mark the files involved in check_namespace actions as dependencies
    of .SECONDARY, which means that mmake does not automatically delete them
    after building them as intermediate files. The reason for this is that
    there is no way to tell make to delete intermediate files *silently*,
    i.e. without writing out the rm command that deletes them.
    To make up for this, tools/bootcheck now cleans up each directory
    immediately after "mmake check_namespace" with "mmake clean_check",
    which invokes mmake rules that do not print the rm commands.

    This change does have the effect that these intermediate files *will*
    hang around if the check_namespace target is every invoked manually.
    However,

    - we just about never run check_namespace in a directory manually, and
    - when we do, a simple "mmake clean_check" will do the required cleanup.

scripts/Mmake.rules:
    Move the vim tag line to its usual place at the top.

    Replace old-school rules such as .m.err with their modern equivalents
    (such as %.err: %.m).

scripts/Mmakefile:
    Instead of printing the rules that make test_mdbrc, print only a
    "making test_mdbrc" message.

runtime/Mmakefile:
    Conform to the change of the name of a make variable in Mmake.common.in.

ssdb/Mmakefile:
    Fix an old bug that something else in this diff tickled: make the
    .depend target of each main module depend on SSDB_FLAGS, *not* just
    the phony general "depend" target. This was a bug because tools/bootcheck

    - copied across to stage 2 ONLY SSDB_FLAGS.in, and NOT SSDB_FLAGS,

    - did NOT explicitly make SSDB_FLAGS from SSDB_FLAGS.in, even though
      pretty much invocations of the Mercury compiler in this directory
      have "--flags SSDB_FLAGS" as an implicit argument, and then

    - built dependencies in the ssdb directory by invoking the top
      Mmakefile's dep_ssdb target, which (indirectly) invokes
      $(SSDB_LIB_NAME).depend.

    Due to all the above, I don't actually know how tools/bootcheck
    could ever build stage2/ssdb until now :-(

tools/bootcheck:
    Invoke "mmake clean_check" after each "mmake check_namespace".

    Change the code that explicitly builds the directory-specific
    X_FLAGS file in each directory (which is invoked only when using
    mmc --make) to actually build all such files, when previously
    it built only a subset.

tests/invalid/Mmakefile:
tests/invalid_nodepend/Mmakefile:
tests/invalid_onlydepend/Mmakefile:
tests/invalid_options_file/Mmakefile:
tests/invalid_purity/Mmakefile:
tests/invalid_submodules/Mmakefile:
tests/stm/Mmakefile:
    Fix an unintended consequence of replacing the .m.err rule in
    scripts/Mmake.rules with %.err: %.m, which is that the %.err: %.m
    rules in these mmakefiles became ineffective, because they appear
    in the makefile we construct *after* the rule in scripts/Mmake.rules,
    which specify a different action (the rules here return a nonzero
    status in the *absence* of failure, which would be ridiculous
    for the rule in scripts/Mmake.rules). Apparently, the %.err: %.m rules
    overrode the rule in scripts/Mmake.rules while it had the old form,
    but do not do so now it has the new form.

    The fix is to make replace all the "%.err: %.m" rules in these Mmakefiles
    with "$(PROGS:%=%.err): %.err: %.m" rules, which specify that they
    override the generic rule for the .err files of the test cases
    in each directory.

    In invalid_purity/Mmakefile, fix a bug: -nodepend suffixes make sense
    in only in the name of a *test*, not the name of a *program*, so
    move such a suffix from a program name to a test name. Without this,
    the program's .err file would be included in the list of .err files
    to which the ".err: .m" rule applies under the wrong name.

    In invalid_submodules/Mmakefile, fix the misleading names of some
    make variables, and fix a misspelt directory name.

    Standardize on "$(PROGS:%=%.err)" notation, replacing earlier instances
    of "$(addsuffix .err,$(PROGS))". The reason for this is that when I tried
    using "$addsuffix .int_err,$(PROGS))" in tests/invalid/invalid_make_int,
    it did not work. (A google search on "gnu make addsuffix" did not yield
    any clues as to why. Maybe you can only add suffixes that do not contain
    underscores?)
2022-01-24 17:38:35 +11:00
Zoltan Somogyi
0424c3f947 Specify --no-halt-at-warn-make-{int,opt}. 2021-12-26 03:10:01 +11:00
Zoltan Somogyi
d854949a9c Specify --warn-potentially-ambiguous-pragma ...
as the default for the Mercury system.

configure.ac:
    Require the installed compiler to support this option.

browser/MDB_FLAGS.in:
compiler/COMP_FLAGS.in:
deep_profiler/DEEP_FLAGS.in:
grade_lib/GRADE_LIB_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 as the default in their directories.
2021-06-23 18:33:59 +10:00
Zoltan Somogyi
0d7c8a7654 Specify pred or func for all pragmas.
*/*.m:
    As above.

configure.ac:
    Require the installed compiler to support this capability.
2021-06-16 15:23:58 +10:00
Zoltan Somogyi
eeb69f14ba Use explicit streams in browser/*.m.
browser/browse.m:
browser/browser_info.m:
browser/collect_lib.m:
browser/declarative_debugger.m:
browser/declarative_oracle.m:
browser/declarative_user.m:
browser/diff.m:
browser/help.m:
browser/interactive_query.m:
browser/parse.m:
browser/util.m:
    Replace implicit streams with explicit streams.

    Shorten lines longer than 79 chars.

    In some places, simplify some code, often using constructs such as
    string.format that either did not exist or were too expensive to use
    when the original code was written.

    In some places, change predicate names that were not meaningful
    without module qualification by *including* the module qualification
    in the name (e.g. init -> browser_info_init).

    In some places, add XXXs.

    In browser_info.m, make the output stream *part* of the debugger type,
    because without this, having the debugger type belong to the stream
    typeclass does NOT make sense. (The typeclass instance for debugger
    used to always write to the current output stream, which this diff
    is replacing with the use of explicitly specified streams.)

    In browse.m, consistently put stream arguments before other arguments.

    In browse.m, when exporting Mercury predicates to C, export them
    under names with the standard ML_BROWSE_ prefix, NOT under the name
    of a *different* predicate with that prefix.

    In diff.m, eliminate an unnecessary difference between what we print
    when the difference between two terms is at the root, vs what we print
    when the difference between two terms is lower down.

    In interactive_query.m, when trying to write a program out to a file,
    do NOT write the program to the current output stream if we cannot open
    the file, since that would accomplish nothing useful.

    Also in interactive_query.m, cleanup .dylib instead of .so on MacOS.

    In util.m, delete some unused predicates.

    In collect_lib.m, document why some code is not worth updating.

    In declarative_oracle.m, rename predicates with previously-ambiguous
    names.

browser/MDBFLAGS.in:
    Specify --warn-implicit-stream-calls for all Mercury modules
    in the browser directory from now.

trace/mercury_trace_browse.c:
trace/mercury_trace_cmd_browsing.c:
ssdb/ssdb.m:
    Conform to the changes in browser/*.m.

tests/debugger/queens.{exp,exp2}:
    Expect the extra output from browser/diff.m.
2021-03-05 22:54:28 +11:00
Peter Wang
524f4d72e2 Delete references to Erlang backend in makefiles.
Mmake.workspace:
Mmakefile:
*/Mmakefile:
tests/*/Mmakefile:
tests/valid/Mmake.valid.common:
trace/Mmakefile:
    As above.
2020-10-27 11:10:11 +11:00
Peter Wang
c4c840cb7e Delete Erlang backend from configure.
configure.ac:
m4/mercury.m4:
    Delete --enable-erlang-grade configure option.

    Don't search for erlang compiler and interpreter.

    Don't substitute @ERLC@ and @ERL@.

    Don't add erlang to libgrades.

    Don't generate erlang_conf.hrl

library/erlang_conf.hrl.in:
    Delete template file.

.dockerignore:
browser/MDB_FLAGS.in:
compiler/COMP_FLAGS.in:
deep_profiler/DEEP_FLAGS.in:
library/.gitignore:
library/Mmakefile:
library/library.m:
mdbcomp/MDBCOMP_FLAGS.in:
mfilterjavac/MFILTERJAVAC_FLAGS.in:
profiler/PROF_FLAGS.in:
scripts/Mercury.config*.in:
scripts/mercury_config.in:
scripts/prepare_install_dir.in:
ssdb/SSDB_FLAGS.in:
tools/bootcheck:
    Delete references to Erlang .hrl files.

    Delete references to @ERLC@ and @ERL@.
2020-10-27 11:10:11 +11:00
Peter Wang
388938ac1e Delete use of signal handlers taking sigcontext arguments.
The configure checks for sigcontext (aka sigcontext_struct) have failed
for a long time without anyone noticing. The MR_GET_FAULT_ADDR macro
that is also needed for the sigcontext code paths was only ever defined
for __i386__ and __mc68000__.

According to the sigaction(2) man page, the struct sigcontext
argument was obsoleted by the introduction of the SA_SIGINFO flag
(which we also have code for, though also not working either).

configure.ac:
    Delete checks related to struct sigcontext.

    Delete check for asm/sigcontext.h

runtime/mercury_conf.h.in:
    Delete macros that are no longer defined.

runtime/mercury_memory_handlers.c:
runtime/mercury_signal.c:
runtime/mercury_signal.h:
    Delete code for using signal handlers that take a sigcontext argument.

    Add XXX where native GC casts a context parameter to
    struct sigcontext * when it should be a ucontext_t *.
    Possibly never tested.

runtime/mercury_faultaddr.h:
    Delete this file containing only the MR_GET_FAULT_ADDR macro which is
    no longer used.

runtime/RESERVED_MACRO_NAMES:
ssdb/RESERVED_MACRO_NAMES:
trace/RESERVED_MACRO_NAMES:
    Delete macros that are no longer defined.

tools/configure_mingw_cross:
    Don't need to set variables mercury_cv_sigcontext_struct_2arg and
    mercury_cv_sigcontext_struct_3arg any more.
2020-10-13 13:32:32 +11:00
Zoltan Somogyi
b8b845a568 Fix mmakefile rules for os,cs,css,javas.
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.
2020-04-11 20:10:38 +10:00
Zoltan Somogyi
a618ab31e1 Insist that without mmc -f, module a.b.c be in a.b.c.m.
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.
2020-01-12 22:13:01 +11:00
Zoltan Somogyi
cbb7d8613b Make --warn-inconsistent-pred-order-clauses the default in most directories.
library/LIB_FLAGS.in:
mfilterjavac/MFILTERJAVAC_FLAGS.in:
profiler/PROF_FLAGS.in:
slice/SLICE_FLAGS.in:
ssdb/SSDB_FLAGS.in:
    Specify --warn-inconsistent-pred-order-clauses as a default flag
    in these directories as well.

library/string.m:
    Reorder code to make this module compile cleanly with
    --warn-inconsistent-pred-order-clauses.

    Don't export base_string_to_int_underscore to lexer.m, since
    lexer.m does not use it anymore, and neither does anything else.
    (The export was not publicly documented.)

library/benchmarking.m:
library/bitmap.m:
library/builtin.m:
library/map.m:
library/profiling_builtin.m:
library/rbtree.m:
library/table_builtin.m:
library/uint.m:
profiler/globals.m:
profiler/options.m:
profiler/prof_info.m:
slice/mdice.m:
slice/mslice.m:
slice/mtc_diff.m:
slice/mtc_union.m:
ssdb/ssdb.m:
    Reorder code to make these modules compile cleanly with
    --warn-inconsistent-pred-order-clauses.

library/Mercury.options:
    Specify --no-warn-inconsistent-pred-order-clauses for the modules
    that would still get warnings without this option.
2019-08-27 14:34:01 +10:00
Peter Wang
d9474bf6cd Enable parallel make in browser and ssdb directories.
browser/Mmakefile:
    Delete .NOTPARALLEL target. The line appears to be only a leftover
    for a workaround that was in place when the browser directory
    contained both the mer_browser and mer_mdbcomp and libraries.

    Delete other lines which have been commented out since
    mdbcomp was moved to its own directory.

ssdb/Mmakefile:
    Delete the same lines copied from browser/Mmakefile.
2019-08-05 12:07:48 +10: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
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
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
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
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
Zoltan Somogyi
b0f124a8fa Convert (C -> T ; E) to (if C then T else E). 2016-10-29 21:12:05 +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
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
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
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
2f6d49a1fc Delete more stuff needed only for the IL backend. 2015-09-23 11:13:00 +10:00
Zoltan Somogyi
58d29651c1 Warn about unknown format strings in the Mercury system.
*/*_FLAGS.in:
    Specify that by default, the compiler should generate warnings
    for unknown format strings and bad known format strings.

*/Mercury.options:
    Override this default setting for a few modules that have legitimate
    reasons for calling e.g. string.format with unknown format strings.

compiler/fact_table.m:
deep_profiler/html_format.m:
    Minor changes to avoid calling string.format with unknown format strings.
2015-01-28 19:21:47 +11:00
Zoltan Somogyi
d33273d033 Tell vim not to expand tabs in Makefiles.
This file-specific setting will override a default setting of expandtabs
in $HOME/.vimrc.

*/Makefile:
*/Mmakefile:
    As above.

tests/hard_coded/.gitignore:
    Don't ignore the purity subdir. This ignore must have been left over
    from when purity.m was a test in hard_coded, not hard_coded/purity,
    and it ignored an executable, not a directory.
2015-01-08 22:07:29 +11:00
Zoltan Somogyi
ba57f4a5df Reorganize the way we handle reserved C macro names.
RESERVED_MACRO_NAMES:
*/RESERVED_MACRO_NAMES:
    Add a macro, _FORTIFY_SOURCE, that gcc defines by default on some recent
    versions of Linux.

    I could have added it in SIX separate RESERVED_MACRO_NAMES files.
    Instead, I moved the content common to all these files to a
    RESERVED_MACRO_NAMES file in the top directory, leaving the
    RESERVED_MACRO_NAMES files of the subdirectories containing only
    macros that *don't* occur in all those subdirectories.

tools/bootcheck:
   Copy the top-level RESERVED_MACRO_NAMES names to the stage 2 directory.

Mmake.common.in:
   Filter out the contents of the top level RESERVED_MACRO_NAMES file,
   as well as the RESERVED_MACRO_NAMES file in the current directory.
2014-01-22 08:55:58 +11:00
Julien Fischer
6e5a0144ae Disable library grade detection when building Mercury itself.
Library grade detection causes the library installation for the csharp grade
(and probably any grades that use mmc --make) to fail.  (There is likely
a better solution than this, e.g. making --no-mercury-stdlib-dir imply
--no-detect-libgrades, but the handling of command line options in this
part of the compiler is pretty convoluted, so I will look into that
separately.)

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:
	As above.
2013-09-10 17:31:06 +10:00
Julien Fischer
e131b228db Add and/or update .gitignore files.
mfilterjavac/.gitignore:
	Add a .gitignore file for this directory.

browser/.gitignore:
mbdcomp/.gitignore:
runtime/.gitignore:
ssdb/.gitignore:
trace/.gitignore:
	Ignore .so files.
2013-05-21 14:17:33 +10:00
Julien Fischer
7992ab160a Update SSDB reserved macro names.
ssdb/RESERVED_MACRO_NAMES:
	I forgot to do a git add on this in my last change.
2013-04-04 01:06:27 +11:00
Julien Fischer
6bf42c061e Remove unused targets from Mmakefiles.
browser/Mmakefile:
compiler/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
	Delete .ss and .pic_ss targets.
	These were only required for the GCC backend.
2013-02-20 16:38:52 +11:00
Peter Wang
ec8f199bc5 Define GC_LINUX_THREADS instead of LINUX_THREADS.
Pass -DGC_LINUX_THREADS for Boehm GC instead of -DLINUX_THREADS.
The latter is a deprecated synonym.

configure.ac:
	As above.

*/RESERVED_MACRO_NAMES:
	LINUX_THREADS no longer needs to be excluded from the
	namespace check.
2013-02-20 11:55:48 +11:00
Julien Fischer
ac15dc87b5 Add files generate by tags targets to .gitignore files.
*/.gitignore:
	As above.
2013-01-04 16:46:30 +11:00
Julien Fischer
3a290b340b Bump the year in the copyright messages.
.README.in:
bindist/bindist.README:
trace/mercury_trace_internal.c:
compiler/handle_options.m:
doc/*.texi:
profiler/mercury_profile.m:

*/.gitignore:
   Convert and / or update .gitignore files.
2013-01-03 13:12:22 +11:00
Julien Fischer
1eda59e3da Convert .cvsignore files into .gitignore files.
Delete the empty lazy_evaluation directory from extras.

*/.cvsignore:
     Make this into .gitignore files.
     (Update them where necessary.)

extra/lazy_evalution:
    Delete this directory; its former contents were moved
    elsewhere some time ago.
2013-01-03 13:12:22 +11:00
Peter Ross
e73b87e77e Sign the all the assemblies in the csharp grade.
Estimated hours taken: 2
Branches: main, 12.08

Sign the all the assemblies in the csharp grade.

mercury.snk:
	The strong name key used for signing.

analysis/ANALYSIS_FLAGS.in:
browser/MDB_FLAGS.in:
compiler/COMP_FLAGS.in:
deep_profiler/DEEP_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
profiler/PROF_FLAGS.in:
slice/SLICE_FLAGS.in:
ssdb/SSDB_FLAGS.in:
	Pass the signing key to the c# compiler.

scripts/prepare_install_dir.in:
	Copy mercury.snk to the install dir.
2012-11-22 20:35:29 +00:00
Peter Ross
c372317c26 Add option --ssdb-trace which allows one to control which modules are traced in
Estimated hours taken: 8
Branches: main

Add option --ssdb-trace which allows one to control which modules are traced in
the ssdebug grade and to what level.

Add option --link-ssdb-libs which allows one to link the ssdebug libraries into
an executable not compiled in a .ssdebug grade.

README.ssdebug:
	Document the new options.

compiler/compile_target_code.m:
compiler/module_cmds.m:
	Use link_ssdb_libs rather than source_to_source_debug.

compiler/globals.m:
	Add ssdb_trace_level.
	Set the correct ssdb_trace_level according to the value
	of source_to_source_debug.

compiler/handle_options.m:
	Determine the value of --ssdb-trace according to the values
	of --ssdb and --force-disable-ssdb.
	Set --link-ssdb-libs to true is --ssdb is set.

compiler/mercury_compile_middle_passes.m:
	Always apply the ssdb transformation pass.

compiler/module_imports.m:
	If the SSDB trace level implies the transformation
	has been done, then import the ssdb module.

compiler/options.m:
	Add ssdb_trace_level and link_ssdb_libs options.

compiler/ssdebug.m:
	Use ssdb_trace_level to determine which transformations are applied
	to which procedures.

	Change the transformation so that it's now aware of which level
	tracing is in effect.

ssdb/ssdb.m:
	Record which level of tracing is applicable at each level of the stack.
	Use that information to decide whether or not to stop at an event.

	Avoid aborts when attempting to install the sigint handler in the C# grade.

	Allow the read_and_execute_cmd code to handle 10 io errors in a row before
	finally quiting, this avoids problems in the C# grade where some keypresses
	lead to transient io errors.
2012-07-19 11:44:13 +00:00
Julien Fischer
e6f59c08cc Fix problems that prevent Mercury from building on Mac OS X
Branches: main, 11.07

Fix problems that prevent Mercury from building on Mac OS X
PowerPC machines.
(This should fix bug #255, although I don't have a machine
running Mac OS 10.4 so I can't check that.)

browser/Mmakefile:
mdbcomp/Mmakefile:
ssdb/Mmakefile:
	Older versions of make (such as that shipped with
	Mac OS X 10.3) only support conditionals with at
	most one else branch: avoid using conditionals with
	multiple else branches.

configure.in:
runtime/mercury_conf.h.in:
	Define a macro if the header file sys/resource.h.

mdbcomp/shared_utilities.m:
	Conditionally include sys/resource.h.  It contains
	declarations required by setrlimit on older versions
	of Mac OS X.
2012-05-19 13:24:33 +00:00
Julien Fischer
f127438fc2 Make compilation of stage 1 work in the java grade.
Branches: main, 11.07

Make compilation of stage 1 work in the java grade.

deep_profiler/DEEP_FLAGS.in:
profiler/PROF_FLAGS.in:
slice/SLICE_FLAGS.in:
	Set the classpath to point towards the relevant supporting libraries.

browser/.cvsignore:
library/.cvsignore:
mdbcomp/.cvsignore:
ssdb/.cvsignore:
	Ignore generated files.
2011-12-01 15:17:49 +00:00
Julien Fischer
3e14574391 Use don't-care variables for the I/O state in foreign_procs
Branches: main, 11.07

ssdb/ssdb.m:
	Use don't-care variables for the I/O state in foreign_procs
	in order to avoid warnings from MSVC.
2011-10-28 14:30:31 +00:00
Julien Fischer
8d4a2bb3d8 Ignore files generated by mprof.
Branches: main

slice/.cvsignore:
ssdb/.cvsignore:
	Ignore files generated by mprof.
2011-09-22 14:34:00 +00:00