diff -p -r -U3 -N -X /home/gpc/p/script/gpcdiff.exclude orig/p/module.c p/module.c --- orig/p/module.c Mon Dec 3 02:31:43 2001 +++ p/module.c Fri Dec 14 18:35:10 2001 @@ -1140,41 +1140,12 @@ module_must_be_recompiled (interface_nam char *module_filename; tree import_list; { - char *gpc_name, *gpc_args, *dep_filename, *p; + char *gpc_name, *gpc_args, *dep_filename; tree interface; FILE *dep_file; struct stat gpi_status, source_status, other_gpi_status; char source_filename[2048], *object_filename = NULL; - /* No source found --> cannot recompile. */ - p = module_filename; - module_filename = locate_file (p, LF_UNIT); - - if (! module_filename) - { - char *q = p + strlen (p) - 1; - while (q >= p && *q != '.') - q--; - if (*q == '.') - { - /* Tell the linker about the object file. */ - char *object_filename = save_string (p); - q = object_filename + (q - p); - q[1] = 'o'; - q[2] = 0; - p = locate_file (object_filename, LF_UNIT); - if (p) - { - add_to_link_file_list (p); - free (p); - } - else if (flag_automake > 0 && /*@@ linking*/0) - error ("object file `%s' not found", object_filename); - free (object_filename); - } - return 0; - } - /* Module is in this file --> cannot recompile. */ for (interface = internal_exported_interface_list; interface; interface = TREE_CHAIN (interface)) @@ -1183,20 +1154,14 @@ module_must_be_recompiled (interface_nam /* `--autobuild' given --> recompile. */ if (flag_automake > 2) - { - free (module_filename); - return 1; - } + return 1; /* GPI file older than source --> recompile. */ stat (gpi_filename, &gpi_status); stat (module_filename, &source_status); if (gpi_status.st_mtime < source_status.st_mtime && flag_automake > 1) /* not with `--autolink' */ - { - free (module_filename); - return 1; - } + return 1; /* GPI file older than imported GPI files --> recompile. */ for (interface = import_list; interface; interface = TREE_CHAIN (interface)) @@ -1213,10 +1178,7 @@ module_must_be_recompiled (interface_nam * @@@ Do we need to go deeper? */ if (!p && flag_automake > 1) /* not with `--autolink' */ - { - free (module_filename); - return 1; - } + return 1; if (p) { @@ -1224,7 +1186,6 @@ module_must_be_recompiled (interface_nam if (gpi_status.st_mtime < other_gpi_status.st_mtime && flag_automake > 1) /* not with `--autolink' */ { - free (module_filename); free (p); return 1; } @@ -1270,7 +1231,7 @@ module_must_be_recompiled (interface_nam { if (fscanf (dep_file, "%s", source_filename) > 0 && strcmp (source_filename, "\\") != 0) { - p = source_filename + strlen (source_filename) - 1; + char *p = source_filename + strlen (source_filename) - 1; if (*p == ':') { /* This is the name of the object file. @@ -1289,7 +1250,6 @@ module_must_be_recompiled (interface_nam fclose (dep_file); unlink (dep_filename); free (dep_filename); - free (module_filename); return 1; } } @@ -1311,7 +1271,6 @@ module_must_be_recompiled (interface_nam fclose (dep_file); unlink (dep_filename); free (dep_filename); - free (module_filename); if (object_filename) free (object_filename); return 1; @@ -1331,7 +1290,6 @@ module_must_be_recompiled (interface_nam /* All possible checks passed --> no recompilation. */ free (dep_filename); - free (module_filename); return 0; } @@ -3629,7 +3587,7 @@ gpi_open (interface_name, name, source, { char *errstr = NULL; int must_recompile = 0, version_set = 0, module_name_set = 0, - start_of_nodes = -1, start_of_offsets = -1; + start_of_nodes = -1, start_of_offsets = -1, source_found = 0; tree import_list = NULL_TREE, imported; string_list *link_list = NULL; char header[sizeof (GPI_HEADER)]; @@ -3673,7 +3631,9 @@ gpi_open (interface_name, name, source, case GPI_CHUNK_SRCFILE: str = module_filename = load_string (s); source_name = locate_interface_source (temp_name, source, module_filename); - if (!source_name) + if (source_name) + source_found = 1; + else source_name = save_string (module_filename); break; case GPI_CHUNK_IMPORT: @@ -3782,7 +3742,7 @@ gpi_open (interface_name, name, source, worth doing it. -- Frank */ if (!(automake_level > 1 && !file_is_being_compiled (locate_file (source_name, LF_UNIT), 1) - && (must_recompile || module_must_be_recompiled (interface_name, temp_name, source_name, import_list)))) + && (must_recompile || (source_found && module_must_be_recompiled (interface_name, temp_name, source_name, import_list))))) { if (errstr) /* We get here if an error was just output, but recompilation is @@ -3791,6 +3751,30 @@ gpi_open (interface_name, name, source, fatal ("cannot recompile module"); name = temp_name; /* Don't do this until here when we know that the GPI file is valid */ + + if (!source_found) + { + char *p = source_name, *q = p + strlen (p) - 1; + while (q >= p && *q != '.') + q--; + if (*q == '.' && q[1]) + { + /* Tell the linker about the object file. */ + char *object_filename = save_string (p); + q = object_filename + (q - p); + q[1] = 'o'; + q[2] = 0; + p = locate_file (object_filename, LF_UNIT); + if (p) + { + add_to_link_file_list (p); + free (p); + } + /* else @@ wrong if in current file (mod9.pas) + error ("object file `%s' not found", object_filename); */ + free (object_filename); + } + } /* Record modules used by the one being imported as "implementation imports" for the one being compiled. diff -p -r -U3 -N -X /home/gpc/p/script/gpcdiff.exclude orig/p/rts/rts-version p/rts/rts-version --- orig/p/rts/rts-version Sun Dec 2 07:17:36 2001 +++ p/rts/rts-version Fri Dec 14 18:44:21 2001 @@ -1 +1 @@ -20011202 +20011214 diff -p -r -U3 -N -X /home/gpc/p/script/gpcdiff.exclude orig/p/version.h p/version.h --- orig/p/version.h Sun Dec 2 07:17:36 2001 +++ p/version.h Fri Dec 14 18:44:21 2001 @@ -3,4 +3,4 @@ #define GPC_MAJOR "2" #define GPC_MINOR "0" -#define GPC_VERSION_STRING "20011202" +#define GPC_VERSION_STRING "20011214"