Rizin
unix-like reverse engineering framework and cli tools
symcat.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 1998, 2000 Free Software Foundation, Inc.
2 // SPDX-License-Identifier: GPL-2.0-or-later
3 
4 /* Symbol concatenation utilities.
5 
6  Copyright (C) 1998, 2000 Free Software Foundation, Inc.
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License along
19  with this program; if not, write to the Free Software Foundation, Inc.,
20  51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
21 
22 #ifndef SYM_CAT_H
23 #define SYM_CAT_H
24 
25 #if defined(__STDC__) || defined(ALMOST_STDC) || defined(HAVE_STRINGIZE)
26 #define CONCAT2(a, b) a##b
27 #define CONCAT3(a, b, c) a##b##c
28 #define CONCAT4(a, b, c, d) a##b##c##d
29 #define STRINGX(s) #s
30 #else
31 /* Note one should never pass extra whitespace to the CONCATn macros,
32  e.g. CONCAT2(foo, bar) because traditonal C will keep the space between
33  the two labels instead of concatenating them. Instead, make sure to
34  write CONCAT2(foo,bar). */
35 #define CONCAT2(a, b) a b
36 #define CONCAT3(a, b, c) a b c
37 #define CONCAT4(a, b, c, d) a b c d
38 #define STRINGX(s) "s"
39 #endif
40 
41 #define XCONCAT2(a, b) CONCAT2(a, b)
42 #define XCONCAT3(a, b, c) CONCAT3(a, b, c)
43 #define XCONCAT4(a, b, c, d) CONCAT4(a, b, c, d)
44 
45 /* Note the layer of indirection here is typically used to allow
46  stringification of the expansion of macros. I.e. "#define foo
47  bar", "XSTRING(foo)", to yield "bar". Be aware that this only
48  works for __STDC__, not for traditional C which will still resolve
49  to "foo". */
50 #define XSTRING(s) STRINGX(s)
51 
52 #endif /* SYM_CAT_H */