mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 19:03:45 +00:00
Eliminate some redundant target->filename conversions.
compiler/make.util.m:
Many operations in this module that operate on filenames did not take
those filenames as arguments; instead, they took an argument such as
a target_file from which they *computed* the filename. This meant that
any predicate that called more than one of these operations implicitly
computed the filename more than once. This could be a problem, because
- there are several predicates one can use to compute the filename, but
- there is no guarantee that different operations use the same predicate.
As a first step in fixing this, change the predicates that print
filenames in progress or error messages to take those filenames
as parameters. Delete one of them, target_file_error, because
after this change, it would have become identical to the existing
file_error predicate.
compiler/make.module_target.m:
Require the callers of record_made_target to supply the filename
as well as the target_file from which it is derived.
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make.program_target.m:
Compute the filename before calling the updated operations in make.util.m
and/or make.module_target.m.
Add "XXX MAKE_STREAM" to places in the code that operate on either
implicit or badly-chosed explicit streams.
This commit is contained in:
@@ -594,7 +594,10 @@ build_linked_target_2(Globals, MainModuleName, FileType, OutputFileName,
|
||||
Succeeded = did_not_succeed
|
||||
;
|
||||
DepsResult = deps_up_to_date,
|
||||
MsgTarget = top_target_file(MainModuleName, linked_target(FileType)),
|
||||
MainModuleLinkedTarget =
|
||||
top_target_file(MainModuleName, linked_target(FileType)),
|
||||
linked_target_file_name(Globals, MainModuleName, FileType,
|
||||
MainModuleLinkedFileName, !IO),
|
||||
globals.lookup_bool_option(NoLinkObjsGlobals, use_grade_subdirs,
|
||||
UseGradeSubdirs),
|
||||
(
|
||||
@@ -605,16 +608,17 @@ build_linked_target_2(Globals, MainModuleName, FileType, OutputFileName,
|
||||
(
|
||||
MadeSymlinkOrCopy = yes,
|
||||
maybe_symlink_or_copy_linked_target_message(NoLinkObjsGlobals,
|
||||
$pred, MsgTarget, !IO)
|
||||
MainModuleLinkedFileName, !IO)
|
||||
;
|
||||
MadeSymlinkOrCopy = no,
|
||||
maybe_warn_up_to_date_target(NoLinkObjsGlobals, $pred,
|
||||
MsgTarget, !Info, !IO)
|
||||
maybe_warn_up_to_date_target(NoLinkObjsGlobals,
|
||||
MainModuleLinkedTarget, MainModuleLinkedFileName,
|
||||
!Info, !IO)
|
||||
)
|
||||
;
|
||||
UseGradeSubdirs = no,
|
||||
maybe_warn_up_to_date_target(NoLinkObjsGlobals, $pred,
|
||||
MsgTarget, !Info, !IO),
|
||||
maybe_warn_up_to_date_target(NoLinkObjsGlobals,
|
||||
MainModuleLinkedTarget, MainModuleLinkedFileName, !Info, !IO),
|
||||
Succeeded = succeeded
|
||||
)
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user