chiark / gitweb /
@@@ fltfmt wip
[mLib] / utils / compiler.3.in
CommitLineData
c4ccbbf9
MW
1.\" -*-nroff-*-
2.\"
3.\" Manual for compiler version checking
4.\"
5.\" (c) 2018, 2024 Straylight/Edgeware
6.\"
7.
8.\"----- Licensing notice ---------------------------------------------------
9.\"
10.\" This file is part of the mLib utilities library.
11.\"
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.
16.\"
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.
21.\"
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,
25.\" USA.
26.
27.\"--------------------------------------------------------------------------
28.so ../defs.man \" @@@PRE@@@
29.
30.\"--------------------------------------------------------------------------
31.TH compiler 3mLib "26 May 2018" "Straylight/Edgeware" "mLib utilities library"
32.\" @GCC_VERSION_P
33.\" @CLANG_VERSION_P
34.
35.\"--------------------------------------------------------------------------
36.SH NAME
37compiler \- detect compiler version
38.
39.\"--------------------------------------------------------------------------
40.SH SYNOPSIS
41.
42.nf
43.B "#include <mLib/compiler.h>"
44.PP
45.BI "int GCC_VERSION_P(" maj ", " min ");"
46.BI "int CLANG_VERSION_P(" maj ", " min ");"
47.fi
48.
49.\"--------------------------------------------------------------------------
50.SH DESCRIPTION
51The macro invocation
52.BI GCC_VERSION_P( maj ", " min )
53expands to a compile-time constant nonzero value if the present compiler
54is GCC version
55.IR maj . min
56or better, or claims compatibility with it.
57This is frequently imperfect, as many compilers claim compatibility
58without implementing all of the necessary features, but it works
59adequately if one takes care.
60.PP
61The macro invocation
62.BI CLANG_VERSION_P( maj ", " min )
63expands to a compile-time constant nonzero value if the present compiler
64is Clang version
65.IR maj . min
66or better (or claims compatibility with it, but this is less likely
67than for GCC.
68.
69.\"--------------------------------------------------------------------------
70.SH "SEE ALSO"
71.
72.BR mLib (3).
73.
74.\"--------------------------------------------------------------------------
75.SH "AUTHOR"
76.
77Mark Wooding, <mdw@distorted.org.uk>
78.
79.\"----- That's all, folks --------------------------------------------------