void module_state::set_filename (const Cody::Packet &packet)
{
- gcc_checking_assert (!filename);
if (packet.GetCode () == Cody::Client::PC_PATHNAME)
- filename = xstrdup (packet.GetString ().c_str ());
+ {
+ /* If we've seen this import before we better have the same CMI. */
+ const std::string &path = packet.GetString ();
+ if (!filename)
+ filename = xstrdup (packet.GetString ().c_str ());
+ else if (filename != path)
+ error_at (loc, "mismatching compiled module interface: "
+ "had %qs, got %qs", filename, path.c_str ());
+ }
else
{
gcc_checking_assert (packet.GetCode () == Cody::Client::PC_ERROR);
- error_at (loc, "unknown Compiled Module Interface: %s",
- packet.GetString ().c_str ());
+ fatal_error (loc, "unknown compiled module interface: %s",
+ packet.GetString ().c_str ());
}
}
translate = packet.GetInteger () ? xlate_kind::text : xlate_kind::unknown;
else if (packet.GetCode () == Cody::Client::PC_PATHNAME)
{
- /* Record the CMI name for when we do the import. */
+ /* Record the CMI name for when we do the import.
+ We may already know about this import, but libcpp doesn't yet. */
module_state *import = get_module (build_string (len, path));
import->set_filename (packet);
translate = xlate_kind::import;
// { dg-additional-files map-2.map }
export module foo;
-// { dg-error "Interface: no such module" "" { target *-*-* } .-1 }
+// { dg-error "interface: no such module" "" { target *-*-* } .-1 }
// { dg-error "failed reading mapper" "" { target *-*-* } 0 }
+// { dg-prune-output "compilation terminated" }