| 1 | // -*- C++ -*- Libstdc++ version details header. |
| 2 | |
| 3 | // Copyright (C) 2018-2026 Free Software Foundation, Inc. |
| 4 | // |
| 5 | // This file is part of the GNU ISO C++ Library. This library is free |
| 6 | // software; you can redistribute it and/or modify it under the |
| 7 | // terms of the GNU General Public License as published by the |
| 8 | // Free Software Foundation; either version 3, or (at your option) |
| 9 | // any later version. |
| 10 | |
| 11 | // This library is distributed in the hope that it will be useful, |
| 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | // GNU General Public License for more details. |
| 15 | |
| 16 | // Under Section 7 of GPL version 3, you are granted additional |
| 17 | // permissions described in the GCC Runtime Library Exception, version |
| 18 | // 3.1, as published by the Free Software Foundation. |
| 19 | |
| 20 | // You should have received a copy of the GNU General Public License and |
| 21 | // a copy of the GCC Runtime Library Exception along with this program; |
| 22 | // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see |
| 23 | // <http://www.gnu.org/licenses/>. |
| 24 | |
| 25 | /** @file version |
| 26 | * This is a Standard C++ Library header. You should `#include` this header |
| 27 | * in your programs, rather than any of the `*.h` implementation files. |
| 28 | * |
| 29 | * The `<version>` header defines feature test macros that describe the |
| 30 | * supported features of the C++ standard library implementation being used. |
| 31 | * The macros that are defined, and their values, depend on compiler flags |
| 32 | * (usually `-std`, but others such as `-fcoroutines` and `-fno-aligned-new` |
| 33 | * can affect them). |
| 34 | * |
| 35 | * These macros can be used to conditionally enable or disable code: |
| 36 | * |
| 37 | * ``` |
| 38 | * #include <version> |
| 39 | * #ifdef __cpp_lib_expected |
| 40 | * // std::expected is supported |
| 41 | * #endif |
| 42 | * ``` |
| 43 | * |
| 44 | * The macro values indicate different levels of support, for example |
| 45 | * `__cpp_lib_expected == 202202L` means only the original feature set of |
| 46 | * `std::expected` is supported, while `__cpp_lib_expected == 202211L` means |
| 47 | * that the monadic functions such as `std::expected::and_then` are also |
| 48 | * supported. |
| 49 | * |
| 50 | * The list of macros defined in `<version>` and their meanings is given in |
| 51 | * the C++ standard committee's SD-6 document: |
| 52 | * https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations |
| 53 | * |
| 54 | * `<version>` may also define non-standard, implementation-specific macros, |
| 55 | * such as libstdc++'s `_GLIBCXX_RELEASE`. However, the standard feature |
| 56 | * test macros should be preferred over depending on specific versions of any |
| 57 | * particular implementation. |
| 58 | * |
| 59 | * The `<version>` header was introduced in C++20, but libstdc++ provides it |
| 60 | * unconditionally. As documented in SD-6, some macros correspond to features |
| 61 | * in C++17 and earlier standards. |
| 62 | */ |
| 63 | |
| 64 | #ifndef _GLIBCXX_VERSION_INCLUDED |
| 65 | #define _GLIBCXX_VERSION_INCLUDED |
| 66 | |
| 67 | #ifdef _GLIBCXX_SYSHDR |
| 68 | #pragma GCC system_header |
| 69 | #endif |
| 70 | |
| 71 | #define __glibcxx_want_all |
| 72 | #include <bits/version.h> |
| 73 | |
| 74 | #endif // _GLIBCXX_VERSION_INCLUDED |
| 75 | |