@@ -38,6 +38,16 @@ namespace Fortran::semantics {
38
38
CheckAllowedClause (llvm::omp::Y); \
39
39
}
40
40
41
+ std::string ThisVersion (unsigned version) {
42
+ std::string tv{
43
+ std::to_string (version / 10 ) + " ." + std::to_string (version % 10 )};
44
+ return " OpenMP v" + tv;
45
+ }
46
+
47
+ std::string TryVersion (unsigned version) {
48
+ return " try -fopenmp-version=" + std::to_string (version);
49
+ }
50
+
41
51
// 'OmpWorkshareBlockChecker' is used to check the validity of the assignment
42
52
// statements and the expressions enclosed in an OpenMP Workshare construct
43
53
class OmpWorkshareBlockChecker {
@@ -200,14 +210,10 @@ bool OmpStructureChecker::CheckAllowedClause(llvmOmpClause clause) {
200
210
auto clauseName{parser::ToUpperCaseLetters (getClauseName (clause).str ())};
201
211
auto dirName{parser::ToUpperCaseLetters (getDirectiveName (dir).str ())};
202
212
203
- std::string thisVersion{
204
- std::to_string (version / 10 ) + " ." + std::to_string (version % 10 )};
205
- std::string goodVersion{std::to_string (allowedInVersion)};
206
-
207
213
context_.Say (dirCtx.clauseSource ,
208
- " %s clause is not allowed on directive %s in OpenMP v %s, "
209
- " try -fopenmp- version=%d " _err_en_US ,
210
- clauseName, dirName, thisVersion, allowedInVersion);
214
+ " %s clause is not allowed on directive %s in %s, %s " _err_en_US,
215
+ clauseName, dirName, ThisVersion ( version) ,
216
+ TryVersion ( allowedInVersion) );
211
217
}
212
218
}
213
219
return CheckAllowed (clause);
@@ -3378,8 +3384,8 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Lastprivate &x) {
3378
3384
std::to_string (version / 10 ) + " ." + std::to_string (version % 10 )};
3379
3385
context_.Say (GetContext ().clauseSource ,
3380
3386
" LASTPRIVATE clause with CONDITIONAL modifier is not "
3381
- " allowed in OpenMP v %s, try -fopenmp-version=%d " _err_en_US,
3382
- thisVersion, allowedInVersion);
3387
+ " allowed in %s, %s " _err_en_US,
3388
+ ThisVersion (version), TryVersion ( allowedInVersion) );
3383
3389
}
3384
3390
}
3385
3391
}
0 commit comments