3 .\" Manual for compiler version checking
5 .\" (c) 2018, 2024 Straylight/Edgeware
8 .\"----- Licensing notice ---------------------------------------------------
10 .\" This file is part of the mLib utilities library.
12 .\" mLib is free software: you can redistribute it and/or modify it under
13 .\" the terms of the GNU Library General Public License as published by
14 .\" the Free Software Foundation; either version 2 of the License, or (at
15 .\" your option) any later version.
17 .\" mLib is distributed in the hope that it will be useful, but WITHOUT
18 .\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 .\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
20 .\" License for more details.
22 .\" You should have received a copy of the GNU Library General Public
23 .\" License along with mLib. If not, write to the Free Software
24 .\" Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
27 .\"--------------------------------------------------------------------------
28 .so ../defs.man \" @@@PRE@@@
30 .\"--------------------------------------------------------------------------
31 .TH compiler 3mLib "26 May 2018" "Straylight/Edgeware" "mLib utilities library"
35 .\"--------------------------------------------------------------------------
37 compiler \- detect compiler version
39 .\"--------------------------------------------------------------------------
43 .B "#include <mLib/compiler.h>"
45 .BI "int GCC_VERSION_P(" maj ", " min ");"
46 .BI "int CLANG_VERSION_P(" maj ", " min ");"
49 .\"--------------------------------------------------------------------------
52 .BI GCC_VERSION_P( maj ", " min )
53 expands to a compile-time constant nonzero value if the present compiler
56 or better, or claims compatibility with it.
57 This is frequently imperfect, as many compilers claim compatibility
58 without implementing all of the necessary features, but it works
59 adequately if one takes care.
62 .BI CLANG_VERSION_P( maj ", " min )
63 expands to a compile-time constant nonzero value if the present compiler
66 or better (or claims compatibility with it, but this is less likely
69 .\"--------------------------------------------------------------------------
74 .\"--------------------------------------------------------------------------
77 Mark Wooding, <mdw@distorted.org.uk>
79 .\"----- That's all, folks --------------------------------------------------