Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-22 10:14:05

0001 /* GLIB - Library of useful routines for C programming
0002  * Copyright (C) 2021  Iain Lane, Xavier Claessens
0003  *
0004  * SPDX-License-Identifier: LGPL-2.1-or-later
0005  *
0006  * This library is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Lesser General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2.1 of the License, or (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0014  * Lesser General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Lesser General Public
0017  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
0018  */
0019 
0020 #ifndef __GLIB_TYPEOF_H__
0021 #define __GLIB_TYPEOF_H__
0022 
0023 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
0024 #error "Only <glib.h> can be included directly."
0025 #endif
0026 
0027 #include <glib/gversionmacros.h>
0028 
0029 /*
0030  * We can only use __typeof__ on GCC >= 4.8, and not when compiling C++. Since
0031  * __typeof__ is used in a few places in GLib, provide a pre-processor symbol
0032  * to factor the check out from callers.
0033  *
0034  * This symbol is private.
0035  */
0036 #undef glib_typeof
0037 #if !G_CXX_STD_CHECK_VERSION (11) && \
0038     (G_GNUC_CHECK_VERSION(4, 8) || defined(__clang__))
0039 #define glib_typeof(t) __typeof__ (t)
0040 #elif G_CXX_STD_CHECK_VERSION (11) && \
0041       GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68
0042 /* C++11 decltype() is close enough for our usage */
0043 #include <type_traits>
0044 #define glib_typeof(t) typename std::remove_reference<decltype (t)>::type
0045 #endif
0046 
0047 #endif /* __GLIB_TYPEOF_H__ */