| 1 | .\" -*-nroff-*- |
| 2 | .TH compiler 3 "26 May 2018" "Straylight/Edgeware" "mLib utilities library" |
| 3 | .SH NAME |
| 4 | compiler \- detect compiler version |
| 5 | .\" @GCC_VERSION_P |
| 6 | .\" @CLANG_VERSION_P |
| 7 | .SH SYNOPSIS |
| 8 | .nf |
| 9 | .B "#include <mLib/compiler.h>" |
| 10 | |
| 11 | .BI "int GCC_VERSION_P(" maj ", " min ");" |
| 12 | .BI "int CLANG_VERSION_P(" maj ", " min ");" |
| 13 | .fi |
| 14 | .SH DESCRIPTION |
| 15 | The macro invocation |
| 16 | .BI GCC_VERSION_P( maj ", " min ) |
| 17 | expands to a compile-time constant nonzero value if the present compiler |
| 18 | is GCC version |
| 19 | .IR maj . min |
| 20 | or better, or claims compatibility with it. |
| 21 | This is frequently imperfect, as many compilers claim compatibility |
| 22 | without implementing all of the necessary features, but it works |
| 23 | adequately if one takes care. |
| 24 | .PP |
| 25 | The macro invocation |
| 26 | .BI CLANG_VERSION_P( maj ", " min ) |
| 27 | expands to a compile-time constant nonzero value if the present compiler |
| 28 | is Clang version |
| 29 | .IR maj . min |
| 30 | or better (or claims compatibility with it, but this is less likely |
| 31 | than for GCC. |
| 32 | .SH "SEE ALSO" |
| 33 | .BR mLib (3). |
| 34 | .SH "AUTHOR" |
| 35 | Mark Wooding, <mdw@distorted.org.uk> |