From b424a57253aafe26c07a50fecfd2a61999b06475 Mon Sep 17 00:00:00 2001 From: Francois-Xavier Coudert Date: Thu, 17 Nov 2005 13:51:41 +0100 Subject: re PR fortran/20811 (gfortran include problem (regression from g77)) PR fortran/20811 * scanner.c (gfc_open_included_file): Add an extra include_cwd argument. Only include files in the current working directory if its value is true. * gfortran.h: Change prototype for gfc_open_included_file. (load_file): Don't search for include files in the current working directory. * options.c (gfc_post_options): Add the directory of the source file to the list of paths for included files. * module.c (gfc_use_module): Look for module files in the current directory. From-SVN: r107120 --- gcc/fortran/scanner.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'gcc/fortran/scanner.c') diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index 738e17280a0..883576166ff 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -159,18 +159,22 @@ gfc_release_include_path (void) } /* Opens file for reading, searching through the include directories - given if necessary. */ + given if necessary. If the include_cwd argument is true, we try + to open the file in the current directory first. */ FILE * -gfc_open_included_file (const char *name) +gfc_open_included_file (const char *name, const bool include_cwd) { char *fullname; gfc_directorylist *p; FILE *f; - f = gfc_open_file (name); - if (f != NULL) - return f; + if (include_cwd) + { + f = gfc_open_file (name); + if (f != NULL) + return f; + } for (p = include_dirs; p; p = p->next) { @@ -1034,7 +1038,7 @@ load_file (const char *filename, bool initial) } else { - input = gfc_open_included_file (filename); + input = gfc_open_included_file (filename, false); if (input == NULL) { gfc_error_now ("Can't open included file '%s'", filename); -- cgit v1.2.1