xref: /llvm-project/flang/include/flang/Common/OpenMP-features.h (revision 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
1 //===-- include/flang/Common/OpenMP-features.h -----------------*- C++ -*-====//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef FORTRAN_COMMON_OPENMP_FEATURES_H_
10 #define FORTRAN_COMMON_OPENMP_FEATURES_H_
11 
12 namespace Fortran::common {
13 
14 /// Set _OPENMP macro according to given version number
15 template <typename FortranPredefinitions>
setOpenMPMacro(int version,FortranPredefinitions & predefinitions)16 void setOpenMPMacro(int version, FortranPredefinitions &predefinitions) {
17   switch (version) {
18   case 20:
19     predefinitions.emplace_back("_OPENMP", "200011");
20     break;
21   case 25:
22     predefinitions.emplace_back("_OPENMP", "200505");
23     break;
24   case 30:
25     predefinitions.emplace_back("_OPENMP", "200805");
26     break;
27   case 31:
28     predefinitions.emplace_back("_OPENMP", "201107");
29     break;
30   case 40:
31     predefinitions.emplace_back("_OPENMP", "201307");
32     break;
33   case 45:
34     predefinitions.emplace_back("_OPENMP", "201511");
35     break;
36   case 50:
37     predefinitions.emplace_back("_OPENMP", "201811");
38     break;
39   case 51:
40     predefinitions.emplace_back("_OPENMP", "202011");
41     break;
42   case 52:
43     predefinitions.emplace_back("_OPENMP", "202111");
44     break;
45   case 11:
46   default:
47     predefinitions.emplace_back("_OPENMP", "199911");
48     break;
49   }
50 }
51 } // namespace Fortran::common
52 #endif // FORTRAN_COMMON_OPENMP_FEATURES_H_
53