Commit Graph

983 Commits

Author SHA1 Message Date
Julien Fischer
1a337fb843 Align functions on word boundaries with clang.
Function trailing with tagged trail entries does not work unless the functions
are aligned on word boundaries. In trailing grades with GCC, we have long
passed an option (-falign-functions) to force this to happen. Do the same for
clang, which supports the same option. This fixes the failure of function
trailing tests on Apple Silicon based machines.
(This does not appear an issue on Intel-based Macs, although passing
-falign-functions option there is harmless.)

scripts/mgnuc.in:
compiler/compile_target_code.m:
     Tell clang to align functions on word boundaries in trailing grades.
2024-05-04 17:15:51 +10:00
Julien Fischer
dce6967ee3 Add configuration option to enable internal file copying.
Add a new configuration option, --with-cp, that controls whether file copying
by the Mercury compiler is done by invoking the "cp" command or by using the
file copying predicates in the new copy_util module.

When using MSVC or when using MinGW, make the new file copying predicates the
default. (These configurations are the most likely to be the ones where the
Mercury compiler is used from the Windows command prompt, where cp is not
available.)

configure.ac:
    Add the new option, --with-cp.

    Require the bootstrap compiler to support the --install-method configuration
    option that was added last November.

scripts/Mercury.config.in:
     Set the install method configuration option.
2024-01-14 17:02:59 +11:00
Julien Fischer
f7921d7b47 Fix a problem using mdb from cmd.exe on Windows.
More generally, clean-up the various batch files we have.

scripts/mdb.bat.in:
    Ensure that the value of MERCURY_DEBUGGER_INIT environment variable does
    *not* include double quotes, otherwise the path to the mdbrc file will
    be incorrect.

