Files
mercury/scripts/final_grade_options.sh-subr
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

184 lines
5.2 KiB
Bash

#---------------------------------------------------------------------------#
# vim: ts=4 sw=4 expandtab ft=sh
#---------------------------------------------------------------------------#
# Copyright (C) 1998-2002, 2004-2007, 2009-2010 The University of Melbourne.
# Copyright (C) 2013, 2015-2016, 2020, 2025 The Mercury team.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#---------------------------------------------------------------------------#
#
# final_grade_options.sh-subr:
# An `sh' subroutine for handling implications between grade-related
# options. Used by the `ml', `mgnuc' and `c2init' scripts.
#
# The code here should be inserted after a script's option-parsing loop.
#
# IMPORTANT: any changes to the handling of grades here may also require
# changes to compiler/handle_options.m.
#
# This file should only use the shell variables initialized by
# init_grade_options.sh-subr.
#
#---------------------------------------------------------------------------#
use_minimal_model=false
case ${use_minimal_model_stack_copy} in
true)
use_minimal_model=true
;;
esac
case ${use_minimal_model_own_stacks} in
true)
use_minimal_model=true
;;
esac
# .tr grade is not compatible with .*mm*
# (see comment in runtime/mercury_tabling.c for rationale)
case ${use_trail},${use_minimal_model} in
true,true)
echo "trailing and minimal model tabling are not compatible" 1>&2
exit 1
;;
esac
# .par grade is not compatible with .*mm*
# (see comment in runtime/mercury_grade.h for rationale)
case ${use_trail},${use_minimal_model} in
true,true)
echo "parallel execution and minimal model tabling are not compatible" 1>&2
exit 1
;;
esac
# .exts grade is not compatible with .stseg
# (they are alternative ways of doing the same thing)
case ${extend_stacks},${stack_segments} in
true,true)
echo "--extend-stacks-when-needed and --stack-segments are not compatible" 1>&2
exit 1
;;
esac
# stack segments are not compatible with high-level code
case $highlevel_code,$stack_segments in
true,true)
echo "--high-level-code and --stack-segments are not compatible" 1>&2
exit 1 ;;
esac
# .target_debug grades are not compatible with low-level code
case ${highlevel_code},${target_debug_grade} in
false,true)
echo "--no-high-level-code and --target-debug-grade are not compatible" 1>&2
exit 1
;;
esac
# .debug grades are not compatible with high-level code
case ${highlevel_code},${debug} in
true,true)
echo "--high-level-code and --debug are not compatible" 1>&2
exit 1
;;
esac
# .decldebug grades are not compatible with high-level code
case ${highlevel_code},${decl_debug} in
true,true)
echo "--high-level-code and --decl-debug are not compatible" 1>&2
exit 1
;;
esac
# .profdeep grades are not compatible with high-level code
case ${highlevel_code},${profile_deep} in
true,true)
echo "--high-level-code and --deep-profiling are not compatible" 1>&2
exit 1
;;
esac
# The non-C backends do not support single-precision floats, time profiling,
# memory profiling or deep profiling.
case ${target} in
csharp|java)
case ${single_prec_float} in
true)
echo "--single-prec-float and --target $target are not compatible" 1>&2
exit 1
;;
esac
case ${profile_time} in
true)
echo "--profile-time and --target $target are not compatible" 1>&2
exit 1
;;
esac
case ${profile_memory} in
true)
echo "--profile-memory and --target $target are not compatible" 1>&2
exit 1
;;
esac
case ${profile_deep} in
true)
echo "--profile-deep and --target $target are not compatible" 1>&2
exit 1
;;
esac
;;
esac
# --decl-debug implies --debug
case ${decl_debug} in
true)
debug=true
;;
esac
# --target C#, Java implies --high-level-code
case ${target} in
csharp|java)
highlevel_code=true
;;
esac
# --target C#, Java implies --gc automatic.
# NOTE: the .par grade component is meaningless for the non-C backends,
# so we set it to false if they are being used. This avoids having to
# deal with grades like "java.par".
case ${target} in
csharp|java)
gc_method=automatic
thread_safe=false
;;
esac
# --high-level-code disables the use of low-level gcc extensions
case ${highlevel_code} in
true)
non_local_gotos=false
asm_labels=false
global_regs=false
;;
esac
# --use-regions-debug and --use-regions-profiling aren't meaningful
# without --use-regions
case ${use_regions} in
false)
use_regions_debug=false
use_regions_profiling=false
;;
esac
# threadscope doesn't make sense in non-parallel grades.
case ${thread_safe} in
false)
threadscope=false
;;
esac
#---------------------------------------------------------------------------#