Files
mercury/scripts/canonical_grade.in
Zoltan Somogyi 32006a1c7c Rename and generalize .c_debug to .target_debug.
runtime/mercury_grade.h:
    Rename the grade modifier, and the C macro that represents it.

compiler/options.m:
    Rename the --c-debug-grade option to --target-debug-grade.

compiler/compute_grade.m:
    Rename the grade modifier, and the option that represents it.

    Restrict the .target_debut grade modifier to MLDS grades.

compiler/handle_options.m:
    Implement --target-debug-grade by having it imply --target-debug.

compiler/compile_target_code.m:
compiler/link_target_code.m:
    Pay attention to either --target-debug-grade (for purposes related
    to the grade itself) and to --target-debug (for all other purposes).

scripts/canonical_grade.in:
scripts/canonical_grade.sh-subr:
scripts/final_grade_options.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
    Parse target_debug grade modifiers and --target-debug-grade options
    instead of c_debug grade modifiers and --c-debug-grade options.

    Add (normally commented-out) infrastructure to make it easier
    to debug changes.

    Restrict the .target_debut grade modifier to MLDS grades.

scripts/mgnuc.in:
scripts/mgnuc_file_opts.sh-subr:
    Rename some variables to clarify the distinction between the
    --target-debug option (which, like -g, enabled debugging of only one file)
    and the --target-debug-grade option (which enables it for the whole
    program).

configure.ac:
    Make it easier to debug grade-related changes by recording
    both autoconfigured and user-supplied grades that the rejected by
    the canonical_grade script.

    Conform to the changes above.

README.sanitizers:
doc/user_guide.texi:
grade_lib/grade_spec.m:
grade_lib/grade_string.m:
scripts/ml.in:
tests/warnings/help_text.err_exp:
tools/lmc.in:
tools/test_mercury:
    Conform to the changes above.

scripts/Mmake.vars.in:
    Add some XXXs about style.
2025-08-09 21:48:23 +02:00

72 lines
2.1 KiB
Bash

#! /bin/sh
#---------------------------------------------------------------------------#
# vim: ts=4 sw=4 et ft=sh
#---------------------------------------------------------------------------#
# Copyright (C) 2000 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#---------------------------------------------------------------------------#
#
# canonical_grade --grade <grade-to-be-canonicalized>
#
# This script is meant to be used mainly during the autoconfiguration process.
# It is meant to be invoked with a --grade <grade> option, whose value should
# be a possibly noncanonical grade name given by a human as part of an argument
# to the configure script. The job of this script is to print the canonical
# name of the grade. The script fails after printing an error message if the
# purported "grade" given is not a grade at all, not even a non-canonical one.
# include the file `init_grade_options.sh-subr'
@INIT_GRADE_OPTIONS@
usage="Usage: canonical_grade --grade <actual>"
while true
do
case "$1" in
# include the file `parse_grade_options.sh-subr'
@PARSE_GRADE_OPTIONS@
--)
shift
break
;;
*)
break
;;
esac
shift
done
if test "$#" -ne 0
then
echo "${usage}"
exit 1
fi
# include the file `final_grade_options.sh-subr'
@FINAL_GRADE_OPTIONS@
# include the file `canonical_grade.sh-subr'
@CANONICAL_GRADE@
# You can enable this code if you modify the canonicalization process
# and suspect that the new version is misbehaving.
#
# Note: this code cannot be left on permanently because it will report
# a spurious error if e.g. we correctly canonicalize ".mm" to ".mmsc".
#
# if test "${input_grade_string_len}" != 0
# then
# output_grade_string_len=${#GRADE}
# if test "${input_grade_string_len}" != "${output_grade_string_len}"
# then
# echo "internal error: canonicalization screws up some components:"
# echo "the canonical version of ${grade} is ${GRADE}."
# exit 1
# fi
# fi
echo ${GRADE}
exit 0