mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-27 15:24:00 +00:00
When set, this option tells the compiler to generate warnings
about locally-defined types that are neither used in the module
nor exported to any other module.
compiler/options.m:
Add the new option.
compiler/unused_types.m:
New module to implement the new option.
compiler/mercury_compile_front_end.m:
Invoke the new module, unless the presence of previous errors
would make its warnings just a distraction.
compiler/check_hlds.m:
Include the new module.
compiler/notes/compiler_design.html:
Document the new module.
compiler/typecheck_error_wrong_type.m:
Simplify some code.
browser/declarative_tree.m:
compiler/accumulator.m:
compiler/du_type_layout.m:
compiler/intermod.m:
compiler/mode_errors.m:
compiler/parse_inst_mode_defn.m:
compiler/polyhedron.m:
compiler/split_parse_tree_src.m:
compiler/tag_switch_util.m:
compiler/typecheck_error_unify.m:
compiler/unneeded_code.m:
deep_profiler/mdprof_test.m:
library/getopt.m:
library/getopt_io.m:
Delete unused types reported by the new option.
library/rtti_implementation.m:
Comment out unused type reported by the new option. This type was exported
to both Java and C#, but this diff comments it out because neither language
the Java or the C# runtime system seems to use the exported versions
either. (Bootcheck in both java and csharp grades worked, with the
same number of test case failures as before.) We do not delete it,
because it may be useful in the future.
tests/warnings/help_text.err_exp:
Expect the documentation of the new option.
tests/invalid_nodepend/Mmakefile:
Specify --warn-unused-types for two test cases to test that the compiler
does NOT generate warnings about unused types in the presence of previous
errors.
tests/warnings/abstract_type_decl.err_exp:
tests/warnings/bug412.err_exp:
tests/warnings/warn_dead_procs.err_exp:
Expect the new warnings for unused types.
tests/warnings/Mmakefile:
Specify --warn-unused-types for the three test cases listed above.
206 lines
6.7 KiB
Mathematica
206 lines
6.7 KiB
Mathematica
%-----------------------------------------------------------------------------%
|
|
% vim: ft=mercury ts=4 sw=4 et
|
|
%-----------------------------------------------------------------------------%
|
|
% Copyright (C) 2002-2006, 2009-2010 The University of Melbourne.
|
|
% Copyright (C) 2014-2018, 2021-2026 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.
|
|
%-----------------------------------------------------------------------------%
|
|
%
|
|
% check_hlds: semantic analysis and error checking (the "front end" HLDS pass).
|
|
%
|
|
|
|
:- module check_hlds.
|
|
:- interface.
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
% Type analysis.
|
|
|
|
% The current type analysis system.
|
|
% :- module type_analysis.
|
|
:- include_module check_typeclass.
|
|
:- include_module check_for_missing_type_defns.
|
|
:- include_module check_promise.
|
|
:- include_module post_typecheck.
|
|
:- include_module pre_typecheck.
|
|
:- include_module resolve_unify_functor.
|
|
:- include_module typecheck.
|
|
|
|
:- include_module typeclasses.
|
|
:- include_module types_into_modes.
|
|
% :- end_module type_analysis.
|
|
|
|
% Two never-completed attempts at constraint based type analysis.
|
|
% :- module type_analysis_constraints_1.
|
|
:- include_module old_type_constraints.
|
|
% :- end_module type_analysis_constraints_1.
|
|
% :- module type_analysis_constraints_2.
|
|
:- include_module type_constraints.
|
|
% :- end_module type_analysis_constraints_2.
|
|
|
|
% Purity checking.
|
|
:- include_module purity.
|
|
|
|
% Implementation-defined literals.
|
|
:- include_module implementation_defined_literals.
|
|
|
|
% The polymorphism transformation.
|
|
% :- module polymorphism.
|
|
:- include_module polymorphism.
|
|
:- include_module polymorphism_post_copy.
|
|
:- include_module polymorphism_type_info.
|
|
% :- end_module polymorphism.
|
|
|
|
% Populating proc_infos from the clauses.
|
|
:- include_module clause_to_proc.
|
|
|
|
% Warnings about insts with no matching types.
|
|
:- include_module inst_check.
|
|
|
|
% Preprocessing user insts in the inst table for mode analysis.
|
|
:- include_module inst_user.
|
|
|
|
% Mode analysis.
|
|
|
|
% The current mode analysis system, which is based (quite loosely)
|
|
% on the idea of abstract interpretation.
|
|
% :- module mode_analysis.
|
|
:- include_module inst_abstract_unify.
|
|
:- include_module inst_match.
|
|
:- include_module inst_merge.
|
|
:- include_module mode_comparison.
|
|
:- include_module mode_errors.
|
|
:- include_module mode_info.
|
|
:- include_module mode_test.
|
|
:- include_module modes.
|
|
:- include_module proc_requests.
|
|
:- include_module recompute_instmap_deltas.
|
|
:- include_module unify_proc.
|
|
:- include_module unique_modes.
|
|
% :- end_module mode_analysis.
|
|
|
|
% The following modules implement the first (robdd-based)
|
|
% prototype constraint based mode checker, which was never completed.
|
|
% :- module mode_analysis_robdd.
|
|
:- include_module mode_constraint_robdd.
|
|
:- include_module mode_constraints.
|
|
:- include_module mode_ordering.
|
|
% :- end_module mode_analysis_robdd.
|
|
|
|
% The following modules implement the second (propagation-based)
|
|
% prototype constraint based mode checker, which was never completed.
|
|
% :- module mode_analysis_prop.
|
|
:- include_module abstract_mode_constraints.
|
|
:- include_module build_mode_constraints.
|
|
:- include_module mcsolver.
|
|
:- include_module ordering_mode_constraints.
|
|
:- include_module prop_mode_constraints.
|
|
% :- end_module mode_analysis_prop.
|
|
|
|
% A pass that can sometimes make the result of mode analysis
|
|
% look and behave better.
|
|
:- include_module delay_partial_inst.
|
|
|
|
% Indexing analysis.
|
|
:- include_module cse_detection.
|
|
:- include_module switch_detection.
|
|
:- include_module find_bind_var.
|
|
:- include_module switch_candidates.
|
|
:- include_module scout_disjunctions.
|
|
|
|
% Determinism analysis.
|
|
% :- module determinism_analysis.
|
|
:- include_module det_analysis.
|
|
:- include_module det_infer_goal.
|
|
:- include_module det_util.
|
|
% :- end_module determinism_analysis.
|
|
|
|
% Stratification.
|
|
:- include_module stratify.
|
|
|
|
% Order independent state update pragmas.
|
|
:- include_module oisu_check.
|
|
|
|
% Expand try goals.
|
|
:- include_module try_expand.
|
|
|
|
% Check the information in format_call pragmas.
|
|
:- include_module check_pragma_format_call.
|
|
|
|
% Warnings about simple code.
|
|
:- include_module simplify.
|
|
|
|
% Warnings about unused imports.
|
|
:- include_module unused_imports.
|
|
|
|
% Warnings about unused types.
|
|
:- include_module unused_types.
|
|
|
|
% Warnings about bad programming style.
|
|
:- include_module style_checks.
|
|
|
|
% Output XML representation useful for documentation of module.
|
|
:- include_module xml_documentation.
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
:- implementation.
|
|
%-----------------------------------------------------------------------------%
|
|
|
|
% Type checking.
|
|
% :- module type_analysis.
|
|
:- include_module type_assign.
|
|
:- include_module typecheck_clauses.
|
|
:- include_module typecheck_coerce.
|
|
:- include_module typecheck_cons_infos.
|
|
:- include_module typecheck_debug.
|
|
:- include_module typecheck_errors.
|
|
:- include_module typecheck_error_arg_vector.
|
|
:- include_module typecheck_error_builtin.
|
|
:- include_module typecheck_error_diff.
|
|
:- include_module typecheck_error_overload.
|
|
:- include_module typecheck_error_type_assign.
|
|
:- include_module typecheck_error_undef.
|
|
:- include_module typecheck_error_unify.
|
|
:- include_module typecheck_error_util.
|
|
:- include_module typecheck_error_wrong_type.
|
|
:- include_module typecheck_info.
|
|
:- include_module typecheck_msgs.
|
|
:- include_module typecheck_unify_var_functor.
|
|
:- include_module typecheck_util.
|
|
% :- end_module type_analysis.
|
|
|
|
% Polymorphism transformation.
|
|
% :- module polymorphism.
|
|
:- include_module introduce_exists_casts.
|
|
:- include_module polymorphism_clause.
|
|
:- include_module polymorphism_goal.
|
|
:- include_module polymorphism_info.
|
|
:- include_module polymorphism_lambda.
|
|
:- include_module polymorphism_type_class_info.
|
|
% :- end_module polymorphism.
|
|
|
|
% Mode checking.
|
|
% :- module mode_analysis.
|
|
:- include_module delay_info.
|
|
:- include_module inst_make.
|
|
:- include_module mode_debug.
|
|
:- include_module modecheck_call.
|
|
:- include_module modecheck_coerce.
|
|
:- include_module modecheck_conj.
|
|
:- include_module modecheck_goal.
|
|
:- include_module modecheck_unify.
|
|
:- include_module modecheck_util.
|
|
% :- end_module mode_analysis.
|
|
|
|
% Determinism analysis.
|
|
% :- module determinism_analysis.
|
|
:- include_module det_check_proc.
|
|
:- include_module det_check_goal.
|
|
:- include_module det_check_switch.
|
|
% :- end_module determinism_analysis.
|
|
|
|
%-----------------------------------------------------------------------------%
|
|
:- end_module check_hlds.
|
|
%-----------------------------------------------------------------------------%
|