[m-dev.] problems with :- pragma source_file and how to fix them
Ian MacLarty
maclarty at csse.unimelb.edu.au
Mon Aug 6 12:27:49 AEST 2007
Hi,
I recently committed a fix that prevented ":- pragma source_file"
directives from being igored if they appeared before the ":- module"
declaration.
While making that change I discovered another problem. There are some
warnings and errors that are not associated with a specific line in the
source, but with the entire module (for example the "nothing exported"
warnings, or warnings about modules that are imported in the interface,
but not used in the interface). These messages typically call
module_name_to_file_name to create a context for the message. This is
wrong, because it doesn't take into account any ":- pragma source_file"
directives that might be at the top of the file (before the ":- module"
declaration).
To solve this problem I believe we need to store the ":- module" context with
the item list as well as the hlds (since some of the errors are detected
in the item list and some are detected in the hlds).
Zoltan, I believe you are working on a more structured representation of
the item list. Will the new representation have the context of the
top level ":- module" declaration?
In the meantime would it be okay if I changed the code to not throw away
the top level ":- module" item, so that it could be used as a context
for global warnings and errors?
Also, are there any objections to adding a module_context field to the hlds?
Ian.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions: mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the developers
mailing list