diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2020-11-30 15:30:51 +0100 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2020-11-30 15:31:22 +0100 |
commit | 1d6f6ac693a8601bef9fe4ba72eb6fbf7b60b5cd (patch) | |
tree | bec2e4d4f4cfceba9cf8a2293efb0bd04496eae0 /gcc/fortran | |
parent | f4e7ea81d1369d4d6cb6d8e440aefb3407142e05 (diff) | |
download | gcc-1d6f6ac693a8601bef9fe4ba72eb6fbf7b60b5cd.zip gcc-1d6f6ac693a8601bef9fe4ba72eb6fbf7b60b5cd.tar.gz gcc-1d6f6ac693a8601bef9fe4ba72eb6fbf7b60b5cd.tar.bz2 |
Fortran: With OpenACC, ignore OpenMP's cond comp sentinels
gcc/fortran/ChangeLog:
PR fortran/98011
* scanner.c (skip_free_comments, skip_fixed_comments): If only
-fopenacc but not -fopenmp is used, ignore OpenMP's conditional
compilation sentinels. Fix indentation, use 'else if' for readability.
gcc/testsuite/ChangeLog:
PR fortran/98011
* gfortran.dg/goacc/sentinel-free-form.f95:
* gfortran.dg/goacc-gomp/fixed-1.f: New test.
* gfortran.dg/goacc-gomp/free-1.f90: New test.
* gfortran.dg/goacc/fixed-5.f: New test.
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/scanner.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index fd11f5a..304ae2d 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -899,21 +899,14 @@ skip_free_comments (void) if (next_char () == '$') { c = next_char (); - if (c == 'a' || c == 'A') - { - if (skip_free_oacc_sentinel (start, old_loc)) - return false; - gfc_current_locus = old_loc; - next_char(); - c = next_char(); - } - if (continue_flag || c == ' ' || c == '\t') - { - gfc_current_locus = old_loc; - next_char(); - openacc_flag = 0; - return true; - } + if (c == 'a' || c == 'A') + { + if (skip_free_oacc_sentinel (start, old_loc)) + return false; + gfc_current_locus = old_loc; + next_char(); + c = next_char(); + } } gfc_current_locus = old_loc; } @@ -1076,8 +1069,7 @@ skip_fixed_comments (void) } gfc_current_locus = start; } - - if (flag_openacc && !(flag_openmp || flag_openmp_simd)) + else if (flag_openacc && !(flag_openmp || flag_openmp_simd)) { if (next_char () == '$') { @@ -1087,13 +1079,10 @@ skip_fixed_comments (void) if (skip_fixed_oacc_sentinel (&start)) return; } - else - goto check_for_digits; } gfc_current_locus = start; } - - if (flag_openacc || flag_openmp || flag_openmp_simd) + else if (flag_openacc || flag_openmp || flag_openmp_simd) { if (next_char () == '$') { @@ -1120,6 +1109,7 @@ skip_fixed_comments (void) gcc_unreachable (); check_for_digits: { + /* Required for OpenMP's conditional compilation sentinel. */ int digit_seen = 0; for (col = 3; col < 6; col++, c = next_char ()) |