diff options
author | Francois-Xavier Coudert <coudert@clipper.ens.fr> | 2005-11-17 13:51:41 +0100 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2005-11-17 12:51:41 +0000 |
commit | b424a57253aafe26c07a50fecfd2a61999b06475 (patch) | |
tree | 35d678ee317290325bc9327dcad95c6ae1820654 /gcc/fortran/options.c | |
parent | 1c2e7a3ab332ecb47b606ce2400672eb6065e45f (diff) | |
download | gcc-b424a57253aafe26c07a50fecfd2a61999b06475.zip gcc-b424a57253aafe26c07a50fecfd2a61999b06475.tar.gz gcc-b424a57253aafe26c07a50fecfd2a61999b06475.tar.bz2 |
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/options.c')
-rw-r--r-- | gcc/fortran/options.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index ebce409..a39876b 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -172,6 +172,8 @@ bool gfc_post_options (const char **pfilename) { const char *filename = *pfilename; + char *source_path; + int i; /* Verify the input file name. */ if (!filename || strcmp (filename, "-") == 0) @@ -181,6 +183,21 @@ gfc_post_options (const char **pfilename) gfc_source_file = filename; + /* Adds the path where the source file is to the list of include files. */ + + i = strlen(gfc_source_file); + while (i > 0 && !IS_DIR_SEPARATOR(gfc_source_file[i])) + i--; + if (i != 0) + { + source_path = alloca (i + 1); + memcpy (source_path, gfc_source_file, i); + source_path[i] = 0; + gfc_add_include_path (source_path); + } + else + gfc_add_include_path ("."); + /* Decide which form the file will be read in as. */ if (gfc_option.source_form != FORM_UNKNOWN) |