Skip to content

Commit 0dd8e14

Browse files
Allow any expression as message
1 parent 744b131 commit 0dd8e14

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

flang/include/flang/Parser/parse-tree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4019,7 +4019,7 @@ struct OmpMapClause {
40194019
// message-clause ->
40204020
// MESSAGE("message-text")
40214021
struct OmpMessageClause {
4022-
WRAPPER_CLASS_BOILERPLATE(OmpMessageClause, std::string);
4022+
WRAPPER_CLASS_BOILERPLATE(OmpMessageClause, Expr);
40234023
};
40244024

40254025
// Ref: [4.5:87-91], [5.0:140-146], [5.1:166-171], [5.2:270]

flang/lib/Parser/openmp-parsers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ TYPE_PARSER(construct<OmpSeverityClause>(
515515
"FATAL" >> pure(OmpSeverityClause::Severity::Fatal) ||
516516
"WARNING" >> pure(OmpSeverityClause::Severity::Warning)))
517517

518-
TYPE_PARSER(construct<OmpMessageClause>(charLiteralConstantWithoutKind))
518+
TYPE_PARSER(construct<OmpMessageClause>(expr))
519519

520520
TYPE_PARSER(
521521
"ACQUIRE" >> construct<OmpClause>(construct<OmpClause::Acquire>()) ||

flang/lib/Parser/unparse.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2652,9 +2652,7 @@ class UnparseVisitor {
26522652
EndOpenMP();
26532653
}
26542654
bool Pre(const OmpMessageClause &x) {
2655-
Word("\"");
26562655
Walk(x.v);
2657-
Put("\"");
26582656
return false;
26592657
}
26602658
void Unparse(const OpenMPErrorConstruct &x) {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
! RUN: %flang_fc1 -fopenmp-version=51 -fopenmp -fdebug-unparse-no-sema %s 2>&1 | FileCheck %s
22
program main
3+
character(*), parameter :: message = "This is an error"
34
!CHECK: !$OMP ERROR AT(COMPILATION) SEVERITY(WARNING) MESSAGE("some message here")
45
!$omp error at(compilation) severity(warning) message("some message here")
6+
!CHECK: !$OMP ERROR AT(COMPILATION) SEVERITY(FATAL) MESSAGE(message)
7+
!$omp error at(compilation) severity(fatal) message(message)
8+
!CHECK: !$OMP ERROR AT(EXECUTION) SEVERITY(FATAL) MESSAGE(message)
9+
!$omp error at(EXECUTION) severity(fatal) message(message)
510
end program main

0 commit comments

Comments
 (0)