- Added More Documentation
This commit is contained in:
@@ -16,10 +16,89 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
// =====================================================================================================================
|
||||
|
||||
///
|
||||
/// \file intrinsics.h
|
||||
/// \brief This header contains definitions for compiler intrinsics necessary for implementing functions of the
|
||||
/// C++ stdlib.
|
||||
///
|
||||
/// \copyright Copyright © 2025 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
||||
///
|
||||
///
|
||||
|
||||
#ifndef FENNEC_LANG_INTRINSICS_H
|
||||
#define FENNEC_LANG_INTRINSICS_H
|
||||
|
||||
///
|
||||
/// \page fennec_lang_intrinsics Intrinsics
|
||||
///
|
||||
/// \brief This header contains definitions for compiler intrinsics necessary for implementing functions of the
|
||||
/// C++ stdlib.
|
||||
///
|
||||
///
|
||||
/// <table width="100%" class="fieldtable" id="table_fennec_lang_intrinsics">
|
||||
/// <tr><th style="vertical-align: top">Syntax
|
||||
/// <th style="vertical-align: top">Description
|
||||
///
|
||||
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||
/// `FENNEC_HAS_BUILTIN_BIT_CAST` <br>
|
||||
/// `Y FENNEC_BUILTIN_BIT_CAST(X)`
|
||||
/// <td width="50%" style="vertical-align: top">
|
||||
/// An intrinsic for doing a bitwise cast without using `reinterpret_cast`.
|
||||
///
|
||||
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||
/// `FENNEC_HAS_BUILTIN_ADDRESSOF` <br>
|
||||
/// `Y FENNEC_BUILTIN_ADDRESSOF(X)`
|
||||
/// <td width="50%" style="vertical-align: top">
|
||||
/// Obtains the true address of an object in circumstances where `operator&` is overloaded.
|
||||
///
|
||||
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||
/// `FENNEC_HAS_BUILTIN_IS_CONVERTIBLE` <br>
|
||||
/// `B FENNEC_BUILTIN_IS_CONVERTIBLE(X, Y)`
|
||||
/// <td width="50%" style="vertical-align: top">
|
||||
/// Checks if type `X` can be converted to type `Y`.
|
||||
///
|
||||
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||
/// `FENNEC_HAS_BUILTIN_IS_EMPTY` <br>
|
||||
/// `B FENNEC_BUILTIN_IS_EMPTY(X)`
|
||||
/// <td width="50%" style="vertical-align: top">
|
||||
/// Checks if type `X` stores no data.
|
||||
///
|
||||
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||
/// `FENNEC_HAS_BUILTIN_IS_POLYMORPHIC` <br>
|
||||
/// `B FENNEC_BUILTIN_IS_POLYMORPHIC(X)`
|
||||
/// <td width="50%" style="vertical-align: top">
|
||||
/// Checks if type `X` is polymorphic, this is for classes only thus checks only for subtyping
|
||||
///
|
||||
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||
/// `FENNEC_HAS_BUILTIN_IS_FINAL` <br>
|
||||
/// `B FENNEC_BUILTIN_IS_FINAL(X)`
|
||||
/// <td width="50%" style="vertical-align: top">
|
||||
/// Checks if type `X` is final, meaning a function or class cannot be derived from.
|
||||
///
|
||||
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||
/// `FENNEC_HAS_BUILTIN_IS_ABSTRACT` <br>
|
||||
/// `B FENNEC_BUILTIN_IS_ABSTRACT(X)`
|
||||
/// <td width="50%" style="vertical-align: top">
|
||||
/// Opposite of `FENNEC_BUILTIN_IS_FINAL`, checks if abstract, meaning `X` has at least one pure virtual function.
|
||||
///
|
||||
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||
/// `FENNEC_HAS_BUILTIN_IS_STANDARD_LAYOUT` <br>
|
||||
/// `B FENNEC_BUILTIN_IS_STANDARD_LAYOUT(X)`
|
||||
/// <td width="50%" style="vertical-align: top">
|
||||
/// Checks if `X` has a standard layout, here is [full criteria](https://www.cppreference.com/w/cpp/language/classes.html#Standard-layout_class)
|
||||
/// for this trait
|
||||
///
|
||||
/// <tr><td width="50%" style="vertical-align: top"> <br>
|
||||
/// `FENNEC_HAS_BUILTIN_IS_CONSTRUCTIBLE` <br>
|
||||
/// `B FENNEC_BUILTIN_IS_CONSTRUCTIBLE(X, ...)`
|
||||
/// <td width="50%" style="vertical-align: top">
|
||||
/// Checks if type `X` is constructible with args `...`, such that `X::X(...)` exists.
|
||||
///
|
||||
/// </table>
|
||||
///
|
||||
///
|
||||
|
||||
|
||||
// Most major compilers support __has_builtin, notably GCC, MINGW, CLANG, and MSVC
|
||||
#if defined(__has_builtin)
|
||||
|
||||
@@ -45,10 +124,10 @@
|
||||
|
||||
// can_convert is also very difficult to implement without intrinsics
|
||||
#if __has_builtin(__is_convertible)
|
||||
# define FENNEC_HAS_BUILTIN_CAN_CONVERT 1
|
||||
# define FENNEC_BUILTIN_CAN_CONVERT(arg0, arg1) __is_convertible(arg0, arg1)
|
||||
# define FENNEC_HAS_BUILTIN_IS_CONVERTIBLE 1
|
||||
# define FENNEC_BUILTIN_IS_CONVERTIBLE(arg0, arg1) __is_convertible(arg0, arg1)
|
||||
#else
|
||||
# define FENNEC_HAS_BUILTIN_CAN_CONVERT 0
|
||||
# define FENNEC_HAS_BUILTIN_IS_CONVERTIBLE 0
|
||||
#endif
|
||||
|
||||
// Inconsistent without intrinsics.
|
||||
|
||||
Reference in New Issue
Block a user