Skip to content

Commit

Permalink
Implement a CLANG_PREREQUISITE macro
Browse files Browse the repository at this point in the history
  • Loading branch information
fwyzard committed Jun 7, 2024
1 parent 695ed78 commit 4f141ff
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions FWCore/Utilities/interface/ClangPrerequisite.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef FWCore_Utilities_interface_ClangPrerequisite_h
#define FWCore_Utilities_interface_ClangPrerequisite_h

/* Convenience macro to test the version of clang.
Use it like this:
#if CLANG_PREREQUISITE(9,0,1)
... code requiring clang 9.0.1 or later ...
#endif
*/

#if defined __clang__ && defined __clang_major__ && defined __clang_minor__ && defined __clang_patchlevel__
#define CLANG_PREREQUISITE(maj, min, patch) \
((__clang_major__ << 16) + (__clang_minor__ << 8) + __clang_patchlevel__ >= ((maj) << 16) + ((min) << 8) + (patch))
#else
#define CLANG_PREREQUISITE(maj, min, patch) 0
#endif

#endif // FWCore_Utilities_interface_ClangPrerequisite_h

0 comments on commit 4f141ff

Please sign in to comment.