scripts/*.bat.in:
    Require command extensions to be enabled. This is the default on
    all Windows systems we support; explicitly enabling them is just in case
    the user turns them off for some reason.

    Don't disable echoing twice.

    Quote the entire argument to the set command; this should avoid double
    quotes ending up where we don't want them.

    Update copyright notices.
2024-01-12 18:19:21 +11:00
Julien Fischer
801f1f8d72 Do not install batch files on non-Windows systems.
configure.ac:
Mmake.common.in:
   Add a configuration parameter that says if the batch files in
   the scripts directory should be installed or not.

scripts/Mmakefile:
   Make the set of scripts to be installed dependent on the value of
   the new configuration parameter.
2024-01-11 19:58:48 +11:00
Julien Fischer
a20c994166 Change the path of the default CLI interpreter.
scripts/mercury_compile.sh-csharp:
    Use "mono" as the default CLI interpreter, rather
    than "/opt/local/bin/mono"
2024-01-09 02:03:14 +11:00
Peter Wang
d5ade76faf Defer SHARED_LIBS assignment in ml script.
scripts/ml.in:
    Assign SHARED_LIBS only when it will actually be used,
    as the default value of SHARED_LIBS set by configure
    may invoke "gcc -print-libgcc-file-name" in a command substitution.
2023-12-14 13:29:48 +11:00
Peter Wang
1f3651785c Fix mmake issue when compiling without a bootstrap compiler.
Fix an issue exposed by commit 7d001786a0.

VPATH indirectly refers to GRADESTRING_NO_TARGET.
When the VPATH is being calculated after the makefile is read,
the reference to GRADESTRING_NO_TARGET causes make to try to run the
Mercury compiler to output a grade string, but we may not yet have a
working Mercury compiler.

scripts/Mmake.vars.in:
    Set EXTRA_INIT_DIRS_NO_TARGET to a non-empty string
    (that references GRADESTRING_NO_TARGET in a pattern substitution)
    only if EXTRA_LIB_DIRS is actually non-empty.
2023-10-18 17:53:57 +11:00
Peter Wang
f6f3bbf63e Fix undefined variable warning about MERC_INT_DIR.
GNU Make 4.4 reports undefined variable warnings about MERC_INT_DIR.
The problem is related to MERC_INT_DIR being referenced in a
$(shell ...) command, but being defined later.

scripts/Mmake.vars.in:
    Move the definition of MERC_INT_DIR to Mmake.vars,
    before its reference in MERC_INT_DIR_FOR_VPATH.

scripts/Mmake.rules:
    Delete definition of MERC_INT_DIR from Mmake.rules.
2023-10-17 14:07:38 +11:00
Peter Wang
7d001786a0 Ignore target-specific make variables when computing VPATH.
This prevents warnings about undefined variables $@ and $*
when running mmake with GNU Make 4.4.0.90 or above (Mantis bug 566).

scripts/Mmake.vars.in:
    Define "_NO_TARGET" variants of ALL_GRADEFLAGS, ALL_MCFLAGS and
    GRADESTRING variables that make no reference to target-specific
    variables such as GRADEFLAGS-prog.

    Add EXTRA_INIT_DIRS_NO_TARGET.

    Delete MERCURY_EXTRA_INT_DIRS and MERCURY_EXTRA_INIT_DIRS,
    instead referring to EXTRA_INT_DIRS and EXTRA_INIT_DIRS_NO_TARGET
    directly. The variables with the "MERCURY_" prefix don't appear to
    serve any purpose.

    Rename UNIX_MERCURY_{EXTRA_INT_DIRS,MERC_INT_DIR,_EXTRA_INT_DIRS}
    to {EXTRA_INT_DIRS,MERC_INT_DIR,EXTRA_INT_DIRS}_FOR_VPATH
    so they aren't used for some other purpose.

    Make EXTRA_INIT_DIRS_FOR_VPATH refer to EXTRA_INIT_DIRS_NO_TARGET
    instead of EXTRA_INIT_DIRS.

    Update MMAKE_VPATH to refer to the _FOR_VPATH variables,
    which do not refer to any target-specific variables.

    Fix some whitespace.
2023-10-16 16:59:10 +11:00
Zoltan Somogyi
191eb9eb64 Make --generate-dependencies-ints more practical.
scripts/Mmake.rules:
    Add a rule for the pattern target %.depend_ints which invokes mmc
    with --generate-dependencies-ints, just as %.depend invokes mmc
    with --generate-dependencies.

    Document the reason why this addition requires yet more code duplication.

scripts/Mmake.vars.in:
    Add the make variable definitions needed by the new code in Mmake.rules.

compiler/mercury_compile_main.m:
    Make it practical to use --generate-dependencies-ints in a multi-directory
    project like the Mercury implementation, in which some directories
    may use --generate-dependencies-ints as the target of "mmake depend",
    while other directories, which come earlier in the build process,
    still do "mmake depend" using just --generate-dependencies.
    In such cases, mmc --generate-dependencies-ints in the later directory
    may fail to generate .int0, .int or .int2 files simply because
    the .int3 file of a module they import (from an earlier directory
    in which "mmake depend" uses just --generate-dependencies) hasn't been
    made yet. (This is what would happen if someone executed "mmake depend"
    at the top level in a freshly checked out workspace.)

    The practical fix is to simply report this fix using an error message
    that still allows the compiler to exit with an exit status that
    indicates success.

    Most of the rest of this diff is there to make this possible.

compiler/error_spec.m:
    Add a new phase, phase_find_files, that specifically indicates
    that we couldn't read a file because we couldn't find it.
    Give it a string argument naming the file, to allow mercury_compile_main.m
    to replace several error_specs that each report not being able to find
    one file with a single error_spec that reports not being able to find
    many files.

    Add a utility function for use by mercury_compile_main.m to construct
    that error message.

    Add another new phase, phase_make_int, that indicates a problem
    we discovered in the code of a Mercury source file while trying
    to decide what should got into one of the that module's interface files.

compiler/parse_error.m:
    Here also use separate function symbols in the fatal_module_read_error
    type for the situations "couldn't find a file" and "couldn't read a file".

    Update the predicates constructing error_specs to handle this distinction
    (which the callers make using the new function symbol in the above type).

compiler/compile_target_code.m:
compiler/error_util.m:
compiler/grab_modules.m:
compiler/options_file.m:
compiler/parse_module.m:
compiler/read_modules.m:
compiler/recompilation.check.m:
compiler/write_module_interface_files.m:
    Conform to the changes above.

compiler/options.m:
    Add a way to detect the presence of this diff in an installed compiler.
2023-10-15 13:10:40 +11:00
Zoltan Somogyi
b92c11973c Document mmakefile fragment files better.
compiler/generate_dep_d_files.m:
    Document the reason for the split between .dep and .dv files.

    Fix typo.

scripts/mmake.in:
    Delete code that was only needed for bootstrapping that split
    (in 1999!).

    Document an incorrect comment.
2023-10-12 15:18:59 +11:00
Zoltan Somogyi
104a8ebd9e Get "make cs"/"mmc --make x.cs" to build a C# file ...
... instead of building a bunch of .c files.

Our tradition of adding an "s" at the end of a suffix to mean "all of the
files with the original suffix" had a problem when we added C# as a target
language. Until then, just as "os" stood for ".o files" when it occurred
as either a mmake target, mmc --make target, or mmake variable name component.
"cs" likewise stood for ".c files", but was now also needed to mean ".cs file".
We coped by keeping "cs" meaning ".c files", and adding "csharp" as a target
name synonym to mean ".cs file".

This diff keeps that synonym, but it changes

- the name needed to refer to ".c files" from "cs" to "all_cs"
- the name needed to refer to ".o files" from "os" to "all_os"
- the name needed to refer to ".pic_o files" from "pic_os" to "all_pic_os"
- the name needed to refer to ".cs files" from "css" to "all_css"
- the name needed to refer to ".java files" from "javas" to "all_javas"
- the name needed to refer to ".opt files" from "opts" to "all_opts"
- the name needed to refer to ".trans_opt files"
        from "trans_opts" to "all_trans_opts"

It would be nice if we could apply this same change to all other similar
target names and mmake variable name suffixes, such as "ints" and "int3s",
but some of those names are already in use to mean semantically different
things. All of the names above that used to have the form "<ext>s" and
now have the form "all_<ext>s" stood for all the files with extension
".<ext>" that are prerequisites for building a linked target, i.e.
an executable or a library. But the mmake variable name suffixes
".all_mihs", ".all_mhs" and ".all_int0s" each stand for something subtly
different: the names of files that *may or may not exist", but which,
if they do exist, should be deleted by a clean or realclean target.

To make this breaking change easier to handle by users, this diff does
not simply redefine the meaning of ".all_int0s". (It does change the meaning
of the "cs" target, but the fact this will happen at some time has been
announced ages ago.) Instead, it defines three new mmake var suffixes,
".mihs_to_clean", ".mhs_to_clean" and ".int0s_to_clean", which are
synonyms for ".all_mihs", ".all_mhs" and ".all_int0s" respectively,
and announces that ".all_mihs", ".all_mhs" and ".all_int0s" are being
deprecated, and will have the above change of semantics applied to them
in the future.

NEWS.md:
    Announce the breaking change.

compiler/make.top_level.m:
    Stop treating the target "cs" as meaning "build all the .c files
    for this program".

    The code of classify_target_2 has long been semidet, but only in a way
    that was not apparent to the compiler. Change the code to allow the
    compiler to see its semidet nature while keeping the algorithm the same,
    except for the change in the paragraph above.

    This includes keeping e.g. "ints" as meaning "build all the .int/.int2
    files needed by this program".

compiler/write_deps_file.m:
    Stop generating mmake variables with suffixes ".cs", ".os", ".pic_os",
    ".javas" and ".css". The mmake variables with suffixes ".all_cs",
    ".all_os", ".all_pic_os", ".all_javas" and ".all_css" already existed.
    All had the same value as the mmake variable without the "all",
    with one exception: ".cs". However, in this case, the old (and still
    current) value of ".all_cs" is what the value of ".cs" *should* have been.

    Simplify some code.

The following changes in compiler/*.m are only cosmetic, but they helped me
rule out possible sources of problems with incomplete versions of this diff.

compiler/file_names.m:
    Add a version of a fact_table_file_name_return_dirs which does not
    return directories, since most of its callers don't need that info.

compiler/make.program_target.m:
    Clarify code by making variable names more descriptive,

compiler/make.file_names.m:
compiler/make.module_target.m:
    Conform to the changes above,

browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
grade_lib/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
mfilterjavac/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
    Rename os to all_os, cs to all_cs, css to all_css, javas to all_javas,
    and opts to all_opts. (There were no occurrences of trans_opts to rename.)

    Replace [s as sh command names in actions.

scripts/Mmake.vars.in:
    Specify the names of mmake variables holding the names of sets of files
    with a given extension directly, since for some of them, adding an "s"
    at the end of the name of the extension does not generate the name
    of the corresponding mmake variable anymore.

scripts/Mmake.rules:
    Use the directly specified mmake variable names from Mmake.vars.in
    in the rule for installing lbraries. Temporarily add some debugging
    output to make suree that the updated nested mmake variable references
    work as intended.

tools/bootcheck:
    Specify the names of mmake targets for making all the files in a program
    with a given extension directly, since adding an "s" at the end of the
    name of the extension does not generate the name of the corresponding
    mmake target anymore.

    Print timestamps around the action of checking namespace cleanliness,
    to allow the time taken by that action to be measured. (I kept track
    of bootchecks as they happened while working on this diff, and found
    this time to be nontrivial.)
2023-10-05 02:03:47 +11:00
Zoltan Somogyi
4e90f2d238 Update the programming style of yet more scripts. 2023-10-02 15:02:53 +11:00
Zoltan Somogyi
a319773719 Update the programming style of more scripts.
scripts/c2init.in:
scripts/mercury.in:
scripts/mmake.in:
scripts/mmc.in:
scripts/prepare_install_dir.in:
    Indent by four spaces, not by tabs, or by three spaces.

    Use ${varname}, not just $varname.

    Put successive commands on separate lines.

    Indent case statements in a consistent manner: put case patterns
    on their own lines; put ;;s on their own lines.

    Put quotes around strings that should be considered one word
    even if they are empty or contain spaces.
2023-10-01 21:02:18 +11:00
Zoltan Somogyi
622d8c5656 Update the programming style of some scripts.
scripts/init_grade_options.sh-subr:
scripts/mdb.in:
scripts/mercury_config.in:
scripts/mercury_update_interface.in:
scripts/mgnuc.in:
scripts/ml.in:
scripts/parse_ml_options.sh-subr.in:
    Indent by four spaces, not by tabs, or by three spaces.

    Use ${varname}, not just $varname.

    Put successive commands on separate lines.

    Indent case statements in a consistent manner: put case patterns
    on their own lines; put ;;s on their own lines.

    Replace the [ command with test.

    Put quotes around strings that should be considered one word
    even if they are empty or contain spaces.

    Fix English in messages and comments.
2023-09-30 23:36:03 +10:00
Julien Fischer
adece804aa Build the man page for mtc.
docs/Mmakefile:
    As above.

scripts/mtc:
    Escape double quotes in the usage message.
2023-09-22 23:13:22 +10:00
Julien Fischer
ea4b27f57f Delete --fullarch.
The internal option --fullarch has been deprecated in favour of --target-arch
since 2014. Delete it and replace any uses with --target-arch.

compiler/options.m:
    As above.

scripts/Mercury.config.in:
scripts/Mercury.config.boostrap.in:
extras/windows_installer_generator/sample/Mercury.config:
    Conform to the above change.
2023-09-07 11:47:38 +10:00
Zoltan Somogyi
0528eeb78e Fix out-of-date references to changed subdir names. 2023-09-06 19:47:06 +10:00
Julien Fischer
31bd49f7db Revert commit 8a3be4e.
scripts/Mmake.vars.in:
    The above commit breaks the installed version of mmake on Linux.
    Revert it until we find a solution that works on both Windows
    and Linux.
2023-09-04 12:48:11 +10:00
Zoltan Somogyi
f4e24a37d0 s/classs/classes/ 2023-08-18 15:52:49 +02:00
Julien Fischer
460a11ec3d Fix the debugger tests with MSYS2/MinGW64.
These were failing because debugger expects Windows-style paths in the
test_mdbrc file, but it was being generated with Unix-style paths. A
similar problem was recently fixed for MSVC, this change extends that
fix to also work for MSYS2/MinGW64.

configure.ac:
    Define a new configuration variable, FIX_PATH_FOR_WINDOWS, that expands
    to the command used to do path conversion in Unix-like environments on
    Windows. (The previous fix for MSVC used FIX_PATH_FOR_CC to do this,
    but the MinGW64 port of GCC does use Unix-style paths so that cannot
    be used here.)

scripts/Mmake.vars.in:
    Add a new mmake variable, FIX_PATH_FOR_WINDOWS.

scripts/Mmakefile:
    Use FIX_PATH_FOR_WINDOWS when creating the test_mdbrc file.
2023-07-26 21:24:28 +10:00
Julien Fischer
16a2943e26 Delete an unused mmake variable.
scripts/Mmake.vars.in:
    The variable FIX_PATH_FOR_CSC has not been used since the old
    .NET backend was deleted. (The current C# backend does not use
    mmake.)
2023-07-23 00:16:34 +10:00
Julien Fischer
74ae4b80b7 Fix debugger tests on Windows.
scripts/Mmakefile:
    Use Windows-style paths in test_mdbrc on Windows.
2023-07-23 00:12:05 +10:00
Julien Fischer
6c0c603aaa Update a comment.
scripts/Mmake.vars.in:
    We have not used cygpath's -w flag for many years; we
    actually use the -m flag.
2023-07-17 19:42:46 +10:00
Peter Wang
adb22a74a7 Delete MERCURY_OPTIONS -a -r -t options.
The MERCURY_OPTIONS environment variable supported these options

    -a  benchmark_all_solns
    -r  repeats
    -t  use_own_timer

to perform microbenchmarks very early on in the Mercury project,
but the time for that is past.

runtime/mercury_wrapper.c:
    Delete code supporting -a, -r and -t options.

scripts/mprof_merge_runs:
    Delete mention of -r option.

tests/benchmarks/Mmakefile:
    Delete/comment out rules that makes use of the -r option.
2023-07-14 11:03:03 +10:00
Julien Fischer
2a366cf295 Deprecate --no-ansi and --no-ansi-c.
--no-ansi (mgnuc) and --no-ansi-c (mmc) have not actually done anything for
many years now. Deprecate these options and remove their "use" throughout most
of the Mercury system. (The remaining uses are in the Makefiles for the Boehm
GC, which need to be updated separately.)

Also deprecate the internal compiler option --cflags-for-ansi.

compiler/options.m:
    Document that --no-ansi-c is now deprecated.

    Document that the internal option --cflags-for-ansi is now
    deprecated.

compiler/compile_target_code.m:
    Do not pass the ANSI options to the C compiler.

scripts/mgnuc.in:
scripts/mgnuc_file_opts.sh-subr:
    Deprecate the --no-ansi option; delete code that no longer does
    anything useful.

configure.ac:
    Delete the configuration variable CFLAGS_FOR_ANSI; it is only ever
    set to be empty. (The comment talks about --no-ansi doing other things
    in the mgnuc script. It used to also cause some preprocessor macros
    to be defined for compatibility with the system headers on some
    platforms -- that has not been the case since 2013.)

doc/user_guide.texi:
    Document that --no-ansi-c is deprecated.

bytecode/Mmakefile:
compiler/Mercury.options:
library/Mercury.options:
extras/odbc/odbc.m:
runtime/Mmakefile:
scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
tests/hard_coded/Mercury.options:
tests/valid/Mercury.options:
trace/Mmakefile:
util/Mmakefile:
    Conform to the above change.

NEWS.md:
    Announce the above.
2023-05-31 17:44:26 +10:00
Julien Fischer
8a3be4eaea Avoid a warning from make on Windows.
scripts/Mmake.vars.in:
    The cygpath utility prints a warning if it is invoked with an empty
    argument.
2023-04-07 19:14:34 +10:00
Peter Wang
3446667416 Fix references to unassigned mmake variables.
compiler/write_deps_file.m:
    Fix reference to used_subdir, should be useds_subdir.

scripts/Mmake.vars.in:
    Assign analysiss_subdir variable.
2023-01-31 15:26:24 +11:00
Peter Wang
b0ae10248b Use --trans-opt-deps-spec option.
Use the recently added --trans-opt-deps-spec option to break cycles in
the trans-opt dependency graph for the standard library. This enables
more parallelism when making the .trans_opt files; it now takes about
half as long as before.

Ordering modules sensibly, so that .trans_opt files are created in a
logical order, also improves analysis results for many predicates and
functions. The only results which show a regression with this change are
for deprecated forwarding predicates/functions.

In future, we will probably be able to trim more dependencies to further
improve parallelism, without impacting analysis results.

configure.ac:
    Check that the bootstrap compiler supports --trans-opt-deps-spec.

library/mer_std.trans_opt_deps_spec:
    Add the spec file that adjusts dependencies in the trans-opt
    dependency graph.

library/INTER_FLAGS:
    Use the --trans-opt-deps-spec option when building with mmake.

scripts/prepare_install_dir.in:
tools/binary:
tools/bootcheck:
tools/unary:
    Copy mer_std.trans_opt_deps_spec when preparing a copy of the
    library directory.
2023-01-25 16:48:45 +11:00
Zoltan Somogyi
05ef8e01fb Rename the .ll_debug grade component to .c_debug.
Rename mmc and mgnuc options that set this grade component to --c-debug-grade.
Let the options named --c-debug of both mmc and mgnuc enable C level debugging
of only the module being compiled.

runtime/mercury_grade.h:
    Rename the .ll_debug grade component to .c_debug. Also rename the C macro
    that controls the presence or absence of this grade component
    from MR_LL_DEBUG to MR_C_DEBUG_GRADE.

runtime/mercury_conf_param.h:
runtime/mercury_debug.c:
runtime/mercury_debug.h:
runtime/mercury_engine.c:
runtime/mercury_label.c:
runtime/mercury_memory_zones.c:
runtime/mercury_memory_zones.h:
runtime/mercury_overflow.c:
runtime/mercury_std.h:
runtime/mercury_wrapper.c:
    Rename the MR_LOWLEVEL_DEBUG macro to MR_DEBUG_THE_RUNTIME.
    Previously, the name of this macro wrongly implied that it had
    something to do with the old .ll_debug grade component, even though

    - the MR_LOWLEVEL_DEBUG macro was designed to debug LLDS grades,
      since only these existed when it was created, while

    - the .ll_debug grade component (now .c_debug) is useful only for
      MLDS grades targeting C.

compiler/options.m:
    Rename the old confusingly named low_level_debug option to c_debug_grade.
    Move it to the list of grade options, and fix its documentation, which
    was completely wrong:

    - code in compile_target_code.m treated it as being a synonym of
      the .ll_debug (now .c_debug) grade component, while
    - its (commented out) documentation here in options.m said it called for
      the enabling of what is now MR_DEBUG_THE_RUNTIME.

compiler/compile_target_code.m:
    Conform to the rename just above.

    Define MR_C_DEBUG_GRADE instead of MR_LL_DEBUG if c_debug_grade is enabled.

    Pass -g to the C compiler if either c_debug_grade or target_debug
    is enabled.

    Add an XXX about a missing safety check for an obsolete experimental
    feature.

compiler/compute_grade.m:
    When given a grade with a .c_debug grade component, set only the
    c_debug_grade option; don't set the target_debug option, which is NOT
    a grade option. The change to compile_target_code.m above handles the
    only situation in which this implication was formerly required.

scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
    Look for and process the .c_debug grade component instead of .ll_debug.
    Use a sh variable named c_debug_grade to record its absence/presence.

    Look for and process the --c-debug-grade grade-component option,
    setting the same sh variable, c_debug_grade. (All grade components
    can be set piecemeal using sh options to the scripts using these
    subroutines.) This replaces the old, confusingly named option
    --low-level-debug.

scripts/mgnuc.in:
scripts/mgnuc_file_opts.sh-subr:
    Consistently use the sh variable c_debug to record the presence of
    the (non-grade) --c-debug option to mgnuc, and the sh variable
    c_debug_grade to record the presence of the .c_debug grade component.

    Stop looking for and handling the --low-level-debug option, which
    mgnuc used to document, even though this duplicated the same documentation
    in init_grade_options.sh-subr, which mgnuc includes. The difference was
    that init_grade_options.sh-subr meant it to represent the old .ll_debug
    MLDS grade component, while mgnuc treated it as specifying what is now
    MR_DEBUG_THE_RUNTIME for LLDS grades. It didn't help that two sh variables
    with quite different semantics had names that differed only in an
    underscore: LLDEBUG_OPTS vs LL_DEBUG_OPTS.

scripts/Mmakefile:
    Add a missing dependency to force the rebuild of mgnuc after each update
    of its sh subroutine mgnuc_file_ops.sh-subr.

doc/user_guide.texi:
    Document the --c-debug-grade option of mmc. This option was not publicly
    documented under its original misleading name (--low-level-debug), but
    its documentation is now possible without contorted dancing around the
    name.

    Clarify the documentation of mgnuc's --c-debug option.

README.sanitizers:
configure.ac:
    Conform to the rename of the grade component.

grade_lib/grade_spec.m:
grade_lib/grade_string.m:
grade_lib/grade_structure.m:
grade_lib/try_all_grade_structs.m:
    Conform to the rename of the grade component .ll_debug to .c_debug.

    Don't allow the .c_debug grade component in LLDS grades.

    In grade_string.m, add some obvious implications of some grade components.

grade_lib/choose_grade.m:
grade_lib/grade_lib.m:
grade_lib/test_grades.m:
grade_lib/var_value_names.m:
    Fix white space.

scripts/ml.in:
tools/lmc.in:
tools/test_mercury:
    Conform to the change in compile_target_code.m to the naming of
    Boehm gc library variants.
2022-12-29 20:33:08 +11:00
brendanzab
b99fea212a Fix typo in mercury_config.in 2022-08-16 15:05:16 +10:00
Julien Fischer
e0c7eedb49 Fix Github issue #102.
Avoid the use of the GCC option -Warray-bounds with GCC version 12 and later.

configure.ac:
scripts/mgnuc.in:
    As above.

NEWS:
    Announce the fix.
2022-06-18 20:12:03 +10:00
Julien Fischer
8ef9073be2 Delete remaining references to --use-trail-segments.
doc/user_guide.texi:
extras/trailed_update/samples/Mmakefile:
extras/trailed_update/tests/Mmakefile:
samples/solver_types/Mercury.options:
scripts/init_grade_options.sh-subr:
    As above.

RELEASE_NOTES_NEXT:
    Delete item concerning the above.
2022-04-18 21:45:15 +10:00
Julien Fischer
105580a765 Delete the trseg component and --trail-segments option.
Trail segments have been the default in trailing grades since Mercury 20.06.
Delete the trseg grade components and --trail-segment option since apart from
acting as synonyms for the tr component and --use-trail option repsectively,
they no longer do anything.

compiler/compute_grade.m:
compiler/handle_options.m:
compiler/options.m:
doc/user_guide.texi:
grade_lib/grade_vars.m:
scripts/parse_grade_option.sh-subr:
grade_lib/grade_string.m:
grade_lib/grade_vars.m:
   Delete the trseg grade component and --trail-segments option.

compiler/add_pragma.m:
   Update the wording of an error message.

NEWS:
   Announce the above.

extras/trail/Mercury.options:
extras/trailed_update/Mmakefile:
extras/references/Mercury.options:
tests/invalid/test_feature_set.err_exp:
    Conform to the above changes
2022-04-05 17:02:40 +10:00
Julien Fischer
668ce29aa1 Fix github issue #101.
scripts/ml.in:
    Avoid turning --mercury-libs none into --mercury-libs static when
    using MSVC. This is causing the linker command line to be invalid.
2022-03-13 05:06:43 +11:00
Julien Fischer
d0f22be99e Avoid spurious warnings from GCC.
As mentioned recently on the developers list, GCC versions 9 10 and 11 are
emitting suprious warnings with -Warray-bounds for the specialised code they
introduce for strcmp etc. Disable that warning for those versions of GCC. In
addition to this issue, according to the GCC bug database is is generating a
lot of false positives anyway.

configure.ac:
scripts/mgnuc.in:
    As above.
2022-03-05 22:39:10 +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
f66a7d6642 Generate diagnostics for .par.mm grades.
compiler/handle_options.m:
runtime/mercury_grade.h:
scripts/final_grade_options.sh-subr:
    Generate an error message for grades that mix parallel execution
    and minimal model tabling.

compiler/compute_grade.m:
    Improve two comments.
2021-06-13 21:41:56 +10:00
Peter Wang
795202f55a Delete erlang options from Mercury.config files.
scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
    Delete Erlang related environment variables and options.
2021-06-07 16:53:40 +10:00
Peter Wang
1dcebc891b Fix -O<n> options below default optimisation level.
The default optimisation level was implemented by having the
Mercury.config file add a -O<n> option to the DEFAULT_MCFLAGS variable.
This allowed the user to override the default optimisation level
by setting the MERCURY_DEFAULT_OPT_LEVEL environment variable.

Commit 181ada0dbf made it so that -O<n>
options do not reset previously set options. This had the unintended
consequence that any -O<n> options below the default optimisation level
had no effect when passed on the command line or in a Mercury.options
file, because a -O<n> option passed by the user would never undo the
options set by the default optimisation level.

compiler/options.m:
    Add new option `--default-opt-level' for use by Mercury.config.

tools/make_optimization_options_end:
    Add predicate to parse the value of `--default-opt-level' from the
    options table. The option value is a string because the value of the
    MERCURY_DEFAULT_OPT_LEVEL environment variable will be passed as
    the option value. The existence of the environment variable was
    (barely) documented, but the allowable values are not.
    Though the user might conceivably have set any Mercury compiler
    option in that environment variable, the value was probably only
    intended to be a string of the form "-O<int>", and that is all we
    will support.

tools/make_optimization_options_middle:
    Use `get_default_opt_level'.

compiler/optimization_options.m:
    Regenerate this file.

compiler/options_file.m:
    Do not automatically add "-O2" to MCFlags.
    The comment says this was to set a default optimisation level when
    calling the `mercury_compile' binary instead of the `mmc' script,
    but `get_default_opt_level' already defaults to optimisation level 2.

scripts/Mercury.config.in:
    Pass the value of MERCURY_DEFAULT_OPT_LEVEL using the
    `--default-opt-level' option.
2021-06-07 16:49:54 +10:00
Peter Wang
347837ca06 Delete erlang from grade scripts.
scripts/canonical_grade.sh-subr:
scripts/final_grade_options.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
    Stop recognising "erlang" as a target or grade component.
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
Julien Fischer
0721d90373 Drop support for versions of macOS prior to 10.9.
This means that the following are no longer supported:

- the powerpc*apple*darwin* configuration.
- versions of XCode prior to about 6 or so

NEWS:
    Announce the above.

README.MacOS:
    Delete text describing things that are no longer supported.

configure.ac:
    Do not check if gcc is really llvm-gcc.  llvm-gcc was replaced
    by clang years ago.

compiler/compile_target_code.m:
scripts/mgnuc.in:
    Delete a workaround for an issue on powerpc based Macs.
2020-10-26 12:54:14 +11:00
Julien Fischer
32eafdab15 Delete an unused script.
scripts/fullarch:
    Delete this script; it isn't used anywhere, no longer works, and has not
    been meaningfully updated since 1995.
2020-10-21 15:22:10 +11:00
Julien Fischer
ff39b3463b Remove legacy support for the Alpha architecture.
README.Linux-Alpha:
runtime/machdeps/ALPHA_REGS:
runtime/machdeps/alpha_regs.h:
runtime/machdeps/alpha_regtest:
    Delete these files.

configure.ac:
runtime/Mmakefile:
runtime/mercury_goto.h:
runtime/mercury_regs.h:
README.md:
README.Linux:
README.Linux-PPC:
    Delete or update references to the Alpha architecture.

NEWS:
    Announce the above.

scripts/mgnuc.in:
    Unrelated: update a comment.
2020-10-18 16:35:52 +11:00
Peter Wang
89e59e7cc8 Delete support for browsing terms as XML.
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.
2020-10-14 17:41:54 +11:00
Julien Fischer
deb79feb2b Delete a leftover reference to getopt_template.
scripts/prepare_install_dir.in:
    As above.
2020-10-10 20:09:03 +11:00
Zoltan Somogyi
be3f9443b1 Simplify the setup of mdbrc for tests.
We used to set up *two* mdbrc files for use by test cases:
scripts/test_mdbrc, and tests/mdbrc. Tools/bootcheck said
the tests should use the former, while tests/Mmake.common
said they should use the latter. This diff deletes the latter,
and uniformly uses the former.

The setup code was also scattered, with parts being done by
the configure script, and part being done by tools/bootcheck.
Move it all to scripts/Mmakefile, since that is the natural
place to put code to build scripts/test_mdbrc.

Mmakefile:
    Fix the action for cleaning up the tests directory.
    This started out as the reason for this whole change.
    As it happens, a *working* action for cleaning up the tests
    broke things, because it deleted an autoconfigured file
    (tests/mdbrc) that there was no rule for rebuilding.
    This issue is what required the rest of this diff.

    When doing "mmake clean/realclean", clean the extras as well.

configure.ac:
    Delete the code creating tests/mdbrc.in.

scripts/Mmakefile:
    Add a rule to build test_mdbrc, as mentioned above.

tests/Mmake.common:
    Switch to using scripts/test_mdbrc in test cases
    run under mdb.

    Mark the rules that clean up mdbrc and mdbrc.in
    as obsolete, since we will now stop creating those files.

tools/bootcheck:
    Delete the code that used to build tests/mdbrc. Instead,
    rebuild scripts/test_mdbrc (in case the workspace was moved),
    and use that.

tests/Mmakefile:
    When cleaning the tests directory, clean its subdirectories
    (since the top level directory does not have much clean).
2020-10-04 23:00:29 +11:00
Zoltan Somogyi
4f3c57e559 Copy getop_template to install dirs. 2020-09-19 08:22:16 +10:00
Zoltan Somogyi
a2def4bcc8 Bring the style of some scripts up to date ...
... by replacing tabs with spaces, adding modelines, replacing [ with test,
and fixing indentation.
2020-08-14 20:11:56 +10:00