summaryrefslogtreecommitdiff
path: root/gcc/fortran/scanner.c
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <coudert@clipper.ens.fr>2005-11-17 13:51:41 +0100
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2005-11-17 12:51:41 +0000
commitb424a57253aafe26c07a50fecfd2a61999b06475 (patch)
tree35d678ee317290325bc9327dcad95c6ae1820654 /gcc/fortran/scanner.c
parent1c2e7a3ab332ecb47b606ce2400672eb6065e45f (diff)
downloadgcc-b424a57253aafe26c07a50fecfd2a61999b06475.tar.gz
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
Diffstat (limited to 'gcc/fortran/scanner.c')
-rw-r--r--gcc/fortran/scanner.c16
1 files changed, 10 insertions, 6 deletions
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);