Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions flang/lib/Parser/parsing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const SourceFile *Parsing::Prescan(const std::string &path, Options options) {
if (options.features.IsEnabled(LanguageFeature::OpenACC) ||
(options.prescanAndReformat && noneOfTheAbove)) {
prescanner.AddCompilerDirectiveSentinel("$acc");
prescanner.AddCompilerDirectiveSentinel("@acc");
}
if (options.features.IsEnabled(LanguageFeature::OpenMP) ||
(options.prescanAndReformat && noneOfTheAbove)) {
Expand Down
5 changes: 5 additions & 0 deletions flang/lib/Parser/prescan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ void Prescanner::Statement() {
directiveSentinel_[4] == '\0') {
// CUDA conditional compilation line.
condOffset = 5;
} else if (directiveSentinel_[0] == '@' && directiveSentinel_[1] == 'a' &&
directiveSentinel_[2] == 'c' && directiveSentinel_[3] == 'c' &&
directiveSentinel_[4] == '\0') {
// OpenACC conditional compilation line.
condOffset = 5;
}
if (condOffset && !preprocessingOnly_) {
at_ += *condOffset, column_ += *condOffset;
Expand Down
14 changes: 14 additions & 0 deletions flang/test/Semantics/OpenACC/acc-sentinel.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenacc

subroutine test_sentinel()
! Test for error since we currently do not have an OpenACC module upstream.
!ERROR: Cannot parse module file for module 'openacc': Source file 'openacc.mod' was not found
!@acc use openacc
integer :: i

!$acc parallel loop
do i = 1, 10
end do
!$acc end parallel

end subroutine