|
|
840d93 |
2018-11-21 Jakub Jelinek <jakub@redhat.com>
|
|
|
840d93 |
Mark Eggleston <mark.eggleston@codethink.com>
|
|
|
840d93 |
|
|
|
840d93 |
* lang.opt (fdec-include): New option.
|
|
|
840d93 |
* options.c (set_dec_flags): Set also flag_dec_include.
|
|
|
840d93 |
* scanner.c (include_line): Change return type from bool to int.
|
|
|
840d93 |
In fixed form allow spaces in between include keyword letters.
|
|
|
840d93 |
For -fdec-include, allow in fixed form 0 in column 6. With
|
|
|
840d93 |
-fdec-include return -1 if the parsed line is not full include
|
|
|
840d93 |
statement and it could be successfully completed on continuation
|
|
|
840d93 |
lines.
|
|
|
840d93 |
(include_stmt): New function.
|
|
|
840d93 |
(load_file): Adjust include_line caller. If it returns -1, keep
|
|
|
840d93 |
trying include_stmt until it stops returning -1 whenever adding
|
|
|
840d93 |
further line of input.
|
|
|
840d93 |
|
|
|
840d93 |
diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
|
|
|
840d93 |
index 2b7f2903761..fe0c6934220 100644
|
|
|
840d93 |
--- a/gcc/fortran/lang.opt
|
|
|
840d93 |
+++ b/gcc/fortran/lang.opt
|
|
|
840d93 |
@@ -440,6 +440,10 @@ fdec
|
|
|
840d93 |
Fortran Var(flag_dec_pad_with_spaces)
|
|
|
840d93 |
For character to integer conversions, use spaces for the pad rather than NUL.
|
|
|
840d93 |
|
|
|
840d93 |
+fdec-include
|
|
|
840d93 |
+Fortran Var(flag_dec_include)
|
|
|
840d93 |
+Enable legacy parsing of INCLUDE as statement.
|
|
|
840d93 |
+
|
|
|
840d93 |
fdec-intrinsic-ints
|
|
|
840d93 |
Fortran Var(flag_dec_intrinsic_ints)
|
|
|
840d93 |
Enable kind-specific variants of integer intrinsic functions.
|
|
|
840d93 |
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
|
|
|
840d93 |
index 73f5389361d..e59ba31ba7b 100644
|
|
|
840d93 |
--- a/gcc/fortran/options.c
|
|
|
840d93 |
+++ b/gcc/fortran/options.c
|
|
|
840d93 |
@@ -68,6 +68,7 @@ set_dec_flags (int value)
|
|
|
840d93 |
flag_dec_intrinsic_ints |= value;
|
|
|
840d93 |
flag_dec_static |= value;
|
|
|
840d93 |
flag_dec_math |= value;
|
|
|
840d93 |
+ flag_dec_include |= value;
|
|
|
840d93 |
}
|
|
|
840d93 |
|
|
|
840d93 |
|
|
|
840d93 |
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
|
|
|
840d93 |
index 55d6dafdb5d..5b27ab5e52d 100644
|
|
|
840d93 |
--- a/gcc/fortran/scanner.c
|
|
|
840d93 |
+++ b/gcc/fortran/scanner.c
|
|
|
840d93 |
@@ -2135,14 +2135,18 @@ static bool load_file (const char *, const char *, bool);
|
|
|
840d93 |
/* include_line()-- Checks a line buffer to see if it is an include
|
|
|
840d93 |
line. If so, we call load_file() recursively to load the included
|
|
|
840d93 |
file. We never return a syntax error because a statement like
|
|
|
840d93 |
- "include = 5" is perfectly legal. We return false if no include was
|
|
|
840d93 |
- processed or true if we matched an include. */
|
|
|
840d93 |
+ "include = 5" is perfectly legal. We return 0 if no include was
|
|
|
840d93 |
+ processed, 1 if we matched an include or -1 if include was
|
|
|
840d93 |
+ partially processed, but will need continuation lines. */
|
|
|
840d93 |
|
|
|
840d93 |
-static bool
|
|
|
840d93 |
+static int
|
|
|
840d93 |
include_line (gfc_char_t *line)
|
|
|
840d93 |
{
|
|
|
840d93 |
gfc_char_t quote, *c, *begin, *stop;
|
|
|
840d93 |
char *filename;
|
|
|
840d93 |
+ const char *include = "include";
|
|
|
840d93 |
+ bool allow_continuation = flag_dec_include;
|
|
|
840d93 |
+ int i;
|
|
|
840d93 |
|
|
|
840d93 |
c = line;
|
|
|
840d93 |
|
|
|
840d93 |
@@ -2158,42 +2162,133 @@ include_line (gfc_char_t *line)
|
|
|
840d93 |
else
|
|
|
840d93 |
{
|
|
|
840d93 |
if ((*c == '!' || *c == 'c' || *c == 'C' || *c == '*')
|
|
|
840d93 |
- && c[1] == '$' && (c[2] == ' ' || c[2] == '\t'))
|
|
|
840d93 |
+ && c[1] == '$' && c[2] == ' ')
|
|
|
840d93 |
c += 3;
|
|
|
840d93 |
}
|
|
|
840d93 |
}
|
|
|
840d93 |
|
|
|
840d93 |
- while (*c == ' ' || *c == '\t')
|
|
|
840d93 |
- c++;
|
|
|
840d93 |
+ if (gfc_current_form == FORM_FREE)
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ while (*c == ' ' || *c == '\t')
|
|
|
840d93 |
+ c++;
|
|
|
840d93 |
+ if (gfc_wide_strncasecmp (c, "include", 7))
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ if (!allow_continuation)
|
|
|
840d93 |
+ return 0;
|
|
|
840d93 |
+ for (i = 0; i < 7; ++i)
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ gfc_char_t c1 = gfc_wide_tolower (*c);
|
|
|
840d93 |
+ if (c1 != (unsigned char) include[i])
|
|
|
840d93 |
+ break;
|
|
|
840d93 |
+ c++;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ if (i == 0 || *c != '&')
|
|
|
840d93 |
+ return 0;
|
|
|
840d93 |
+ c++;
|
|
|
840d93 |
+ while (*c == ' ' || *c == '\t')
|
|
|
840d93 |
+ c++;
|
|
|
840d93 |
+ if (*c == '\0' || *c == '!')
|
|
|
840d93 |
+ return -1;
|
|
|
840d93 |
+ return 0;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
|
|
|
840d93 |
- if (gfc_wide_strncasecmp (c, "include", 7))
|
|
|
840d93 |
- return false;
|
|
|
840d93 |
+ c += 7;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ else
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ while (*c == ' ' || *c == '\t')
|
|
|
840d93 |
+ c++;
|
|
|
840d93 |
+ if (flag_dec_include && *c == '0' && c - line == 5)
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ c++;
|
|
|
840d93 |
+ while (*c == ' ' || *c == '\t')
|
|
|
840d93 |
+ c++;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ if (c - line < 6)
|
|
|
840d93 |
+ allow_continuation = false;
|
|
|
840d93 |
+ for (i = 0; i < 7; ++i)
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ gfc_char_t c1 = gfc_wide_tolower (*c);
|
|
|
840d93 |
+ if (c1 != (unsigned char) include[i])
|
|
|
840d93 |
+ break;
|
|
|
840d93 |
+ c++;
|
|
|
840d93 |
+ while (*c == ' ' || *c == '\t')
|
|
|
840d93 |
+ c++;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ if (!allow_continuation)
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ if (i != 7)
|
|
|
840d93 |
+ return 0;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ else if (i != 7)
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ if (i == 0)
|
|
|
840d93 |
+ return 0;
|
|
|
840d93 |
+
|
|
|
840d93 |
+ /* At the end of line or comment this might be continued. */
|
|
|
840d93 |
+ if (*c == '\0' || *c == '!')
|
|
|
840d93 |
+ return -1;
|
|
|
840d93 |
+
|
|
|
840d93 |
+ return 0;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ }
|
|
|
840d93 |
|
|
|
840d93 |
- c += 7;
|
|
|
840d93 |
while (*c == ' ' || *c == '\t')
|
|
|
840d93 |
c++;
|
|
|
840d93 |
|
|
|
840d93 |
/* Find filename between quotes. */
|
|
|
840d93 |
-
|
|
|
840d93 |
+
|
|
|
840d93 |
quote = *c++;
|
|
|
840d93 |
if (quote != '"' && quote != '\'')
|
|
|
840d93 |
- return false;
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ if (allow_continuation)
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ if (gfc_current_form == FORM_FREE)
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ if (quote == '&')
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ while (*c == ' ' || *c == '\t')
|
|
|
840d93 |
+ c++;
|
|
|
840d93 |
+ if (*c == '\0' || *c == '!')
|
|
|
840d93 |
+ return -1;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ else if (quote == '\0' || quote == '!')
|
|
|
840d93 |
+ return -1;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ return 0;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
|
|
|
840d93 |
begin = c;
|
|
|
840d93 |
|
|
|
840d93 |
+ bool cont = false;
|
|
|
840d93 |
while (*c != quote && *c != '\0')
|
|
|
840d93 |
- c++;
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ if (allow_continuation && gfc_current_form == FORM_FREE)
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ if (*c == '&')
|
|
|
840d93 |
+ cont = true;
|
|
|
840d93 |
+ else if (*c != ' ' && *c != '\t')
|
|
|
840d93 |
+ cont = false;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ c++;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
|
|
|
840d93 |
if (*c == '\0')
|
|
|
840d93 |
- return false;
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ if (allow_continuation
|
|
|
840d93 |
+ && (cont || gfc_current_form != FORM_FREE))
|
|
|
840d93 |
+ return -1;
|
|
|
840d93 |
+ return 0;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
|
|
|
840d93 |
stop = c++;
|
|
|
840d93 |
-
|
|
|
840d93 |
+
|
|
|
840d93 |
while (*c == ' ' || *c == '\t')
|
|
|
840d93 |
c++;
|
|
|
840d93 |
|
|
|
840d93 |
if (*c != '\0' && *c != '!')
|
|
|
840d93 |
- return false;
|
|
|
840d93 |
+ return 0;
|
|
|
840d93 |
|
|
|
840d93 |
/* We have an include line at this point. */
|
|
|
840d93 |
|
|
|
840d93 |
@@ -2205,9 +2300,130 @@ include_line (gfc_char_t *line)
|
|
|
840d93 |
exit (FATAL_EXIT_CODE);
|
|
|
840d93 |
|
|
|
840d93 |
free (filename);
|
|
|
840d93 |
- return true;
|
|
|
840d93 |
+ return 1;
|
|
|
840d93 |
}
|
|
|
840d93 |
|
|
|
840d93 |
+/* Similarly, but try to parse an INCLUDE statement, using gfc_next_char etc.
|
|
|
840d93 |
+ APIs. Return 1 if recognized as valid INCLUDE statement and load_file has
|
|
|
840d93 |
+ been called, 0 if it is not a valid INCLUDE statement and -1 if eof has
|
|
|
840d93 |
+ been encountered while parsing it. */
|
|
|
840d93 |
+static int
|
|
|
840d93 |
+include_stmt (gfc_linebuf *b)
|
|
|
840d93 |
+{
|
|
|
840d93 |
+ int ret = 0, i, length;
|
|
|
840d93 |
+ const char *include = "include";
|
|
|
840d93 |
+ gfc_char_t c, quote = 0;
|
|
|
840d93 |
+ locus str_locus;
|
|
|
840d93 |
+ char *filename;
|
|
|
840d93 |
+
|
|
|
840d93 |
+ continue_flag = 0;
|
|
|
840d93 |
+ end_flag = 0;
|
|
|
840d93 |
+ gcc_attribute_flag = 0;
|
|
|
840d93 |
+ openmp_flag = 0;
|
|
|
840d93 |
+ openacc_flag = 0;
|
|
|
840d93 |
+ continue_count = 0;
|
|
|
840d93 |
+ continue_line = 0;
|
|
|
840d93 |
+ gfc_current_locus.lb = b;
|
|
|
840d93 |
+ gfc_current_locus.nextc = b->line;
|
|
|
840d93 |
+
|
|
|
840d93 |
+ gfc_skip_comments ();
|
|
|
840d93 |
+ gfc_gobble_whitespace ();
|
|
|
840d93 |
+
|
|
|
840d93 |
+ for (i = 0; i < 7; i++)
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ c = gfc_next_char ();
|
|
|
840d93 |
+ if (c != (unsigned char) include[i])
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ if (gfc_current_form == FORM_FIXED
|
|
|
840d93 |
+ && i == 0
|
|
|
840d93 |
+ && c == '0'
|
|
|
840d93 |
+ && gfc_current_locus.nextc == b->line + 6)
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ gfc_gobble_whitespace ();
|
|
|
840d93 |
+ i--;
|
|
|
840d93 |
+ continue;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ gcc_assert (i != 0);
|
|
|
840d93 |
+ if (c == '\n')
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ gfc_advance_line ();
|
|
|
840d93 |
+ gfc_skip_comments ();
|
|
|
840d93 |
+ if (gfc_at_eof ())
|
|
|
840d93 |
+ ret = -1;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ goto do_ret;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ gfc_gobble_whitespace ();
|
|
|
840d93 |
+
|
|
|
840d93 |
+ c = gfc_next_char ();
|
|
|
840d93 |
+ if (c == '\'' || c == '"')
|
|
|
840d93 |
+ quote = c;
|
|
|
840d93 |
+ else
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ if (c == '\n')
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ gfc_advance_line ();
|
|
|
840d93 |
+ gfc_skip_comments ();
|
|
|
840d93 |
+ if (gfc_at_eof ())
|
|
|
840d93 |
+ ret = -1;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ goto do_ret;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+
|
|
|
840d93 |
+ str_locus = gfc_current_locus;
|
|
|
840d93 |
+ length = 0;
|
|
|
840d93 |
+ do
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ c = gfc_next_char_literal (INSTRING_NOWARN);
|
|
|
840d93 |
+ if (c == quote)
|
|
|
840d93 |
+ break;
|
|
|
840d93 |
+ if (c == '\n')
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ gfc_advance_line ();
|
|
|
840d93 |
+ gfc_skip_comments ();
|
|
|
840d93 |
+ if (gfc_at_eof ())
|
|
|
840d93 |
+ ret = -1;
|
|
|
840d93 |
+ goto do_ret;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ length++;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ while (1);
|
|
|
840d93 |
+
|
|
|
840d93 |
+ gfc_gobble_whitespace ();
|
|
|
840d93 |
+ c = gfc_next_char ();
|
|
|
840d93 |
+ if (c != '\n')
|
|
|
840d93 |
+ goto do_ret;
|
|
|
840d93 |
+
|
|
|
840d93 |
+ gfc_current_locus = str_locus;
|
|
|
840d93 |
+ ret = 1;
|
|
|
840d93 |
+ filename = XNEWVEC (char, length + 1);
|
|
|
840d93 |
+ for (i = 0; i < length; i++)
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ c = gfc_next_char_literal (INSTRING_WARN);
|
|
|
840d93 |
+ gcc_assert (gfc_wide_fits_in_byte (c));
|
|
|
840d93 |
+ filename[i] = (unsigned char) c;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ filename[length] = '\0';
|
|
|
840d93 |
+ if (!load_file (filename, NULL, false))
|
|
|
840d93 |
+ exit (FATAL_EXIT_CODE);
|
|
|
840d93 |
+
|
|
|
840d93 |
+ free (filename);
|
|
|
840d93 |
+
|
|
|
840d93 |
+do_ret:
|
|
|
840d93 |
+ continue_flag = 0;
|
|
|
840d93 |
+ end_flag = 0;
|
|
|
840d93 |
+ gcc_attribute_flag = 0;
|
|
|
840d93 |
+ openmp_flag = 0;
|
|
|
840d93 |
+ openacc_flag = 0;
|
|
|
840d93 |
+ continue_count = 0;
|
|
|
840d93 |
+ continue_line = 0;
|
|
|
840d93 |
+ memset (&gfc_current_locus, '\0', sizeof (locus));
|
|
|
840d93 |
+ memset (&openmp_locus, '\0', sizeof (locus));
|
|
|
840d93 |
+ memset (&openacc_locus, '\0', sizeof (locus));
|
|
|
840d93 |
+ memset (&gcc_attribute_locus, '\0', sizeof (locus));
|
|
|
840d93 |
+ return ret;
|
|
|
840d93 |
+}
|
|
|
840d93 |
|
|
|
840d93 |
/* Load a file into memory by calling load_line until the file ends. */
|
|
|
840d93 |
|
|
|
840d93 |
@@ -2215,7 +2431,7 @@ static bool
|
|
|
840d93 |
load_file (const char *realfilename, const char *displayedname, bool initial)
|
|
|
840d93 |
{
|
|
|
840d93 |
gfc_char_t *line;
|
|
|
840d93 |
- gfc_linebuf *b;
|
|
|
840d93 |
+ gfc_linebuf *b, *include_b = NULL;
|
|
|
840d93 |
gfc_file *f;
|
|
|
840d93 |
FILE *input;
|
|
|
840d93 |
int len, line_len;
|
|
|
840d93 |
@@ -2318,6 +2534,7 @@ load_file (const char *realfilename, const char *displayedname, bool initial)
|
|
|
840d93 |
for (;;)
|
|
|
840d93 |
{
|
|
|
840d93 |
int trunc = load_line (input, &line, &line_len, NULL);
|
|
|
840d93 |
+ int inc_line;
|
|
|
840d93 |
|
|
|
840d93 |
len = gfc_wide_strlen (line);
|
|
|
840d93 |
if (feof (input) && len == 0)
|
|
|
840d93 |
@@ -2366,11 +2583,12 @@ load_file (const char *realfilename, const char *displayedname, bool initial)
|
|
|
840d93 |
}
|
|
|
840d93 |
|
|
|
840d93 |
/* Preprocessed files have preprocessor lines added before the byte
|
|
|
840d93 |
- order mark, so first_line is not about the first line of the file
|
|
|
840d93 |
+ order mark, so first_line is not about the first line of the file
|
|
|
840d93 |
but the first line that's not a preprocessor line. */
|
|
|
840d93 |
first_line = false;
|
|
|
840d93 |
|
|
|
840d93 |
- if (include_line (line))
|
|
|
840d93 |
+ inc_line = include_line (line);
|
|
|
840d93 |
+ if (inc_line > 0)
|
|
|
840d93 |
{
|
|
|
840d93 |
current_file->line++;
|
|
|
840d93 |
continue;
|
|
|
840d93 |
@@ -2403,6 +2621,36 @@ load_file (const char *realfilename, const char *displayedname, bool initial)
|
|
|
840d93 |
|
|
|
840d93 |
while (file_changes_cur < file_changes_count)
|
|
|
840d93 |
file_changes[file_changes_cur++].lb = b;
|
|
|
840d93 |
+
|
|
|
840d93 |
+ if (flag_dec_include)
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ if (include_b && b != include_b)
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ int inc_line2 = include_stmt (include_b);
|
|
|
840d93 |
+ if (inc_line2 == 0)
|
|
|
840d93 |
+ include_b = NULL;
|
|
|
840d93 |
+ else if (inc_line2 > 0)
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ do
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ if (gfc_current_form == FORM_FIXED)
|
|
|
840d93 |
+ {
|
|
|
840d93 |
+ for (gfc_char_t *p = include_b->line; *p; p++)
|
|
|
840d93 |
+ *p = ' ';
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ else
|
|
|
840d93 |
+ include_b->line[0] = '\0';
|
|
|
840d93 |
+ if (include_b == b)
|
|
|
840d93 |
+ break;
|
|
|
840d93 |
+ include_b = include_b->next;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ while (1);
|
|
|
840d93 |
+ include_b = NULL;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ }
|
|
|
840d93 |
+ if (inc_line == -1 && !include_b)
|
|
|
840d93 |
+ include_b = b;
|
|
|
840d93 |
+ }
|
|
|
840d93 |
}
|
|
|
840d93 |
|
|
|
840d93 |
/* Release the line buffer allocated in load_line. */
|
|
|
840d93 |
diff --git a/gcc/testsuite/gfortran.dg/gomp/include_1.f b/gcc/testsuite/gfortran.dg/gomp/include_1.f
|
|
|
840d93 |
new file mode 100644
|
|
|
840d93 |
index 00000000000..715eb5b97e3
|
|
|
840d93 |
--- /dev/null
|
|
|
840d93 |
+++ b/gcc/testsuite/gfortran.dg/gomp/include_1.f
|
|
|
840d93 |
@@ -0,0 +1,49 @@
|
|
|
840d93 |
+c { dg-do compile }
|
|
|
840d93 |
+c { dg-options "-fopenmp -fdec" }
|
|
|
840d93 |
+ subroutine foo
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+c$ 0include 'include_1.inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+ end subroutine foo
|
|
|
840d93 |
+ subroutine bar
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ i
|
|
|
840d93 |
+C$ ;n
|
|
|
840d93 |
+ +c
|
|
|
840d93 |
+
|
|
|
840d93 |
+c some comment
|
|
|
840d93 |
+
|
|
|
840d93 |
+*$ ll
|
|
|
840d93 |
+C comment line
|
|
|
840d93 |
+ uu
|
|
|
840d93 |
+ DD
|
|
|
840d93 |
+ ee'include_1.inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+ end subroutine bar
|
|
|
840d93 |
+ subroutine baz
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ 0include
|
|
|
840d93 |
+ + 'include_1.inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+ end subroutine baz
|
|
|
840d93 |
+ subroutine qux
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+!$ i n C lude 'inc
|
|
|
840d93 |
+* another comment line
|
|
|
840d93 |
+ &lude_1.inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+ end subroutine qux
|
|
|
840d93 |
+ subroutine quux
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+C$ 0inc
|
|
|
840d93 |
+*$ 1lud
|
|
|
840d93 |
+c$ 2e '
|
|
|
840d93 |
+!$ 3include_1.inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+ end subroutine quux
|
|
|
840d93 |
+ program include_12
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ include
|
|
|
840d93 |
+! comment
|
|
|
840d93 |
+c$ +'include_1.inc'
|
|
|
840d93 |
+ end program
|
|
|
840d93 |
diff --git a/gcc/testsuite/gfortran.dg/gomp/include_1.inc b/gcc/testsuite/gfortran.dg/gomp/include_1.inc
|
|
|
840d93 |
new file mode 100644
|
|
|
840d93 |
index 00000000000..5dd841c5573
|
|
|
840d93 |
--- /dev/null
|
|
|
840d93 |
+++ b/gcc/testsuite/gfortran.dg/gomp/include_1.inc
|
|
|
840d93 |
@@ -0,0 +1 @@
|
|
|
840d93 |
+ integer i
|
|
|
840d93 |
diff --git a/gcc/testsuite/gfortran.dg/gomp/include_2.f90 b/gcc/testsuite/gfortran.dg/gomp/include_2.f90
|
|
|
840d93 |
new file mode 100644
|
|
|
840d93 |
index 00000000000..9c4ff15afb8
|
|
|
840d93 |
--- /dev/null
|
|
|
840d93 |
+++ b/gcc/testsuite/gfortran.dg/gomp/include_2.f90
|
|
|
840d93 |
@@ -0,0 +1,32 @@
|
|
|
840d93 |
+! { dg-do compile }
|
|
|
840d93 |
+! { dg-options "-fopenmp -fdec-include" }
|
|
|
840d93 |
+subroutine foo
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+!$ incl& ! comment1
|
|
|
840d93 |
+!$ &u&
|
|
|
840d93 |
+!$ &de & ! comment2
|
|
|
840d93 |
+!$ 'include&
|
|
|
840d93 |
+ &_1.inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+end subroutine foo
|
|
|
840d93 |
+subroutine bar
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+!$ include &
|
|
|
840d93 |
+
|
|
|
840d93 |
+! comment3
|
|
|
840d93 |
+
|
|
|
840d93 |
+!$ "include_1.inc"
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+end subroutine bar
|
|
|
840d93 |
+subroutine baz
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+!$ include&
|
|
|
840d93 |
+!$ &'include_1.&
|
|
|
840d93 |
+!$ &inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+end subroutine baz
|
|
|
840d93 |
+subroutine qux
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+!$ include '&
|
|
|
840d93 |
+include_1.inc'
|
|
|
840d93 |
+end subroutine qux
|
|
|
840d93 |
diff --git a/gcc/testsuite/gfortran.dg/include_10.f b/gcc/testsuite/gfortran.dg/include_10.f
|
|
|
840d93 |
new file mode 100644
|
|
|
840d93 |
index 00000000000..7df2a196954
|
|
|
840d93 |
--- /dev/null
|
|
|
840d93 |
+++ b/gcc/testsuite/gfortran.dg/include_10.f
|
|
|
840d93 |
@@ -0,0 +1,11 @@
|
|
|
840d93 |
+c { dg-do compile }
|
|
|
840d93 |
+ subroutine foo
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ include 'include_10.inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+ end subroutine foo
|
|
|
840d93 |
+ subroutine bar
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ i n cl UD e'include_10.inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+ end subroutine bar
|
|
|
840d93 |
diff --git a/gcc/testsuite/gfortran.dg/include_10.inc b/gcc/testsuite/gfortran.dg/include_10.inc
|
|
|
840d93 |
new file mode 100644
|
|
|
840d93 |
index 00000000000..5dd841c5573
|
|
|
840d93 |
--- /dev/null
|
|
|
840d93 |
+++ b/gcc/testsuite/gfortran.dg/include_10.inc
|
|
|
840d93 |
@@ -0,0 +1 @@
|
|
|
840d93 |
+ integer i
|
|
|
840d93 |
diff --git a/gcc/testsuite/gfortran.dg/include_11.f b/gcc/testsuite/gfortran.dg/include_11.f
|
|
|
840d93 |
new file mode 100644
|
|
|
840d93 |
index 00000000000..0e68a78c236
|
|
|
840d93 |
--- /dev/null
|
|
|
840d93 |
+++ b/gcc/testsuite/gfortran.dg/include_11.f
|
|
|
840d93 |
@@ -0,0 +1,20 @@
|
|
|
840d93 |
+c { dg-do compile }
|
|
|
840d93 |
+ subroutine foo
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+c We used to accept following in fixed mode. Shall we at least
|
|
|
840d93 |
+c warn about it?
|
|
|
840d93 |
+include 'include_10.inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+ end subroutine foo
|
|
|
840d93 |
+ subroutine bar
|
|
|
840d93 |
+c Likewise here.
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ include'include_10.inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+ end subroutine bar
|
|
|
840d93 |
+ subroutine baz
|
|
|
840d93 |
+c And here.
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ include 'include_10.inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+ end subroutine baz
|
|
|
840d93 |
diff --git a/gcc/testsuite/gfortran.dg/include_12.f b/gcc/testsuite/gfortran.dg/include_12.f
|
|
|
840d93 |
new file mode 100644
|
|
|
840d93 |
index 00000000000..4b3e3bed075
|
|
|
840d93 |
--- /dev/null
|
|
|
840d93 |
+++ b/gcc/testsuite/gfortran.dg/include_12.f
|
|
|
840d93 |
@@ -0,0 +1,65 @@
|
|
|
840d93 |
+c { dg-do compile }
|
|
|
840d93 |
+c { dg-options "-fdec-include" }
|
|
|
840d93 |
+ subroutine foo
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ 0include 'include_10.inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+ end subroutine foo
|
|
|
840d93 |
+ subroutine bar
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ i
|
|
|
840d93 |
+ ;n
|
|
|
840d93 |
+ +c
|
|
|
840d93 |
+
|
|
|
840d93 |
+c some comment
|
|
|
840d93 |
+
|
|
|
840d93 |
+ ll
|
|
|
840d93 |
+C comment line
|
|
|
840d93 |
+ uu
|
|
|
840d93 |
+ DD
|
|
|
840d93 |
+ ee'include_10.inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+ end subroutine bar
|
|
|
840d93 |
+ subroutine baz
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ 0include
|
|
|
840d93 |
+ + 'include_10.inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+ end subroutine baz
|
|
|
840d93 |
+ subroutine qux
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ i n C lude 'inc
|
|
|
840d93 |
+* another comment line
|
|
|
840d93 |
+ &lude_10.inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+ end subroutine qux
|
|
|
840d93 |
+ subroutine quux
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ 0inc
|
|
|
840d93 |
+ 1lud
|
|
|
840d93 |
+ 2e '
|
|
|
840d93 |
+ 3include_10.inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+ end subroutine quux
|
|
|
840d93 |
+ program include_12
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ include
|
|
|
840d93 |
+! comment
|
|
|
840d93 |
+ +'include_10.inc'
|
|
|
840d93 |
+ end program
|
|
|
840d93 |
+ subroutine quuz
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ integer include
|
|
|
840d93 |
+ include
|
|
|
840d93 |
+ +"include_10.inc"
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+ include
|
|
|
840d93 |
+ + = 2
|
|
|
840d93 |
+ write (*,*) include
|
|
|
840d93 |
+ end subroutine quuz
|
|
|
840d93 |
+ subroutine corge
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ include
|
|
|
840d93 |
+ +'include_10.inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+ end subroutine corge
|
|
|
840d93 |
diff --git a/gcc/testsuite/gfortran.dg/include_13.f90 b/gcc/testsuite/gfortran.dg/include_13.f90
|
|
|
840d93 |
new file mode 100644
|
|
|
840d93 |
index 00000000000..418ee5585e2
|
|
|
840d93 |
--- /dev/null
|
|
|
840d93 |
+++ b/gcc/testsuite/gfortran.dg/include_13.f90
|
|
|
840d93 |
@@ -0,0 +1,44 @@
|
|
|
840d93 |
+! { dg-do compile }
|
|
|
840d93 |
+! { dg-options "-fdec" }
|
|
|
840d93 |
+subroutine foo
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ incl& ! comment1
|
|
|
840d93 |
+&u&
|
|
|
840d93 |
+ &de & ! comment2
|
|
|
840d93 |
+'include&
|
|
|
840d93 |
+ &_10.inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+end subroutine foo
|
|
|
840d93 |
+subroutine bar
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+include &
|
|
|
840d93 |
+
|
|
|
840d93 |
+! comment3
|
|
|
840d93 |
+
|
|
|
840d93 |
+"include_10.inc"
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+end subroutine bar
|
|
|
840d93 |
+subroutine baz
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ include&
|
|
|
840d93 |
+&'include_10.&
|
|
|
840d93 |
+&inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+end subroutine baz
|
|
|
840d93 |
+subroutine qux
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ include '&
|
|
|
840d93 |
+include_10.inc'
|
|
|
840d93 |
+end subroutine qux
|
|
|
840d93 |
+subroutine quux
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ include &
|
|
|
840d93 |
+ &'include_10.inc'
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+end subroutine quux
|
|
|
840d93 |
+subroutine quuz
|
|
|
840d93 |
+ implicit none
|
|
|
840d93 |
+ include &
|
|
|
840d93 |
+ &"include_10.inc"
|
|
|
840d93 |
+ i = 1
|
|
|
840d93 |
+end subroutine quuz
|