aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2022-09-08 21:03:21 +0200
committerTobias Burnus <tobias@codesourcery.com>2022-09-08 21:03:21 +0200
commit264deecb16abcfc8ca8efe9b94b0ad55febd55cc (patch)
tree991f5d125971b4361fd84221dd642f187358361c /gcc/fortran
parent4f05ff34d63b582557918189528531f35041ef0e (diff)
downloadgcc-264deecb16abcfc8ca8efe9b94b0ad55febd55cc.zip
gcc-264deecb16abcfc8ca8efe9b94b0ad55febd55cc.tar.gz
gcc-264deecb16abcfc8ca8efe9b94b0ad55febd55cc.tar.bz2
OpenMP: Document ompx warnings + add Fortran omx warning [PR106670]
omp/ompx sentinels are for vendor extensions; as they might be required for the correctness of the program, a warning should be printable. This patch documents in the OpenMP 5.2 table the existing warnings, including the new warning for for fixed source form Fortran. PR fortran/106670 gcc/fortran/ChangeLog: * scanner.cc (skip_fixed_omp_sentinel): Add -Wsurprising warning for 'omx' sentinels with -fopenmp. * invoke.texi (-Wsurprising): Document additional warning case. libgomp/ChangeLog: * libgomp.texi (OpenMP 5.2): Add comment to ompx/omx entry. gcc/testsuite/ChangeLog: * c-c++-common/gomp/ompx-1.c: New test. * c-c++-common/gomp/ompx-2.c: New test. * g++.dg/gomp/ompx-attrs-1.C: New test. * gfortran.dg/gomp/ompx-1.f90: New test. * gfortran.dg/gomp/omx-1.f: New test. * gfortran.dg/gomp/omx-2.f: New test.
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/invoke.texi5
-rw-r--r--gcc/fortran/scanner.cc8
2 files changed, 11 insertions, 2 deletions
diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi
index 4d1e0d6..58502d3 100644
--- a/gcc/fortran/invoke.texi
+++ b/gcc/fortran/invoke.texi
@@ -1092,6 +1092,11 @@ The type of a function result is declared more than once with the same type. If
@item
A @code{CHARACTER} variable is declared with negative length.
+
+@item
+With @option{-fopenmp}, for fixed-form source code, when an @code{omx}
+vendor-extension sentinel is encountered. (The equivalent @code{ompx},
+used in free-form source code, is diagnosed by default.)
@end itemize
@item -Wtabs
diff --git a/gcc/fortran/scanner.cc b/gcc/fortran/scanner.cc
index 2dff251..fa1d9cb 100644
--- a/gcc/fortran/scanner.cc
+++ b/gcc/fortran/scanner.cc
@@ -982,8 +982,9 @@ static bool
skip_fixed_omp_sentinel (locus *start)
{
gfc_char_t c;
- if (((c = next_char ()) == 'm' || c == 'M')
- && ((c = next_char ()) == 'p' || c == 'P'))
+ if ((c = next_char ()) != 'm' && c != 'M')
+ return false;
+ if ((c = next_char ()) == 'p' || c == 'P')
{
c = next_char ();
if (c != '\n'
@@ -1005,6 +1006,9 @@ skip_fixed_omp_sentinel (locus *start)
}
}
}
+ else if (UNLIKELY (c == 'x' || c == 'X'))
+ gfc_warning_now (OPT_Wsurprising,
+ "Ignoring '!$omx' vendor-extension sentinel at %C");
return false;
}