diff --git a/CMakeLists.txt b/CMakeLists.txt index 9631325e8..12f8edbd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -483,9 +483,6 @@ if (MRDOCS_BUILD_TESTS) "${PROJECT_SOURCE_DIR}/test-files/golden-tests" "--addons=${CMAKE_SOURCE_DIR}/share/mrdocs/addons" --generator=${testgenerator} - "--stdlib-includes=${LIBCXX_DIR}" - "--stdlib-includes=${STDLIB_INCLUDE_DIR}" - "--libc-includes=${CMAKE_SOURCE_DIR}/share/mrdocs/headers/libc-stubs" --log-level=warn ) foreach (action IN ITEMS test create update) @@ -498,9 +495,6 @@ if (MRDOCS_BUILD_TESTS) "${PROJECT_SOURCE_DIR}/test-files/golden-tests" "--addons=${CMAKE_SOURCE_DIR}/share/mrdocs/addons" --generator=${testgenerator} - "--stdlib-includes=${LIBCXX_DIR}" - "--stdlib-includes=${STDLIB_INCLUDE_DIR}" - "--libc-includes=${CMAKE_SOURCE_DIR}/share/mrdocs/headers/libc-stubs" --log-level=warn DEPENDS mrdocs-test ) @@ -656,16 +650,6 @@ if (MRDOCS_INSTALL) #------------------------------------------------- # share #------------------------------------------------- - install(DIRECTORY ${LIBCXX_DIR}/ - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/mrdocs/headers/libcxx - FILES_MATCHING PATTERN "*") - install(DIRECTORY ${STDLIB_INCLUDE_DIR}/ - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/mrdocs/headers/clang - FILES_MATCHING PATTERN "*") - install(DIRECTORY ${CMAKE_SOURCE_DIR}/share/mrdocs/headers/libc-stubs/ - DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/mrdocs/headers/libc-stubs - FILES_MATCHING PATTERN "*") - foreach (share_mrdocs_dir addons) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/share/mrdocs/${share_mrdocs_dir} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/mrdocs diff --git a/bootstrap.py b/bootstrap.py index 9a2f79d5d..6827cc0e8 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -2225,9 +2225,6 @@ def generate_run_configs(self): f'--action={verb}', f'--generator={generator}', f'--addons={os.path.join(self.options.mrdocs_src_dir, "share", "mrdocs", "addons")}', - f'--stdlib-includes={os.path.join(self.options.llvm_install_dir, "include", "c++", "v1")}', - f'--stdlib-includes={self.find_latest_clang_include_dir()}', - f'--libc-includes={os.path.join(self.options.mrdocs_src_dir, "share", "mrdocs", "headers", "libc-stubs")}', '--log-level=warn' ] }) diff --git a/docs/modules/ROOT/pages/usage.adoc b/docs/modules/ROOT/pages/usage.adoc index 473aa4297..161e89d12 100644 --- a/docs/modules/ROOT/pages/usage.adoc +++ b/docs/modules/ROOT/pages/usage.adoc @@ -269,34 +269,6 @@ cmake: '-D BOOST_ROOT=/path/to/boost' Another option supported by CMake is to set the `BOOST_ROOT` environment variable as `/path/to/boost` before running MrDocs. -=== System dependencies - -It's also common for libraries to depend on the C++ standard library, the C standard library, or other system libraries. These dependencies are usually resolved by the compiler and are not explicitly specified in the source code: - -* The {cpp} standard library: The compiler will look for specific paths according to the `-stdlib` option and include them as implicit `-isystem` paths. For instance, Clang can use different implementations of the {cpp} standard library. By default, that's Microsoft STL on Windows, libstdc++ on Linux and libc++ otherwise. This can be disabled with `-nostdinc++ -nostdlib++` or, in MrDocs, with `use-system-stdlib=false`. -* The C standard library (and system libraries): Unlike with libc++, LLVM+Clang does not provide an implementation of the C standard library. It always depends on the system for that. The compiler will not look for specific paths but implicitly include all system libraries. This can be disabled with `-nostdinc` or, in MrDocs, with `use-system-libc=false`. - -That means unless `-nostdinc` is defined, all systems include paths are included. This is what allows the user to also use headers like `` or `` without explicitly including anything else, even though they are not part of the C standard library. This is often seen as a convenience but can lead to portability issues. - -In this context, MrDocs provides the `use-system-stdlib` and `use-system-libc` options. Both are set as `false` by default, meaning MrDocs will compile the code as if the `-nostdinc++ -nostdlib++` and `-nostdinc` flags were passed to Clang. Additionally: - -- When `use-system-stdlib` is `false`, MrDocs will use the bundled libc++ headers available in `/share/mrdocs/headers/libcxx` and `/share/mrdocs/headers/clang`. These paths can be adjusted with the `stdlib-includes` option. -- When `use-system-libc` is `false`, MrDocs will use the bundled libc stubs available in `/share/mrdocs/headers/libc-stubs`. This path can be adjusted with the `libc-includes` option. - -The rationale for that is reproducibility. You want to be able to build your documentation and don't want it to stop working because the platform or some platform details have changed. -These default values also help avoid conflicts where the same symbol or header is defined twice if the compilation database includes system paths relevant to one specific compiler. That can breaks things when MrDocs attempts to compile it with clang. -In other words, MrDocs becomes a sandboxed environment where only the C and C++ standard libraries are available. - -The default values described above work for most libraries and applications that only depend on the C and C++ standard libraries. When there are no dependencies outside the standard libraries, the user probably won't even notice the difference between these options. - -However, if you depend on other system libraries, that means you need to handle these dependencies explicitly. For instance, this is very common with networking libraries. There are a few solutions to this, and these solutions are in a continuum regarding the use of `use-system-stdlib`/`use-system-libc` and the design of the code: - -1. Depending on the design of your library, you can implement a different path for MrDocs where you don't need these system headers. System headers are often guarded by macros to detect the platform: for instance, `__linux__` for `` and `_WIN32` for ``. You can use the `__MRDOCS__` macro to provide an implementation for MrDocs. This implementation would typically include stubs for the symbols you need in the documentation. Because symbols from system libraries are typically not exposed in the public API of your library, that gives you replacements that make sense for the documentation. However, this solution is not enough when other dependencies also depend on these system libraries. -2. Handle it as an explicit dependency. Explicitly include the paths you need in your compilation database as if it's a dependency described in the <> section. For instance, you can get CMake to explicitly find `` or `` and only include those directories with `-isystem` or `-I` in the compilation database. -3. Enable `use-system-libc`. MrDocs will still use the bundled libc++ for the C++ standard library, and use the system headers for the C standard library, making all system paths available. That makes system headers such as `` or `` available by default. The trade-off is losing the reproducibility guarantees described above. - -The first option in this list provides the most control and the most reproducibility. The third option is the most convenient but also the most fragile. - [#missing-includes] === Missing includes diff --git a/docs/mrdocs.schema.json b/docs/mrdocs.schema.json index 8865cd48f..6af396847 100644 --- a/docs/mrdocs.schema.json +++ b/docs/mrdocs.schema.json @@ -320,17 +320,6 @@ "title": "Use legible names", "type": "boolean" }, - "libc-includes": { - "default": [ - "/share/mrdocs/headers/libc-stubs" - ], - "description": "When `use-system-libc` is disabled, the C standard library headers are available in these paths.", - "items": { - "type": "string" - }, - "title": "Standard Library include paths", - "type": "array" - }, "log-level": { "default": "info", "description": "The reporting level determines the amount of information displayed during the generation of the documentation.", @@ -519,18 +508,6 @@ "title": "Path to the root directory of the source code", "type": "string" }, - "stdlib-includes": { - "default": [ - "/share/mrdocs/headers/libcxx", - "/share/mrdocs/headers/clang" - ], - "description": "When `use-system-stdlib` is disabled, the C++ standard library headers are available in these paths.", - "items": { - "type": "string" - }, - "title": "C++ Standard Library include paths", - "type": "array" - }, "system-includes": { "default": [], "description": "System include paths. These paths are used to add directories to the system include search path. The system include search path is used to search for system headers. The system headers are headers that are provided by the system and are not part of the project. The system headers are used to provide the standard library headers and other system headers. The system headers are not part of the project and are not checked for warnings and errors.", @@ -546,26 +523,6 @@ "title": "Path for the tagfile", "type": "string" }, - "use-system-libc": { - "default": false, - "description": "To achieve reproducible results, MrDocs bundles the LibC headers with its definitions. To use the C standard library available in the system instead, set this option to true.", - "enum": [ - true, - false - ], - "title": "Use the system C standard library", - "type": "boolean" - }, - "use-system-stdlib": { - "default": false, - "description": "To achieve reproducible results, MrDocs bundles the LibC++ headers. To use the C++ standard library available in the system instead, set this option to true.", - "enum": [ - true, - false - ], - "title": "Use the system C++ standard library", - "type": "boolean" - }, "verbose": { "default": false, "description": "Verbose output. When set to true, MrDocs outputs additional information during the generation of the documentation.", diff --git a/share/mrdocs/headers/libc-stubs/assert.h b/share/mrdocs/headers/libc-stubs/assert.h deleted file mode 100644 index a86014472..000000000 --- a/share/mrdocs/headers/libc-stubs/assert.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_ASSERT_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_ASSERT_H - -#define assert(...) ((void)0) - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_ASSERT_H diff --git a/share/mrdocs/headers/libc-stubs/complex.h b/share/mrdocs/headers/libc-stubs/complex.h deleted file mode 100644 index deadb21af..000000000 --- a/share/mrdocs/headers/libc-stubs/complex.h +++ /dev/null @@ -1,120 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_COMPLEX_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_COMPLEX_H - -// Types -#define imaginary _Imaginary -#define complex _Complex - -// Constants -#define _Imaginary_I ((float _Imaginary)1.0) -#define _Complex_I ((float _Complex)1.0) -#define I _Complex_I - -// Manipulation -#define CMPLX(x, y) ((double _Complex)((x) + _Complex_I * (y))) -#define CMPLXF(x, y) ((float _Complex)((x) + _Complex_I * (y))) -#define CMPLXL(x, y) ((long double _Complex)((x) + _Complex_I * (y))) - -double creal(double _Complex z); -float crealf(float _Complex z); -long double creall(long double _Complex z); - -double cimag(double _Complex z); -float cimagf(float _Complex z); -long double cimagl(long double _Complex z); - -double cabs(double _Complex z); -float cabsf(float _Complex z); -long double cabsl(long double _Complex z); - -double carg(double _Complex z); -float cargf(float _Complex z); -long double cargl(long double _Complex z); - -double _Complex conj(double _Complex z); -float _Complex conjf(float _Complex z); -long double _Complex conjl(long double _Complex z); - -double _Complex cproj(double _Complex z); -float _Complex cprojf(float _Complex z); -long double _Complex cprojl(long double _Complex z); - -// Exponential functions -double _Complex cexp(double _Complex z); -float _Complex cexpf(float _Complex z); -long double _Complex cexpl(long double _Complex z); - -double _Complex clog(double _Complex z); -float _Complex clogf(float _Complex z); -long double _Complex clogl(long double _Complex z); - -// Power functions -double _Complex cpow(double _Complex x, double _Complex y); -float _Complex cpowf(float _Complex x, float _Complex y); -long double _Complex cpowl(long double _Complex x, long double _Complex y); - -double _Complex csqrt(double _Complex z); -float _Complex csqrtf(float _Complex z); -long double _Complex csqrtl(long double _Complex z); - -// Trigonometric functions -double _Complex csin(double _Complex z); -float _Complex csinf(float _Complex z); -long double _Complex csinl(long double _Complex z); - -double _Complex ccos(double _Complex z); -float _Complex ccosf(float _Complex z); -long double _Complex ccosl(long double _Complex z); - -double _Complex ctan(double _Complex z); -float _Complex ctanf(float _Complex z); -long double _Complex ctanl(long double _Complex z); - -double _Complex casin(double _Complex z); -float _Complex casinf(float _Complex z); -long double _Complex casinl(long double _Complex z); - -double _Complex cacos(double _Complex z); -float _Complex cacosf(float _Complex z); -long double _Complex cacosl(long double _Complex z); - -double _Complex catan(double _Complex z); -float _Complex catanf(float _Complex z); -long double _Complex catanl(long double _Complex z); - -// Hyperbolic functions -double _Complex csinh(double _Complex z); -float _Complex csinhf(float _Complex z); -long double _Complex csinhl(long double _Complex z); - -double _Complex ccosh(double _Complex z); -float _Complex ccoshf(float _Complex z); -long double _Complex ccoshl(long double _Complex z); - -double _Complex ctanh(double _Complex z); -float _Complex ctanhf(float _Complex z); -long double _Complex ctanhl(long double _Complex z); - -double _Complex casinh(double _Complex z); -float _Complex casinhf(float _Complex z); -long double _Complex casinhl(long double _Complex z); - -double _Complex cacosh(double _Complex z); -float _Complex cacoshf(float _Complex z); -long double _Complex cacoshl(long double _Complex z); - -double _Complex catanh(double _Complex z); -float _Complex catanhf(float _Complex z); -long double _Complex catanhl(long double _Complex z); - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_COMPLEX_H diff --git a/share/mrdocs/headers/libc-stubs/ctype.h b/share/mrdocs/headers/libc-stubs/ctype.h deleted file mode 100644 index 001bfb867..000000000 --- a/share/mrdocs/headers/libc-stubs/ctype.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_CTYPE_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_CTYPE_H - -// Character classification -int isalnum( int ch ); -int isalpha( int ch ); -int islower( int ch ); -int isupper( int ch ); -int isdigit( int ch ); -int isxdigit( int ch ); -int iscntrl( int ch ); -int isgraph( int ch ); -int isspace( int ch ); -int isblank( int ch ); -int isprint( int ch ); -int ispunct( int ch ); - -// Character manipulation -int tolower( int ch ); -int toupper( int ch ); - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_CTYPE_H diff --git a/share/mrdocs/headers/libc-stubs/errno.h b/share/mrdocs/headers/libc-stubs/errno.h deleted file mode 100644 index a538534c4..000000000 --- a/share/mrdocs/headers/libc-stubs/errno.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_ERRNO_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_ERRNO_H - -#include "stddef.h" - -// Define errno as a thread-local variable -#ifdef __cplusplus -extern "C" { -#endif - -// Thread-local storage for errno -extern __thread errno_t __errno; - -#ifdef __cplusplus -} -#endif - -// Error codes -#define EDOM 1 -#define ERANGE 2 -#define EILSEQ 3 - -#define errno (__errno) - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_ERRNO_H diff --git a/share/mrdocs/headers/libc-stubs/fenv.h b/share/mrdocs/headers/libc-stubs/fenv.h deleted file mode 100644 index b4834c825..000000000 --- a/share/mrdocs/headers/libc-stubs/fenv.h +++ /dev/null @@ -1,54 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_FENV_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_FENV_H - -// Types -typedef struct { - unsigned int __control_word; - unsigned int __status_word; - unsigned int __tag_word; - unsigned int __other_flags; -} fenv_t; - -typedef unsigned int fexcept_t; - -// Functions -int feclearexcept(int excepts); -int fetestexcept(int excepts); -int feraiseexcept(int excepts); -int fegetexceptflag(fexcept_t* flagp, int excepts); -int fesetexceptflag(const fexcept_t* flagp, int excepts); -int fegetround(void); -int fesetround(int round); -int fegetenv(fenv_t* envp); -int fesetenv(const fenv_t* envp); -int feholdexcept(fenv_t* envp); -int feupdateenv(const fenv_t* envp); - -// Macros for floating-point exceptions -#define FE_ALL_EXCEPT 0x3F -#define FE_DIVBYZERO 0x04 -#define FE_INEXACT 0x20 -#define FE_INVALID 0x01 -#define FE_OVERFLOW 0x08 -#define FE_UNDERFLOW 0x10 - -// Macros for floating-point rounding direction -#define FE_DOWNWARD 0x400 -#define FE_TONEAREST 0x000 -#define FE_TOWARDZERO 0xC00 -#define FE_UPWARD 0x800 - -// Default floating-point environment -extern const fenv_t* FE_DFL_ENV; - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_FENV_H diff --git a/share/mrdocs/headers/libc-stubs/float.h b/share/mrdocs/headers/libc-stubs/float.h deleted file mode 100644 index 5d83e357d..000000000 --- a/share/mrdocs/headers/libc-stubs/float.h +++ /dev/null @@ -1,68 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_FLOAT_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_FLOAT_H - -// Limits of floating-point types -#define FLT_RADIX 2 -#define DECIMAL_DIG 21 -#define FLT_DECIMAL_DIG 9 -#define DBL_DECIMAL_DIG 17 -#define LDBL_DECIMAL_DIG 21 - -#define FLT_MIN 1.17549435e-38F -#define DBL_MIN 2.2250738585072014e-308 -#define LDBL_MIN 3.36210314311209350626e-4932L - -#define FLT_TRUE_MIN 1.40129846e-45F -#define DBL_TRUE_MIN 4.9406564584124654e-324 -#define LDBL_TRUE_MIN 3.64519953188247460253e-4951L - -#define FLT_MAX 3.40282347e+38F -#define DBL_MAX 1.7976931348623157e+308 -#define LDBL_MAX 1.18973149535723176502e+4932L - -#define FLT_EPSILON 1.19209290e-7F -#define DBL_EPSILON 2.2204460492503131e-16 -#define LDBL_EPSILON 1.08420217248550443401e-19L - -#define FLT_DIG 6 -#define DBL_DIG 15 -#define LDBL_DIG 18 - -#define FLT_MANT_DIG 24 -#define DBL_MANT_DIG 53 -#define LDBL_MANT_DIG 64 - -#define FLT_MIN_EXP (-125) -#define DBL_MIN_EXP (-1021) -#define LDBL_MIN_EXP (-16381) - -#define FLT_MIN_10_EXP (-37) -#define DBL_MIN_10_EXP (-307) -#define LDBL_MIN_10_EXP (-4931) - -#define FLT_MAX_EXP 128 -#define DBL_MAX_EXP 1024 -#define LDBL_MAX_EXP 16384 - -#define FLT_MAX_10_EXP 38 -#define DBL_MAX_10_EXP 308 -#define LDBL_MAX_10_EXP 4932 - -#define FLT_ROUNDS 1 -#define FLT_EVAL_METHOD 0 - -#define FLT_HAS_SUBNORM 1 -#define DBL_HAS_SUBNORM 1 -#define LDBL_HAS_SUBNORM 1 - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_FLOAT_H diff --git a/share/mrdocs/headers/libc-stubs/inttypes.h b/share/mrdocs/headers/libc-stubs/inttypes.h deleted file mode 100644 index 0232198e2..000000000 --- a/share/mrdocs/headers/libc-stubs/inttypes.h +++ /dev/null @@ -1,209 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_INTTYPES_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_INTTYPES_H - -#include "stdint.h" - -// Format constants for the fprintf family of functions -#define PRId8 "d" -#define PRId16 "d" -#define PRId32 "d" -#define PRId64 "lld" - -#define PRIi8 "i" -#define PRIi16 "i" -#define PRIi32 "i" -#define PRIi64 "lli" - -#define PRIu8 "u" -#define PRIu16 "u" -#define PRIu32 "u" -#define PRIu64 "llu" - -#define PRIo8 "o" -#define PRIo16 "o" -#define PRIo32 "o" -#define PRIo64 "llo" - -#define PRIx8 "x" -#define PRIx16 "x" -#define PRIx32 "x" -#define PRIx64 "llx" - -#define PRIX8 "X" -#define PRIX16 "X" -#define PRIX32 "X" -#define PRIX64 "llX" - -#define PRIdLEAST8 "d" -#define PRIdLEAST16 "d" -#define PRIdLEAST32 "d" -#define PRIdLEAST64 "lld" - -#define PRIiLEAST8 "i" -#define PRIiLEAST16 "i" -#define PRIiLEAST32 "i" -#define PRIiLEAST64 "lli" - -#define PRIuLEAST8 "u" -#define PRIuLEAST16 "u" -#define PRIuLEAST32 "u" -#define PRIuLEAST64 "llu" - -#define PRIoLEAST8 "o" -#define PRIoLEAST16 "o" -#define PRIoLEAST32 "o" -#define PRIoLEAST64 "llo" - -#define PRIxLEAST8 "x" -#define PRIxLEAST16 "x" -#define PRIxLEAST32 "x" -#define PRIxLEAST64 "llx" - -#define PRIXLEAST8 "X" -#define PRIXLEAST16 "X" -#define PRIXLEAST32 "X" -#define PRIXLEAST64 "llX" - -#define PRIdFAST8 "d" -#define PRIdFAST16 "d" -#define PRIdFAST32 "d" -#define PRIdFAST64 "lld" - -#define PRIiFAST8 "i" -#define PRIiFAST16 "i" -#define PRIiFAST32 "i" -#define PRIiFAST64 "lli" - -#define PRIuFAST8 "u" -#define PRIuFAST16 "u" -#define PRIuFAST32 "u" -#define PRIuFAST64 "llu" - -#define PRIoFAST8 "o" -#define PRIoFAST16 "o" -#define PRIoFAST32 "o" -#define PRIoFAST64 "llo" - -#define PRIxFAST8 "x" -#define PRIxFAST16 "x" -#define PRIxFAST32 "x" -#define PRIxFAST64 "llx" - -#define PRIXFAST8 "X" -#define PRIXFAST16 "X" -#define PRIXFAST32 "X" -#define PRIXFAST64 "llX" - -#define PRIdMAX "jd" -#define PRIiMAX "ji" -#define PRIuMAX "ju" -#define PRIoMAX "jo" -#define PRIxMAX "jx" -#define PRIXMAX "jX" - -#define PRIdPTR "td" -#define PRIiPTR "ti" -#define PRIuPTR "tu" -#define PRIoPTR "to" -#define PRIxPTR "tx" -#define PRIXPTR "tX" - -// Format constants for the fscanf family of functions -#define SCNd8 "hhd" -#define SCNd16 "hd" -#define SCNd32 "d" -#define SCNd64 "lld" - -#define SCNi8 "hhi" -#define SCNi16 "hi" -#define SCNi32 "i" -#define SCNi64 "lli" - -#define SCNu8 "hhu" -#define SCNu16 "hu" -#define SCNu32 "u" -#define SCNu64 "llu" - -#define SCNo8 "hho" -#define SCNo16 "ho" -#define SCNo32 "o" -#define SCNo64 "llo" - -#define SCNx8 "hhx" -#define SCNx16 "hx" -#define SCNx32 "x" -#define SCNx64 "llx" - -#define SCNdLEAST8 "hhd" -#define SCNdLEAST16 "hd" -#define SCNdLEAST32 "d" -#define SCNdLEAST64 "lld" - -#define SCNiLEAST8 "hhi" -#define SCNiLEAST16 "hi" -#define SCNiLEAST32 "i" -#define SCNiLEAST64 "lli" - -#define SCNuLEAST8 "hhu" -#define SCNuLEAST16 "hu" -#define SCNuLEAST32 "u" -#define SCNuLEAST64 "llu" - -#define SCNoLEAST8 "hho" -#define SCNoLEAST16 "ho" -#define SCNoLEAST32 "o" -#define SCNoLEAST64 "llo" - -#define SCNxLEAST8 "hhx" -#define SCNxLEAST16 "hx" -#define SCNxLEAST32 "x" -#define SCNxLEAST64 "llx" - -#define SCNdFAST8 "hhd" -#define SCNdFAST16 "hd" -#define SCNdFAST32 "d" -#define SCNdFAST64 "lld" - -#define SCNiFAST8 "hhi" -#define SCNiFAST16 "hi" -#define SCNiFAST32 "i" -#define SCNiFAST64 "lli" - -#define SCNuFAST8 "hhu" -#define SCNuFAST16 "hu" -#define SCNuFAST32 "u" -#define SCNuFAST64 "llu" - -#define SCNoFAST8 "hho" -#define SCNoFAST16 "ho" -#define SCNoFAST32 "o" -#define SCNoFAST64 "llo" - -#define SCNxFAST8 "hhx" -#define SCNxFAST16 "hx" -#define SCNxFAST32 "x" -#define SCNxFAST64 "llx" - -#define SCNdMAX "jd" -#define SCNiMAX "ji" -#define SCNuMAX "ju" -#define SCNoMAX "jo" -#define SCNxMAX "jx" - -#define SCNdPTR "td" -#define SCNiPTR "ti" -#define SCNuPTR "tu" -#define SCNoPTR "to" -#define SCNxPTR "tx" - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_INTTYPES_H diff --git a/share/mrdocs/headers/libc-stubs/io.h b/share/mrdocs/headers/libc-stubs/io.h deleted file mode 100644 index 67f3d5c48..000000000 --- a/share/mrdocs/headers/libc-stubs/io.h +++ /dev/null @@ -1,110 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_IO_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_IO_H - -int -_access(char *path, int mode); - -int -_chmod(const char *pathname, int pmode); - -int -_chsize(int handle, long size); - -int -_close(int handle); - -int -_commit(int handle); - -int -_creat(const char *name, int pmode); - -int -_dup(int fd); - -int -dup2(int fdl, int fd2); - -int -_eof(int handle); - -long -_filelength(int fd); - -int -_isatty(int fd); - -int -_locking(int fd, int mode, long size); - -long -_lseek(int fd, long offset, int mode); - -char * -_mktemp(char *template_); - -int -_open(const char *file, int oflag, int pmode); - -int -_open(const char *file, int oflag); - -int -_read(int fd, void *buffer, unsigned int len); - -int -_setmode(int handle, int mode); - -int -_sopen(const char *file, int oflag, int shflag, int pmode); - -int -_sopen(const char *file, int oflag, int shflag); - -long -_tell(int handle); - -int -_write(int fd, void *buffer, unsigned int length); - -unsigned -_umask(int mode); - -int -_unlink(const char *filename); - -long -filesize(const char *filename); - -unsigned short -getDS(void); - -int -getftime(int handle, struct ftime *ftimep); - -int -lock(int handle, long offset, long length); - -int -remove(const char *filename); - -int -rename(const char *oldname, const char *newname); - -int -setftime(int handle, struct ftime *ftime); - -int -unlock(int handle, long offset, long length); - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_IO_H diff --git a/share/mrdocs/headers/libc-stubs/iso646.h b/share/mrdocs/headers/libc-stubs/iso646.h deleted file mode 100644 index 0523a9573..000000000 --- a/share/mrdocs/headers/libc-stubs/iso646.h +++ /dev/null @@ -1,62 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_ISO646_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_ISO646_H - -#ifndef __cplusplus -// Operator macros (C95) -#ifndef and -#define and && -#endif - -#ifndef and_eq -#define and_eq &= -#endif - -#ifndef bitand -#define bitand & -#endif - -#ifndef bitor -#define bitor | -#endif - -#ifndef compl -#define compl ~ -#endif - -#ifndef not -#define not ! -#endif - -#ifndef not_eq -#define not_eq != -#endif - -#ifndef or -#define or || -#endif - -#ifndef or_eq -#define or_eq |= -#endif - -#ifndef xor -#define xor ^ -#endif - -#ifndef xor_eq -#define xor_eq ^= -#endif - -#endif // __cplusplus - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_ISO646_H diff --git a/share/mrdocs/headers/libc-stubs/limits.h b/share/mrdocs/headers/libc-stubs/limits.h deleted file mode 100644 index fc3684cc7..000000000 --- a/share/mrdocs/headers/libc-stubs/limits.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_LIMITS_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_LIMITS_H - -#define BOOL_WIDTH 8 -#define CHAR_BIT 8 -#define MB_LEN_MAX 16 -#define CHAR_WIDTH 8 -#define CHAR_MIN -128 -#define CHAR_MAX 127 -#define SCHAR_WIDTH 8 -#define SHRT_WIDTH 16 -#define INT_WIDTH 32 -#define LONG_WIDTH 64 -#define LLONG_WIDTH 64 -#define SCHAR_MIN -128 -#define SHRT_MIN -32768 -#define INT_MIN -2147483648 -#define LONG_MIN -9223372036854775808 -#define LLONG_MIN -9223372036854775808 -#define SCHAR_MAX 127 -#define SHRT_MAX 32767 -#define INT_MAX 2147483647 -#define LONG_MAX 9223372036854775807 -#define LLONG_MAX 9223372036854775807 -#define UCHAR_WIDTH 8 -#define USHRT_WIDTH 16 -#define UINT_WIDTH 32 -#define ULONG_WIDTH 64 -#define ULLONG_WIDTH 64 -#define UCHAR_MAX 255 -#define USHRT_MAX 65535 -#define UINT_MAX 4294967295 -#define ULONG_MAX 18446744073709551615 -#define ULLONG_MAX 18446744073709551615 -#define BITINT_MAXWIDTH 64 - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_LIMITS_H diff --git a/share/mrdocs/headers/libc-stubs/locale.h b/share/mrdocs/headers/libc-stubs/locale.h deleted file mode 100644 index 02f4320f8..000000000 --- a/share/mrdocs/headers/libc-stubs/locale.h +++ /dev/null @@ -1,105 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_LOCALE_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_LOCALE_H - -#include "stdarg.h" - -struct lconv { - // Non-monetary numeric formatting parameters - char* decimal_point; - char* thousands_sep; - char* grouping; - // Monetary numeric formatting parameters - char* mon_decimal_point; - char* mon_thousands_sep; - char* mon_grouping; - char* positive_sign; - char* negative_sign; - // Local monetary numeric formatting parameters - char* currency_symbol; - char frac_digits; - char p_cs_precedes; - char n_cs_precedes; - char p_sep_by_space; - char n_sep_by_space; - char p_sign_posn; - char n_sign_posn; - // International monetary numeric formatting parameters - char* int_curr_symbol; - char int_frac_digits; - char int_p_cs_precedes; - char int_n_cs_precedes; - char int_p_sep_by_space; - char int_n_sep_by_space; - char int_p_sign_posn; - char int_n_sign_posn; -}; - -#if defined(_LIBCPP_MSVCRT_LIKE) -// Windows defines _locale_t and locale_t is defined by libc++ -struct _locale_t {}; -#else -// Use the same struct for Linux and MacOS -#include "xlocale.h" -#endif - -#define LC_CTYPE 0 -#define LC_NUMERIC 1 -#define LC_TIME 2 -#define LC_COLLATE 3 -#define LC_MONETARY 4 -#define LC_MESSAGES 5 -#define LC_ALL 6 -#define LC_PAPER 7 -#define LC_NAME 8 -#define LC_ADDRESS 9 -#define LC_TELEPHONE 10 -#define LC_MEASUREMENT 11 -#define LC_IDENTIFICATION 12 - -#define LC_CTYPE_MASK (1 << LC_CTYPE) -#define LC_NUMERIC_MASK (1 << LC_NUMERIC) -#define LC_TIME_MASK (1 << LC_TIME) -#define LC_COLLATE_MASK (1 << LC_COLLATE) -#define LC_MONETARY_MASK (1 << LC_MONETARY) -#define LC_MESSAGES_MASK (1 << LC_MESSAGES) -#define LC_PAPER_MASK (1 << LC_PAPER) -#define LC_NAME_MASK (1 << LC_NAME) -#define LC_ADDRESS_MASK (1 << LC_ADDRESS) -#define LC_TELEPHONE_MASK (1 << LC_TELEPHONE) -#define LC_MEASUREMENT_MASK (1 << LC_MEASUREMENT) -#define LC_IDENTIFICATION_MASK (1 << LC_IDENTIFICATION) -#define LC_ALL_MASK (LC_CTYPE_MASK | LC_NUMERIC_MASK | LC_TIME_MASK | LC_COLLATE_MASK | \ -LC_MONETARY_MASK | LC_MESSAGES_MASK | LC_PAPER_MASK | LC_NAME_MASK | \ -LC_ADDRESS_MASK | LC_TELEPHONE_MASK | LC_MEASUREMENT_MASK | \ -LC_IDENTIFICATION_MASK) - -#if defined(_LIBCPP_MSVCRT_LIKE) -#define _SPACE 0x01 -#define _UPPER 0x02 -#define _LOWER 0x04 -#define _DIGIT 0x08 -#define _PUNCT 0x10 -#define _CONTROL 0x20 -#define _BLANK 0x40 -#define _HEX 0x80 -#define _LEADBYTE 0x8000 -#define _ALPHA (_UPPER|_LOWER) // (0x02|0x04) -#define _ALNUM (_UPPER|_LOWER|_DIGIT) // (0x02|0x04|0x08) -#else -#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE -#endif - -char* setlocale( int category, const char* locale ); -struct lconv *localeconv(void); - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_LOCALE_H diff --git a/share/mrdocs/headers/libc-stubs/malloc.h b/share/mrdocs/headers/libc-stubs/malloc.h deleted file mode 100644 index 89ba7c743..000000000 --- a/share/mrdocs/headers/libc-stubs/malloc.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_MALLOC_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_MALLOC_H - -void *malloc( size_t size ); -void* calloc( size_t num, size_t size ); -void *realloc( void *ptr, size_t new_size ); -void free( void *ptr ); -void free_sized( void* ptr, size_t size ); -void free_aligned_sized( void* ptr, size_t alignment, size_t size ); -void *aligned_alloc( size_t alignment, size_t size ); - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_MALLOC_H diff --git a/share/mrdocs/headers/libc-stubs/math.h b/share/mrdocs/headers/libc-stubs/math.h deleted file mode 100644 index b49dfae35..000000000 --- a/share/mrdocs/headers/libc-stubs/math.h +++ /dev/null @@ -1,381 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_MATH_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_MATH_H - -#ifdef _LIBCPP_MSVCRT -#include - -// Basic operations -float fabsf( float arg ); -double fabs( double arg ); -long double fabsl( long double arg ); - -float fmodf( float x, float y ); -double fmod( double x, double y ); -long double fmodl( long double x, long double y ); - -float remainderf( float x, float y ); -double remainder( double x, double y ); -long double remainderl( long double x, long double y ); - -float remquof( float x, float y, int *quo ); -double remquo( double x, double y, int *quo ); -long double remquol( long double x, long double y, int *quo ); - -float fmaf( float x, float y, float z ); -double fma( double x, double y, double z ); -long double fmal( long double x, long double y, long double z ); - -float fmaxf( float x, float y ); -double fmax( double x, double y ); -long double fmaxl( long double x, long double y ); - -float fminf( float x, float y ); -double fmin( double x, double y ); -long double fminl( long double x, long double y ); - -float fdimf( float x, float y ); -double fdim( double x, double y ); -long double fdiml( long double x, long double y ); - -float nanf( const char* arg ); -double nan( const char* arg ); -long double nanl( const char* arg ); - -// Exponential functions -float expf( float arg ); -double exp( double arg ); -long double expl( long double arg ); - -float exp2f( float n ); -double exp2( double n ); -long double exp2l( long double n ); - -float expm1f( float arg ); -double expm1( double arg ); -long double expm1l( long double arg ); - -float logf( float arg ); -double log( double arg ); -long double logl( long double arg ); - -float log10f( float arg ); -double log10( double arg ); -long double log10l( long double arg ); - -float log2f( float arg ); -double log2( double arg ); -long double log2l( long double arg ); - -float log1pf( float arg ); -double log1p( double arg ); -long double log1pl( long double arg ); - -// Power functions -float powf( float base, float exponent ); -double pow( double base, double exponent ); -long double powl( long double base, long double exponent ); - -float sqrtf( float arg ); -double sqrt( double arg ); -long double sqrtl( long double arg ); - -float cbrtf( float arg ); -double cbrt( double arg ); -long double cbrtl( long double arg ); - -float hypotf( float x, float y ); -double hypot( double x, double y ); -long double hypotl( long double x, long double y ); - -// Trigonometric functions -float sinf( float arg ); -double sin( double arg ); -long double sinl( long double arg ); - -float cosf( float arg ); -double cos( double arg ); -long double cosl( long double arg ); - -float tanf( float arg ); -double tan( double arg ); -long double tanl( long double arg ); - -float asinf( float arg ); -double asin( double arg ); -long double asinl( long double arg ); - -float acosf( float arg ); -double acos( double arg ); -long double acosl( long double arg ); - -float atanf( float arg ); -double atan( double arg ); -long double atanl( long double arg ); - -float atan2f( float y, float x ); -double atan2( double y, double x ); -long double atan2l( long double y, long double x ); - -// Hyperbolic functions -float sinhf( float arg ); -double sinh( double arg ); -long double sinhl( long double arg ); - -float coshf( float arg ); -double cosh( double arg ); -long double coshl( long double arg ); - -float tanhf( float arg ); -double tanh( double arg ); -long double tanhl( long double arg ); - -float asinhf( float arg ); -double asinh( double arg ); -long double asinhl( long double arg ); - -float acoshf( float arg ); -double acosh( double arg ); -long double acoshl( long double arg ); - -float atanhf( float arg ); -double atanh( double arg ); -long double atanhl( long double arg ); - -// Error and gamma functions -float erff( float arg ); -double erf( double arg ); -long double erfl( long double arg ); - -float erfcf( float arg ); -double erfc( double arg ); -long double erfcl( long double arg ); - -float tgammaf( float arg ); -double tgamma( double arg ); -long double tgammal( long double arg ); - -float lgammaf( float arg ); -double lgamma( double arg ); -long double lgammal( long double arg ); - -// Nearest integer floating-point operations -float ceilf( float arg ); -double ceil( double arg ); -long double ceill( long double arg ); - -float floorf( float arg ); -double floor( double arg ); -long double floorl( long double arg ); - -float truncf( float arg ); -double trunc( double arg ); -long double truncl( long double arg ); - -float roundf( float arg ); -double round( double arg ); -long double roundl( long double arg ); - -long lroundf( float arg ); -long lround( double arg ); -long lroundl( long double arg ); - -long long llroundf( float arg ); -long long llround( double arg ); -long long llroundl( long double arg ); - -float nearbyintf( float arg ); -double nearbyint( double arg ); -long double nearbyintl( long double arg ); - -float rintf( float arg ); -double rint( double arg ); -long double rintl( long double arg ); - -long lrintf( float arg ); -long lrint( double arg ); -long lrintl( long double arg ); - -long long llrintf( float arg ); -long long llrint( double arg ); -long long llrintl( long double arg ); - -// Floating-point manipulation functions -float frexpf( float arg, int* exp ); -double frexp( double arg, int* exp ); -long double frexpl( long double arg, int* exp ); - -float ldexpf( float arg, int exp ); -double ldexp( double arg, int exp ); -long double ldexpl( long double arg, int exp ); - -float modff( float arg, float* iptr ); -double modf( double arg, double* iptr ); -long double modfl( long double arg, long double* iptr ); - -float scalbnf( float arg, int exp ); -double scalbn( double arg, int exp ); -long double scalbnl( long double arg, int exp ); - -float scalblnf( float arg, long exp ); -double scalbln( double arg, long exp ); -long double scalblnl( long double arg, long exp ); - -int ilogbf( float arg ); -int ilogb( double arg ); -int ilogbl( long double arg ); - -float logbf( float arg ); -double logb( double arg ); -long double logbl( long double arg ); - -float nextafterf( float x, float y ); -double nextafter( double x, double y ); -long double nextafterl( long double x, long double y ); - -float nexttowardf( float x, long double y ); -double nexttoward( double x, long double y ); -long double nexttowardl( long double x, long double y ); - -float copysignf( float x, float y ); -double copysign( double x, double y ); -long double copysignl( long double x, long double y ); - -int fpclassify( float num ); -int fpclassify( double num ); -int fpclassify( long double num ); - -bool isfinite( float num ); -bool isfinite( double num ); -bool isfinite( long double num ); - -bool isinf( float num ); -bool isinf( double num ); -bool isinf( long double num ); - -bool isnan( float num ); -bool isnan( double num ); -bool isnan( long double num ); - -bool isnormal( float num ); -bool isnormal( double num ); -bool isnormal( long double num ); - -bool signbit( float num ); -bool signbit( double num ); -bool signbit( long double num ); - -bool isgreater( float x, float y ); -bool isgreater( double x, double y ); -bool isgreater( long double x, long double y ); - -bool isgreaterequal( float x, float y ); -bool isgreaterequal( double x, double y ); -bool isgreaterequal( long double x, long double y ); - -bool isless( float x, float y ); -bool isless( double x, double y ); -bool isless( long double x, long double y ); - -bool islessequal( float x, float y ); -bool islessequal( double x, double y ); -bool islessequal( long double x, long double y ); - -bool islessgreater( float x, float y ); -bool islessgreater( double x, double y ); -bool islessgreater( long double x, long double y ); - -bool isunordered( float x, float y ); -bool isunordered( double x, double y ); -bool isunordered( long double x, long double y ); -#endif // _LIBCPP_MSVCRT - -// Additional macros -#ifndef HUGE_VALF -#define HUGE_VALF __builtin_huge_valf() -#endif - -#ifndef HUGE_VAL -#define HUGE_VAL __builtin_huge_val() -#endif - -#ifndef HUGE_VALL -#define HUGE_VALL __builtin_huge_vall() -#endif - -#ifndef INFINITY -#define INFINITY __builtin_inff() -#endif - -#ifndef NAN -#define NAN __builtin_nanf("") -#endif - - -#ifndef FP_FAST_FMAF -#define FP_FAST_FMAF 1 -#endif - -#ifndef FP_FAST_FMA -#define FP_FAST_FMA 1 -#endif - -#ifndef FP_FAST_FMAL -#define FP_FAST_FMAL 1 -#endif - - -#ifndef FP_ILOGB0 -#define FP_ILOGB0 (-2147483647 - 1) -#endif - -#ifndef FP_ILOGBNAN -#define FP_ILOGBNAN (-2147483647 - 1) -#endif - - -#ifndef MATH_ERRNO -#define MATH_ERRNO 1 -#endif - -#ifndef MATH_ERREXCEPT -#define MATH_ERREXCEPT 2 -#endif - -#ifndef math_errhandling -#define math_errhandling (MATH_ERRNO | MATH_ERREXCEPT) -#endif - -// Classification and comparison -#ifndef FP_NAN -#define FP_NAN 0 -#endif - -#ifndef FP_INFINITE -#define FP_INFINITE 1 -#endif - -#ifndef FP_ZERO -#define FP_ZERO 2 -#endif - -#ifndef FP_SUBNORMAL -#define FP_SUBNORMAL 3 -#endif - -#ifndef FP_NORMAL -#define FP_NORMAL 4 -#endif - - - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_MATH_H diff --git a/share/mrdocs/headers/libc-stubs/new.h b/share/mrdocs/headers/libc-stubs/new.h deleted file mode 100644 index 8366be759..000000000 --- a/share/mrdocs/headers/libc-stubs/new.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_NEW_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_NEW_H - -#if defined(_LIBCPP_ABI_VCRUNTIME) -namespace std { - enum class align_val_t : size_t {}; - struct nothrow_t { explicit nothrow_t() = default; }; - extern const std::nothrow_t nothrow; -} - -// Replaceable allocation functions -void* operator new ( std::size_t count ); -void* operator new[]( std::size_t count ); -void* operator new ( std::size_t count, std::align_val_t al ); -void* operator new[]( std::size_t count, std::align_val_t al ); - -// Replaceable non-throwing allocation functions -void* operator new ( std::size_t count, const std::nothrow_t& tag ); -void* operator new[]( std::size_t count, const std::nothrow_t& tag ); -void* operator new ( std::size_t count, std::align_val_t al, - const std::nothrow_t& tag ) noexcept; -void* operator new[]( std::size_t count, std::align_val_t al, - const std::nothrow_t& tag ) noexcept; - -// Non-allocating placement allocation functions -void* operator new ( std::size_t count, void* ptr ); -void* operator new[]( std::size_t count, void* ptr ); -#endif - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_NEW_H diff --git a/share/mrdocs/headers/libc-stubs/nl_types.h b/share/mrdocs/headers/libc-stubs/nl_types.h deleted file mode 100644 index 261412dc2..000000000 --- a/share/mrdocs/headers/libc-stubs/nl_types.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_NL_TYPES_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_NL_TYPES_H - -using nl_catd = int; -using nl_item = int; - -int catclose(nl_catd); -char *catgets(nl_catd, int, int, const char *); -nl_catd catopen(const char *, int); - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_NL_TYPES_H diff --git a/share/mrdocs/headers/libc-stubs/ntverp.h b/share/mrdocs/headers/libc-stubs/ntverp.h deleted file mode 100644 index 494cf10a7..000000000 --- a/share/mrdocs/headers/libc-stubs/ntverp.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_NTVERP_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_NTVERP_H - -#define VER_PRODUCTBUILD /* NT */ 10011 -#define VER_STATICPRODUCTBUILD 10011 - -#define VER_PRODUCTBUILD_QFE 16384 -#define VER_STATICPRODUCTBUILD_QFE 16384 - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_NTVERP_H diff --git a/share/mrdocs/headers/libc-stubs/pthread.h b/share/mrdocs/headers/libc-stubs/pthread.h deleted file mode 100644 index 3484aade0..000000000 --- a/share/mrdocs/headers/libc-stubs/pthread.h +++ /dev/null @@ -1,145 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_PTHREAD_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_PTHREAD_H - -#include "sched.h" -#include "time.h" -#include "wchar.h" - -// https://pubs.opengroup.org/onlinepubs/7908799/xsh/systypes.h.html -using pthread_t = unsigned long long; -using pthread_attr_t = unsigned long long; -using pthread_cond_t = unsigned long long; -using pthread_condattr_t = unsigned long long; -using pthread_key_t = unsigned long long; -using pthread_mutex_t = unsigned long long; -using pthread_mutexattr_t = unsigned long long; -using pthread_once_t = unsigned long long; -using pthread_rwlock_t = unsigned long long; -using pthread_rwlockattr_t = unsigned long long; -using pthread_spinlock_t = unsigned long long; -using pthread_barrier_t = unsigned long long; -using pthread_barrierattr_t = unsigned long long; - -// https://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread.h.html -int pthread_attr_destroy(pthread_attr_t *); -int pthread_attr_getdetachstate(const pthread_attr_t *, int *); -int pthread_attr_getguardsize(const pthread_attr_t *, size_t *); -int pthread_attr_getinheritsched(const pthread_attr_t *, int *); -int pthread_attr_getschedparam(const pthread_attr_t *, - struct sched_param *); -int pthread_attr_getschedpolicy(const pthread_attr_t *, int *); -int pthread_attr_getscope(const pthread_attr_t *, int *); -int pthread_attr_getstackaddr(const pthread_attr_t *, void **); -int pthread_attr_getstacksize(const pthread_attr_t *, size_t *); -int pthread_attr_init(pthread_attr_t *); -int pthread_attr_setdetachstate(pthread_attr_t *, int); -int pthread_attr_setguardsize(pthread_attr_t *, size_t); -int pthread_attr_setinheritsched(pthread_attr_t *, int); -int pthread_attr_setschedparam(pthread_attr_t *, - const struct sched_param *); -int pthread_attr_setschedpolicy(pthread_attr_t *, int); -int pthread_attr_setscope(pthread_attr_t *, int); -int pthread_attr_setstackaddr(pthread_attr_t *, void *); -int pthread_attr_setstacksize(pthread_attr_t *, size_t); -int pthread_cancel(pthread_t); -void pthread_cleanup_push(void (*)(void *), void *); -void pthread_cleanup_pop(int); -int pthread_cond_broadcast(pthread_cond_t *); -int pthread_cond_destroy(pthread_cond_t *); -int pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *); -int pthread_cond_signal(pthread_cond_t *); -int pthread_cond_timedwait(pthread_cond_t *, - pthread_mutex_t *, const struct timespec *); -int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *); -int pthread_condattr_destroy(pthread_condattr_t *); -int pthread_condattr_getpshared(const pthread_condattr_t *, int *); -int pthread_condattr_init(pthread_condattr_t *); -int pthread_condattr_setpshared(pthread_condattr_t *, int); -int pthread_create(pthread_t *, const pthread_attr_t *, - void *(*)(void *), void *); -int pthread_detach(pthread_t); -int pthread_equal(pthread_t, pthread_t); -void pthread_exit(void *); -int pthread_getconcurrency(void); -int pthread_getschedparam(pthread_t, int *, struct sched_param *); -void *pthread_getspecific(pthread_key_t); -int pthread_join(pthread_t, void **); -int pthread_key_create(pthread_key_t *, void (*)(void *)); -int pthread_key_delete(pthread_key_t); -int pthread_mutex_destroy(pthread_mutex_t *); -int pthread_mutex_getprioceiling(const pthread_mutex_t *, int *); -int pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *); -int pthread_mutex_lock(pthread_mutex_t *); -int pthread_mutex_setprioceiling(pthread_mutex_t *, int, int *); -int pthread_mutex_trylock(pthread_mutex_t *); -int pthread_mutex_unlock(pthread_mutex_t *); -int pthread_mutexattr_destroy(pthread_mutexattr_t *); -int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *, - int *); -int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *, int *); -int pthread_mutexattr_getpshared(const pthread_mutexattr_t *, int *); -int pthread_mutexattr_gettype(const pthread_mutexattr_t *, int *); -int pthread_mutexattr_init(pthread_mutexattr_t *); -int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int); -int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int); -int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int); -int pthread_mutexattr_settype(pthread_mutexattr_t *, int); -int pthread_once(pthread_once_t *, void (*)(void)); -int pthread_rwlock_destroy(pthread_rwlock_t *); -int pthread_rwlock_init(pthread_rwlock_t *, - const pthread_rwlockattr_t *); -int pthread_rwlock_rdlock(pthread_rwlock_t *); -int pthread_rwlock_tryrdlock(pthread_rwlock_t *); -int pthread_rwlock_trywrlock(pthread_rwlock_t *); -int pthread_rwlock_unlock(pthread_rwlock_t *); -int pthread_rwlock_wrlock(pthread_rwlock_t *); -int pthread_rwlockattr_destroy(pthread_rwlockattr_t *); -int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *, - int *); -int pthread_rwlockattr_init(pthread_rwlockattr_t *); -int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int); -pthread_t pthread_self(void); -int pthread_setcancelstate(int, int *); -int pthread_setcanceltype(int, int *); -int pthread_setconcurrency(int); -int pthread_setschedparam(pthread_t, int , - const struct sched_param *); -int pthread_setspecific(pthread_key_t, const void *); -void pthread_testcancel(void); - -#define PTHREAD_CANCEL_ASYNCHRONOUS 0 -#define PTHREAD_CANCEL_ENABLE 1 -#define PTHREAD_CANCEL_DEFERRED 2 -#define PTHREAD_CANCEL_DISABLE 3 -#define PTHREAD_CANCELED ((void *) -1) -#define PTHREAD_COND_INITIALIZER ((pthread_cond_t) 0) -#define PTHREAD_CREATE_DETACHED 1 -#define PTHREAD_CREATE_JOINABLE 0 -#define PTHREAD_EXPLICIT_SCHED 1 -#define PTHREAD_INHERIT_SCHED 0 -#define PTHREAD_MUTEX_DEFAULT 0 -#define PTHREAD_MUTEX_ERRORCHECK 1 -#define PTHREAD_MUTEX_NORMAL 2 -#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) 0) -#define PTHREAD_MUTEX_RECURSIVE 3 -#define PTHREAD_ONCE_INIT 0 -#define PTHREAD_PRIO_INHERIT 1 -#define PTHREAD_PRIO_NONE 0 -#define PTHREAD_PRIO_PROTECT 2 -#define PTHREAD_PROCESS_SHARED 1 -#define PTHREAD_PROCESS_PRIVATE 0 -#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) 0) -#define PTHREAD_SCOPE_PROCESS 1 -#define PTHREAD_SCOPE_SYSTEM 0 - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_PTHREAD_H diff --git a/share/mrdocs/headers/libc-stubs/sched.h b/share/mrdocs/headers/libc-stubs/sched.h deleted file mode 100644 index 23d7f5803..000000000 --- a/share/mrdocs/headers/libc-stubs/sched.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_PTHREAD_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_PTHREAD_H - - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_PTHREAD_H diff --git a/share/mrdocs/headers/libc-stubs/setjmp.h b/share/mrdocs/headers/libc-stubs/setjmp.h deleted file mode 100644 index dd42fa76c..000000000 --- a/share/mrdocs/headers/libc-stubs/setjmp.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_SETJMP_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_SETJMP_H - -// Types -typedef struct { - void* sp; // Stack pointer - void* pc; // Program counter - int val; // Return value -} jmp_buf[1]; - -#ifdef __cplusplus -extern "C" { -#endif - -// Non-local jumps -#define setjmp(env) _setjmp(env) -int __cdecl _setjmp(jmp_buf env); - -#ifdef __cplusplus -} -#endif - -void longjmp(jmp_buf env, int val); - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_SETJMP_H diff --git a/share/mrdocs/headers/libc-stubs/signal.h b/share/mrdocs/headers/libc-stubs/signal.h deleted file mode 100644 index 05b9f08ef..000000000 --- a/share/mrdocs/headers/libc-stubs/signal.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_SIGNAL_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_SIGNAL_H - -// Types -typedef int sig_atomic_t; - -// Signal handling strategies -#define SIG_DFL ((void (*)(int))0) // Default signal handling -#define SIG_IGN ((void (*)(int))1) // Ignore signal -#define SIG_ERR ((void (*)(int))-1) // Error return - -// Signal types -#define SIGABRT 6 // Abort signal -#define SIGFPE 8 // Floating-point exception -#define SIGILL 4 // Illegal instruction -#define SIGINT 2 // Interrupt signal -#define SIGSEGV 11 // Segmentation fault -#define SIGTERM 15 // Termination signal - -// Function declarations -typedef void (*sighandler_t)(int); - -sighandler_t signal(int signum, sighandler_t handler); -int raise(int sig); - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_SIGNAL_H diff --git a/share/mrdocs/headers/libc-stubs/stdalign.h b/share/mrdocs/headers/libc-stubs/stdalign.h deleted file mode 100644 index 886fbf6d3..000000000 --- a/share/mrdocs/headers/libc-stubs/stdalign.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDALIGN_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDALIGN_H - -// Convenience macros for alignment -#define alignas _Alignas -#define alignof _Alignof - -// Macro constants indicating the presence of alignment features -#define __alignas_is_defined 1 -#define __alignof_is_defined 1 - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDALIGN_H diff --git a/share/mrdocs/headers/libc-stubs/stdarg.h b/share/mrdocs/headers/libc-stubs/stdarg.h deleted file mode 100644 index 289aee0ae..000000000 --- a/share/mrdocs/headers/libc-stubs/stdarg.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDARG_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDARG_H - -// Type -typedef __builtin_va_list va_list; - -// Macros -#define va_start(ap, param) __builtin_va_start(ap, param) -#define va_arg(ap, type) __builtin_va_arg(ap, type) -#define va_copy(dest, src) __builtin_va_copy(dest, src) -#define va_end(ap) __builtin_va_end(ap) - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDARG_H diff --git a/share/mrdocs/headers/libc-stubs/stdatomic.h b/share/mrdocs/headers/libc-stubs/stdatomic.h deleted file mode 100644 index 33c06a573..000000000 --- a/share/mrdocs/headers/libc-stubs/stdatomic.h +++ /dev/null @@ -1,134 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDATOMIC_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDATOMIC_H - -#include "stddef.h" -#include "stdint.h" - -// Macro constants indicating lock-free atomic types -#define ATOMIC_BOOL_LOCK_FREE 1 -#define ATOMIC_CHAR_LOCK_FREE 1 -#define ATOMIC_CHAR16_T_LOCK_FREE 1 -#define ATOMIC_CHAR32_T_LOCK_FREE 1 -#define ATOMIC_WCHAR_T_LOCK_FREE 1 -#define ATOMIC_SHORT_LOCK_FREE 1 -#define ATOMIC_INT_LOCK_FREE 1 -#define ATOMIC_LONG_LOCK_FREE 1 -#define ATOMIC_LLONG_LOCK_FREE 1 -#define ATOMIC_POINTER_LOCK_FREE 1 - -// Function declarations for atomic operations -bool atomic_is_lock_free(const volatile void *obj); - -void atomic_store(volatile void *obj, int val); -void atomic_store_explicit(volatile void *obj, int val, int order); - -int atomic_load(const volatile void *obj); -int atomic_load_explicit(const volatile void *obj, int order); - -int atomic_exchange(volatile void *obj, int val); -int atomic_exchange_explicit(volatile void *obj, int val, int order); - -bool atomic_compare_exchange_strong(volatile void *obj, int *expected, int desired); -bool atomic_compare_exchange_strong_explicit(volatile void *obj, int *expected, int desired, int success, int failure); -bool atomic_compare_exchange_weak(volatile void *obj, int *expected, int desired); -bool atomic_compare_exchange_weak_explicit(volatile void *obj, int *expected, int desired, int success, int failure); - -int atomic_fetch_add(volatile void *obj, int arg); -int atomic_fetch_add_explicit(volatile void *obj, int arg, int order); - -int atomic_fetch_sub(volatile void *obj, int arg); -int atomic_fetch_sub_explicit(volatile void *obj, int arg, int order); - -int atomic_fetch_or(volatile void *obj, int arg); -int atomic_fetch_or_explicit(volatile void *obj, int arg, int order); - -int atomic_fetch_xor(volatile void *obj, int arg); -int atomic_fetch_xor_explicit(volatile void *obj, int arg, int order); - -int atomic_fetch_and(volatile void *obj, int arg); -int atomic_fetch_and_explicit(volatile void *obj, int arg, int order); - -// Struct and function declarations for atomic_flag -typedef struct { - bool _Value; -} atomic_flag; - -bool atomic_flag_test_and_set(volatile atomic_flag *obj); -bool atomic_flag_test_and_set_explicit(volatile atomic_flag *obj, int order); - -void atomic_flag_clear(volatile atomic_flag *obj); -void atomic_flag_clear_explicit(volatile atomic_flag *obj, int order); - -// Function declarations for initialization -void atomic_init(volatile void *obj, int val); - -#define ATOMIC_VAR_INIT(value) (value) -#define ATOMIC_FLAG_INIT {0} - -// Enum for memory_order -typedef enum { - memory_order_relaxed, - memory_order_consume, - memory_order_acquire, - memory_order_release, - memory_order_acq_rel, - memory_order_seq_cst -} memory_order; - -// Function declarations for memory synchronization -#define kill_dependency(y) (y) - -void atomic_thread_fence(memory_order order); -void atomic_signal_fence(memory_order order); - -// Convenience type aliases -typedef _Atomic bool atomic_bool; -typedef _Atomic char atomic_char; -typedef _Atomic signed char atomic_schar; -typedef _Atomic unsigned char atomic_uchar; -typedef _Atomic short atomic_short; -typedef _Atomic unsigned short atomic_ushort; -typedef _Atomic int atomic_int; -typedef _Atomic unsigned int atomic_uint; -typedef _Atomic long atomic_long; -typedef _Atomic unsigned long atomic_ulong; -typedef _Atomic long long atomic_llong; -typedef _Atomic unsigned long long atomic_ullong; -typedef _Atomic char8_t atomic_char8_t; -typedef _Atomic char16_t atomic_char16_t; -typedef _Atomic char32_t atomic_char32_t; -typedef _Atomic wchar_t atomic_wchar_t; -typedef _Atomic int_least8_t atomic_int_least8_t; -typedef _Atomic uint_least8_t atomic_uint_least8_t; -typedef _Atomic int_least16_t atomic_int_least16_t; -typedef _Atomic uint_least16_t atomic_uint_least16_t; -typedef _Atomic int_least32_t atomic_int_least32_t; -typedef _Atomic uint_least32_t atomic_uint_least32_t; -typedef _Atomic int_least64_t atomic_int_least64_t; -typedef _Atomic uint_least64_t atomic_uint_least64_t; -typedef _Atomic int_fast8_t atomic_int_fast8_t; -typedef _Atomic uint_fast8_t atomic_uint_fast8_t; -typedef _Atomic int_fast16_t atomic_int_fast16_t; -typedef _Atomic uint_fast16_t atomic_uint_fast16_t; -typedef _Atomic int_fast32_t atomic_int_fast32_t; -typedef _Atomic uint_fast32_t atomic_uint_fast32_t; -typedef _Atomic int_fast64_t atomic_int_fast64_t; -typedef _Atomic uint_fast64_t atomic_uint_fast64_t; -typedef _Atomic intptr_t atomic_intptr_t; -typedef _Atomic uintptr_t atomic_uintptr_t; -typedef _Atomic size_t atomic_size_t; -typedef _Atomic ptrdiff_t atomic_ptrdiff_t; -typedef _Atomic intmax_t atomic_intmax_t; -typedef _Atomic uintmax_t atomic_uintmax_t; - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDATOMIC_H diff --git a/share/mrdocs/headers/libc-stubs/stdbit.h b/share/mrdocs/headers/libc-stubs/stdbit.h deleted file mode 100644 index 4384231c0..000000000 --- a/share/mrdocs/headers/libc-stubs/stdbit.h +++ /dev/null @@ -1,39 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDBIT_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDBIT_H - -// Function declarations for bit manipulation -int popcount(unsigned int x); -int popcountl(unsigned long x); -int popcountll(unsigned long long x); - -int clz(unsigned int x); -int clzl(unsigned long x); -int clzll(unsigned long long x); - -int ctz(unsigned int x); -int ctzl(unsigned long x); -int ctzll(unsigned long long x); - -int ffs(unsigned int x); -int ffsl(unsigned long x); -int ffsll(unsigned long long x); - -unsigned int rotr(unsigned int x, int n); -unsigned long rotrl(unsigned long x, int n); -unsigned long long rotrll(unsigned long long x, int n); - -unsigned int rotl(unsigned int x, int n); -unsigned long rotll(unsigned long x, int n); -unsigned long long rotlll(unsigned long long x, int n); - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDBIT_H diff --git a/share/mrdocs/headers/libc-stubs/stdbool.h b/share/mrdocs/headers/libc-stubs/stdbool.h deleted file mode 100644 index 7dffbc951..000000000 --- a/share/mrdocs/headers/libc-stubs/stdbool.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDBOOL_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDBOOL_H - -// Convenience macros for boolean values -#define bool _Bool -#define true 1 -#define false 0 - -// Macro constant indicating the presence of boolean features -#define __bool_true_false_are_defined 1 - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDBOOL_H diff --git a/share/mrdocs/headers/libc-stubs/stdckdint.h b/share/mrdocs/headers/libc-stubs/stdckdint.h deleted file mode 100644 index 73ffc9b7c..000000000 --- a/share/mrdocs/headers/libc-stubs/stdckdint.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDCKDINT_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDCKDINT_H - -// Macros for performing checked integer arithmetic -#define ckd_add(result, a, b) __builtin_add_overflow(a, b, result) -#define ckd_sub(result, a, b) __builtin_sub_overflow(a, b, result) -#define ckd_mul(result, a, b) __builtin_mul_overflow(a, b, result) - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDCKDINT_H diff --git a/share/mrdocs/headers/libc-stubs/stddef.h b/share/mrdocs/headers/libc-stubs/stddef.h deleted file mode 100644 index 19219850e..000000000 --- a/share/mrdocs/headers/libc-stubs/stddef.h +++ /dev/null @@ -1,150 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDDEF_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDDEF_H - -// size_t -#ifndef _SIZE_T -#define _SIZE_T -#ifdef __SIZE_TYPE__ -typedef __SIZE_TYPE__ size_t; -#else -typedef unsigned long long size_t; -#endif -#endif - -// size_t -#ifndef _SIZE_T -#define _SIZE_T -#ifdef __SIZE_TYPE__ -typedef __SIZE_TYPE__ rsize_t; -#else -typedef unsigned long long rsize_t; -#endif -#endif - -// ptrdiff_t -#ifndef _PTRDIFF_T -#define _PTRDIFF_T -#ifdef __PTRDIFF_TYPE__ -typedef __PTRDIFF_TYPE__ ptrdiff_t; -#else -typedef long long ptrdiff_t; -#endif -#endif - -// rsize_t -#if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 -#define __no_need_rsize_t -#endif - -#ifndef __no_need_rsize_t -typedef size_t rsize_t; -#else -#undef __no_need_rsize_t -#endif - -// nullptr_t -#ifdef __cplusplus -#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED) -namespace std { - typedef decltype(nullptr) nullptr_t; -} -using ::std::nullptr_t; -#endif -#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L -typedef typeof(nullptr) nullptr_t; -#endif - -// NULL -#ifdef __cplusplus -#if !defined(__MINGW32__) && !defined(_MSC_VER) -#define NULL __null -#else -#define NULL 0 -#endif -#else -#define NULL ((void*)0) -#endif - -// wint_t -#ifndef _WINT_T -#define _WINT_T -#ifdef __WINT_TYPE__ -typedef __WINT_TYPE__ wint_t; -#else -typedef unsigned int wint_t; -#endif -#endif - -// errno_t -using errno_t = int; - -// max_align_t -#if defined(_MSC_VER) -typedef double max_align_t; -#elif defined(__APPLE__) -typedef long double max_align_t; -#else -#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ - (defined(__cplusplus) && __cplusplus >= 201103L) -#define __no_need_max_align_t -#endif -#ifndef __no_need_max_align_t -// Define 'max_align_t' to match the GCC definition. -typedef struct { - long long __clang_max_align_nonce1 - __attribute__((__aligned__(__alignof__(long long)))); - long double __clang_max_align_nonce2 - __attribute__((__aligned__(__alignof__(long double)))); -} max_align_t; -#endif -#endif - -// offsetof_t -#define offsetof(t, d) __builtin_offsetof(t, d) - -// unreachable -#ifndef unreachable -#define unreachable() (__builtin_unreachable()) -#endif - -// wchar_t -#if !defined(__cplusplus) || (defined(_MSC_VER) && !_NATIVE_WCHAR_T_DEFINED) -#if !defined(_WCHAR_T) || \ -(__has_feature(modules) && !__building_module(_Builtin_stddef)) -#define _WCHAR_T -#ifdef _MSC_EXTENSIONS -#define _WCHAR_T_DEFINED -#endif -typedef __WCHAR_TYPE__ wchar_t; -#endif -#endif - -// tm -struct tm { - int tm_sec; - int tm_min; - int tm_hour; - int tm_mday; - int tm_mon; - int tm_year; - int tm_wday; - int tm_yday; - int tm_isdst; -}; - -// FILE -typedef struct { - int _file; -} FILE; - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDDEF_H diff --git a/share/mrdocs/headers/libc-stubs/stdint.h b/share/mrdocs/headers/libc-stubs/stdint.h deleted file mode 100644 index 35d9c6fb6..000000000 --- a/share/mrdocs/headers/libc-stubs/stdint.h +++ /dev/null @@ -1,145 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDINT_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDINT_H - -#include "stddef.h" - -using uintmax_t = unsigned long long; -using uintptr_t = unsigned long long; -using int8_t = signed char; -using int16_t = short; -using int32_t = int; -using int64_t = long long; -using int_fast8_t = signed char; -using int_fast16_t = int; -using int_fast32_t = int; -using int_fast64_t = long long; -using int_least8_t = signed char; -using int_least16_t = short; -using int_least32_t = int; -using int_least64_t = long long; -using intmax_t = long long; -using intptr_t = long long; -using uint8_t = unsigned char; -using uint16_t = unsigned short; -using uint32_t = unsigned int; -using uint64_t = unsigned long long; -using uint_fast8_t = unsigned char; -using uint_fast16_t = unsigned int; -using uint_fast32_t = unsigned int; -using uint_fast64_t = unsigned long long; -using uint_least8_t = unsigned char; -using uint_least16_t = unsigned short; -using uint_least32_t = unsigned int; -using uint_least64_t = unsigned long long; -using uintmax_t = unsigned long long; -using uintptr_t = unsigned long long; - -#define INT8_WIDTH 8 -#define INT16_WIDTH 16 -#define INT32_WIDTH 32 -#define INT64_WIDTH 64 -#define INT_FAST8_WIDTH 8 -#define INT_FAST16_WIDTH 32 -#define INT_FAST32_WIDTH 32 -#define INT_FAST64_WIDTH 64 -#define INT_LEAST8_WIDTH 8 -#define INT_LEAST16_WIDTH 16 -#define INT_LEAST32_WIDTH 32 -#define INT_LEAST64_WIDTH 64 -#define INTMAX_WIDTH 64 -#define INTPTR_WIDTH 64 -#define INT8_MIN -128 -#define INT16_MIN -32768 -#define INT32_MIN -2147483648 -#define INT64_MIN -9223372036854775808 -#define INT_FAST8_MIN -128 -#define INT_FAST16_MIN -2147483648 -#define INT_FAST32_MIN -2147483648 -#define INT_FAST64_MIN -9223372036854775808 -#define INT_LEAST8_MIN -128 -#define INT_LEAST16_MIN -32768 -#define INT_LEAST32_MIN -2147483648 -#define INT_LEAST64_MIN -9223372036854775808 -#define INTMAX_MIN -9223372036854775808 -#define INTPTR_MIN -9223372036854775808 -#define INT8_MAX 127 -#define INT16_MAX 32767 -#define INT32_MAX 2147483647 -#define INT64_MAX 9223372036854775807 -#define INT_FAST8_MAX 127 -#define INT_FAST16_MAX 2147483647 -#define INT_FAST32_MAX 2147483647 -#define INT_FAST64_MAX 9223372036854775807 -#define INT_LEAST8_MAX 127 -#define INT_LEAST16_MAX 32767 -#define INT_LEAST32_MAX 2147483647 -#define INT_LEAST64_MAX 9223372036854775807 -#define INTMAX_MAX 9223372036854775807 -#define INTPTR_MAX 9223372036854775807 - -#define UINT8_WIDTH 8 -#define UINT16_WIDTH 16 -#define UINT32_WIDTH 32 -#define UINT64_WIDTH 64 -#define UINT_FAST8_WIDTH 8 -#define UINT_FAST16_WIDTH 32 -#define UINT_FAST32_WIDTH 32 -#define UINT_FAST64_WIDTH 64 -#define UINT_LEAST8_WIDTH 8 -#define UINT_LEAST16_WIDTH 16 -#define UINT_LEAST32_WIDTH 32 -#define UINT_LEAST64_WIDTH 64 -#define UINTMAX_WIDTH 64 -#define UINTPTR_WIDTH 64 -#define UINT8_MAX 255 -#define UINT16_MAX 65535 -#define UINT32_MAX 4294967295 -#define UINT64_MAX 18446744073709551615 -#define UINT_FAST8_MAX 255 -#define UINT_FAST16_MAX 4294967295 -#define UINT_FAST32_MAX 4294967295 -#define UINT_FAST64_MAX 18446744073709551615 -#define UINT_LEAST8_MAX 255 -#define UINT_LEAST16_MAX 65535 -#define UINT_LEAST32_MAX 4294967295 -#define UINT_LEAST64_MAX 18446744073709551615 -#define UINTMAX_MAX 18446744073709551615 -#define UINTPTR_MAX 18446744073709551615 - -#define PTRDIFF_WIDTH 64 -#define PTRDIFF_MIN -9223372036854775808 -#define PTRDIFF_MAX 9223372036854775807 -#define SIZE_WIDTH 64 -#define SIZE_MAX 18446744073709551615 -#define SIG_ATOMIC_WIDTH 32 -#define SIG_ATOMIC_MIN -2147483648 -#define SIG_ATOMIC_MAX 2147483647 -#define WINT_WIDTH 32 -#define WINT_MIN -2147483648 -#define WINT_MAX 2147483647 -#define WCHAR_WIDTH 32 -#define WCHAR_MIN -2147483648 -#define WCHAR_MAX 2147483647 - -#define INT8_C(value) value -#define INT16_C(value) value -#define INT32_C(value) value -#define INT64_C(value) value##LL -#define INTMAX_C(value) value##LL -#define UINT8_C(value) value -#define UINT16_C(value) value -#define UINT32_C(value) value -#define UINT64_C(value) value##ULL -#define UINTMAX_C(value) value##ULL - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDINT_H diff --git a/share/mrdocs/headers/libc-stubs/stdio.h b/share/mrdocs/headers/libc-stubs/stdio.h deleted file mode 100644 index 03eae17ab..000000000 --- a/share/mrdocs/headers/libc-stubs/stdio.h +++ /dev/null @@ -1,150 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDIO_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDIO_H - -#include "stddef.h" -#include "stdarg.h" - -typedef long fpos_t; - -#define stdin ((FILE *)0) -#define stdout ((FILE *)1) -#define stderr ((FILE *)2) - -FILE* fopen(const char* filename, const char* mode); -FILE* fopen_s(FILE** file, const char* filename, const char* mode); -FILE* freopen(const char* filename, const char* mode, FILE* stream); -FILE* freopen_s(FILE** file, const char* filename, const char* mode, FILE* stream); -int fclose(FILE* stream); -int fflush(FILE* stream); -void setbuf(FILE* stream, char* buffer); -int setvbuf(FILE* stream, char* buffer, int mode, size_t size); -int fwide(FILE* stream, int mode); - -size_t fread(void* ptr, size_t size, size_t count, FILE* stream); -size_t fwrite(const void* ptr, size_t size, size_t count, FILE* stream); - -int fgetc(FILE* stream); -int getc(FILE* stream); -char* fgets(char* str, int n, FILE* stream); -int fputc(int c, FILE* stream); -int putc(int c, FILE* stream); -int fputs(const char* str, FILE* stream); -int getchar(void); -char* gets(char* str); -int gets_s(char* str, rsize_t n); -int putchar(int c); -int puts(const char* str); -int ungetc(int c, FILE* stream); - -wint_t fgetwc(FILE* stream); -wint_t getwc(FILE* stream); -wchar_t* fgetws(wchar_t* str, int n, FILE* stream); -wint_t fputwc(wint_t wc, FILE* stream); -wint_t putwc(wint_t wc, FILE* stream); -int fputws(const wchar_t* str, FILE* stream); -wint_t getwchar(void); -wint_t putwchar(wint_t wc); -wint_t ungetwc(wint_t wc, FILE* stream); - -int scanf(const char* format, ...); -int fscanf(FILE* stream, const char* format, ...); -int sscanf(const char* str, const char* format, ...); -int scanf_s(const char* format, ...); -int fscanf_s(FILE* stream, const char* format, ...); -int sscanf_s(const char* str, const char* format, ...); -int vscanf(const char* format, va_list arg); -int vfscanf(FILE* stream, const char* format, va_list arg); -int vsscanf(const char* str, const char* format, va_list arg); -int vscanf_s(const char* format, va_list arg); -int vfscanf_s(FILE* stream, const char* format, va_list arg); -int vsscanf_s(const char* str, const char* format, va_list arg); - -int printf(const char* format, ...); -int fprintf(FILE* stream, const char* format, ...); -int sprintf(char* str, const char* format, ...); -int snprintf(char* str, size_t size, const char* format, ...); -int printf_s(const char* format, ...); -int fprintf_s(FILE* stream, const char* format, ...); -int sprintf_s(char* str, size_t size, const char* format, ...); -int snprintf_s(char* str, size_t size, const char* format, ...); -int vprintf(const char* format, va_list arg); -int vfprintf(FILE* stream, const char* format, va_list arg); -int vsprintf(char* str, const char* format, va_list arg); -int vsnprintf(char* str, size_t size, const char* format, va_list arg); -int vprintf_s(const char* format, va_list arg); -int vfprintf_s(FILE* stream, const char* format, va_list arg); -int vsprintf_s(char* str, size_t size, const char* format, va_list arg); -int vsnprintf_s(char* str, size_t size, const char* format, va_list arg); - -int wscanf(const wchar_t* format, ...); -int fwscanf(FILE* stream, const wchar_t* format, ...); -int swscanf(const wchar_t* str, const wchar_t* format, ...); -int wscanf_s(const wchar_t* format, ...); -int fwscanf_s(FILE* stream, const wchar_t* format, ...); -int swscanf_s(const wchar_t* str, const wchar_t* format, ...); -int vwscanf(const wchar_t* format, va_list arg); -int vfwscanf(FILE* stream, const wchar_t* format, va_list arg); -int vswscanf(const wchar_t* str, const wchar_t* format, va_list arg); -int vwscanf_s(const wchar_t* format, va_list arg); -int vfwscanf_s(FILE* stream, const wchar_t* format, va_list arg); -int vswscanf_s(const wchar_t* str, const wchar_t* format, va_list arg); - -int wprintf(const wchar_t* format, ...); -int fwprintf(FILE* stream, const wchar_t* format, ...); -int swprintf(wchar_t* str, const wchar_t* format, ...); -int wprintf_s(const wchar_t* format, ...); -int fwprintf_s(FILE* stream, const wchar_t* format, ...); -int swprintf_s(wchar_t* str, size_t size, const wchar_t* format, ...); -int snwprintf_s(wchar_t* str, size_t size, const wchar_t* format, ...); -int vwprintf(const wchar_t* format, va_list arg); -int vfwprintf(FILE* stream, const wchar_t* format, va_list arg); -int vswprintf(wchar_t* str, const wchar_t* format, va_list arg); -int vwprintf_s(const wchar_t* format, va_list arg); -int vfwprintf_s(FILE* stream, const wchar_t* format, va_list arg); -int vswprintf_s(wchar_t* str, size_t size, const wchar_t* format, va_list arg); -int vsnwprintf_s(wchar_t* str, size_t size, const wchar_t* format, va_list arg); - -long ftell(FILE* stream); -int fgetpos(FILE* stream, fpos_t* pos); -int fseek(FILE* stream, long offset, int whence); -int fsetpos(FILE* stream, const fpos_t* pos); -void rewind(FILE* stream); - -void clearerr(FILE* stream); -int feof(FILE* stream); -int ferror(FILE* stream); -void perror(const char* str); - -int remove(const char* filename); -int rename(const char* old_filename, const char* new_filename); -FILE* tmpfile(void); -FILE* tmpfile_s(FILE** file); -char* tmpnam(char* str); -char* tmpnam_s(char* str, rsize_t size); - -#define EOF (-1) -#define FOPEN_MAX 20 -#define FILENAME_MAX 260 -#define BUFSIZ 512 -#define _IOFBF 0 -#define _IOLBF 1 -#define _IONBF 2 -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 -#define TMP_MAX 238328 -#define TMP_MAX_S 238328 -#define L_tmpnam 20 -#define L_tmpnam_s 20 - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDIO_H diff --git a/share/mrdocs/headers/libc-stubs/stdlib.h b/share/mrdocs/headers/libc-stubs/stdlib.h deleted file mode 100644 index 7ad2df833..000000000 --- a/share/mrdocs/headers/libc-stubs/stdlib.h +++ /dev/null @@ -1,55 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDLIB_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDLIB_H - -#include "stdint.h" -#include "stddef.h" -#include "malloc.h" - -struct div_t { int quot; int rem; }; -struct ldiv_t { long quot; long rem; }; -struct lldiv_t { long long quot; long long rem; }; -struct imaxdiv_t { intmax_t quot; intmax_t rem; }; - -#define MB_CUR_MAX 1 - -#define RSIZE_MAX (SIZE_MAX >> 1) - -// Program termination -void abort(void); -void exit(int status); -void quick_exit(int status); -void _Exit(int status); -int atexit(void (*func)(void)); -int at_quick_exit(void (*func)(void)); - -#define EXIT_SUCCESS 0 -#define EXIT_FAILURE 1 - -// Communicating with the environment -int system(const char *command); -char* getenv(const char *name); -errno_t getenv_s(size_t *len, char *value, rsize_t maxsize, const char *name); - -// Memory alignment query -size_t memalignment(const void *ptr); - -typedef void (*constraint_handler_t)(const char* __restrict msg, void* __restrict ptr, errno_t error); -constraint_handler_t set_constraint_handler_s(constraint_handler_t handler); - -void abort_handler_s( const char * __restrict msg, void * __restrict ptr, errno_t error ); - -void ignore_handler_s( const char * __restrict msg, void * __restrict ptr, errno_t error ); - -void *malloc( size_t size ); - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDLIB_H diff --git a/share/mrdocs/headers/libc-stubs/stdnoreturn.h b/share/mrdocs/headers/libc-stubs/stdnoreturn.h deleted file mode 100644 index 71073b5fa..000000000 --- a/share/mrdocs/headers/libc-stubs/stdnoreturn.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDNORETURN_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDNORETURN_H - -// _Noreturn function specifier is deprecated. [[noreturn]] attribute should be used instead. -// The macro noreturn is also deprecated. - -#define _Noreturn [[noreturn]] -#define noreturn _Noreturn - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_STDNORETURN_H diff --git a/share/mrdocs/headers/libc-stubs/string.h b/share/mrdocs/headers/libc-stubs/string.h deleted file mode 100644 index c0d7ae7bc..000000000 --- a/share/mrdocs/headers/libc-stubs/string.h +++ /dev/null @@ -1,61 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_STRING_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_STRING_H - -#include "stddef.h" - -// String manipulation -char* strcpy(char* dest, const char* src); -errno_t strcpy_s(char* dest, rsize_t destsz, const char* src); -char* strncpy(char* dest, const char* src, size_t n); -errno_t strncpy_s(char* dest, rsize_t destsz, const char* src, rsize_t n); -char* strcat(char* dest, const char* src); -errno_t strcat_s(char* dest, rsize_t destsz, const char* src); -char* strncat(char* dest, const char* src, size_t n); -errno_t strncat_s(char* dest, rsize_t destsz, const char* src, rsize_t n); -size_t strxfrm(char* dest, const char* src, size_t n); -char* strdup(const char* s); -char* strndup(const char* s, size_t n); - -// String examination -size_t strlen(const char* s); -size_t strnlen_s(const char* s, rsize_t maxsize); -int strcmp(const char* s1, const char* s2); -int strncmp(const char* s1, const char* s2, size_t n); -int strcoll(const char* s1, const char* s2); -char* strchr(const char* s, int c); -char* strrchr(const char* s, int c); -size_t strspn(const char* s, const char* accept); -size_t strcspn(const char* s, const char* reject); -char* strpbrk(const char* s, const char* accept); -char* strstr(const char* haystack, const char* needle); -char* strtok(char* str, const char* delim); -errno_t strtok_s(char* str, rsize_t* strmax, const char* delim, char** context); - -// Character array manipulation -void* memchr(const void* s, int c, size_t n); -int memcmp(const void* s1, const void* s2, size_t n); -void* memset(void* s, int c, size_t n); -void* memset_explicit(void* s, int c, size_t n); -errno_t memset_s(void* s, rsize_t smax, int c, rsize_t n); -void* memcpy(void* dest, const void* src, size_t n); -errno_t memcpy_s(void* dest, rsize_t destsz, const void* src, rsize_t count); -void* memmove(void* dest, const void* src, size_t n); -errno_t memmove_s(void* dest, rsize_t destsz, const void* src, rsize_t count); -void* memccpy(void* dest, const void* src, int c, size_t n); - -// Miscellaneous -char* strerror(int errnum); -errno_t strerror_s(char* buf, rsize_t bufsz, int errnum); -size_t strerrorlen_s(int errnum); - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_STRING_H diff --git a/share/mrdocs/headers/libc-stubs/sys/types.h b/share/mrdocs/headers/libc-stubs/sys/types.h deleted file mode 100644 index b945bbbac..000000000 --- a/share/mrdocs/headers/libc-stubs/sys/types.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_SYS_TYPES_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_SYS_TYPES_H - -typedef long ssize_t; -typedef unsigned int uid_t; -typedef unsigned int gid_t; -typedef long off_t; -typedef int pid_t; - -typedef unsigned int useconds_t; - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_SYS_TYPES_H diff --git a/share/mrdocs/headers/libc-stubs/tgmath.h b/share/mrdocs/headers/libc-stubs/tgmath.h deleted file mode 100644 index 488f4d9f4..000000000 --- a/share/mrdocs/headers/libc-stubs/tgmath.h +++ /dev/null @@ -1,372 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_TGMATH_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_TGMATH_H - -#include "math.h" -#include "complex.h" - -// Type-generic macros for complex/real functions -#define fabs(x) _Generic((x), \ - float: fabsf, \ - double: fabs, \ - long double: fabsl, \ - float _Complex: cabsf, \ - double _Complex: cabs, \ - long double _Complex: cabsl)(x) - -#define exp(x) _Generic((x), \ - float: expf, \ - double: exp, \ - long double: expl, \ - float _Complex: cexpf, \ - double _Complex: cexp, \ - long double _Complex: cexpl)(x) - -#define log(x) _Generic((x), \ - float: logf, \ - double: log, \ - long double: logl, \ - float _Complex: clogf, \ - double _Complex: clog, \ - long double _Complex: clogl)(x) - -#define pow(x, y) _Generic((x), \ - float: powf, \ - double: pow, \ - long double: powl, \ - float _Complex: cpowf, \ - double _Complex: cpow, \ - long double _Complex: cpowl)(x, y) - -#define sqrt(x) _Generic((x), \ - float: sqrtf, \ - double: sqrt, \ - long double: sqrtl, \ - float _Complex: csqrtf, \ - double _Complex: csqrt, \ - long double _Complex: csqrtl)(x) - -#define sin(x) _Generic((x), \ - float: sinf, \ - double: sin, \ - long double: sinl, \ - float _Complex: csinf, \ - double _Complex: csin, \ - long double _Complex: csinl)(x) - -#define cos(x) _Generic((x), \ - float: cosf, \ - double: cos, \ - long double: cosl, \ - float _Complex: ccosf, \ - double _Complex: ccos, \ - long double _Complex: ccosl)(x) - -#define tan(x) _Generic((x), \ - float: tanf, \ - double: tan, \ - long double: tanl, \ - float _Complex: ctanf, \ - double _Complex: ctan, \ - long double _Complex: ctanl)(x) - -#define asin(x) _Generic((x), \ - float: asinf, \ - double: asin, \ - long double: asinl, \ - float _Complex: casinf, \ - double _Complex: casin, \ - long double _Complex: casinl)(x) - -#define acos(x) _Generic((x), \ - float: acosf, \ - double: acos, \ - long double: acosl, \ - float _Complex: cacosf, \ - double _Complex: cacos, \ - long double _Complex: cacosl)(x) - -#define atan(x) _Generic((x), \ - float: atanf, \ - double: atan, \ - long double: atanl, \ - float _Complex: catanf, \ - double _Complex: catan, \ - long double _Complex: catanl)(x) - -#define sinh(x) _Generic((x), \ - float: sinhf, \ - double: sinh, \ - long double: sinhl, \ - float _Complex: csinhf, \ - double _Complex: csinh, \ - long double _Complex: csinhl)(x) - -#define cosh(x) _Generic((x), \ - float: coshf, \ - double: cosh, \ - long double: coshl, \ - float _Complex: ccoshf, \ - double _Complex: ccosh, \ - long double _Complex: ccoshl)(x) - -#define tanh(x) _Generic((x), \ - float: tanhf, \ - double: tanh, \ - long double: tanhl, \ - float _Complex: ctanhf, \ - double _Complex: ctanh, \ - long double _Complex: ctanhl)(x) - -#define asinh(x) _Generic((x), \ - float: asinhf, \ - double: asinh, \ - long double: asinhl, \ - float _Complex: casinhf, \ - double _Complex: casinh, \ - long double _Complex: casinhl)(x) - -#define acosh(x) _Generic((x), \ - float: acoshf, \ - double: acosh, \ - long double: acoshl, \ - float _Complex: cacoshf, \ - double _Complex: cacosh, \ - long double _Complex: cacoshl)(x) - -#define atanh(x) _Generic((x), \ - float: atanhf, \ - double: atanh, \ - long double: atanhl, \ - float _Complex: catanhf, \ - double _Complex: catanh, \ - long double _Complex: catanhl)(x) - -// Type-generic macros for real-only functions -#define atan2(x, y) _Generic((x), \ - float: atan2f, \ - double: atan2, \ - long double: atan2l)(x, y) - -#define cbrt(x) _Generic((x), \ - float: cbrtf, \ - double: cbrt, \ - long double: cbrtl)(x) - -#define ceil(x) _Generic((x), \ - float: ceilf, \ - double: ceil, \ - long double: ceill)(x) - -#define copysign(x, y) _Generic((x), \ - float: copysignf, \ - double: copysign, \ - long double: copysignl)(x, y) - -#define erf(x) _Generic((x), \ - float: erff, \ - double: erf, \ - long double: erfl)(x) - -#define erfc(x) _Generic((x), \ - float: erfcf, \ - double: erfc, \ - long double: erfcl)(x) - -#define exp2(x) _Generic((x), \ - float: exp2f, \ - double: exp2, \ - long double: exp2l)(x) - -#define expm1(x) _Generic((x), \ - float: expm1f, \ - double: expm1, \ - long double: expm1l)(x) - -#define fdim(x, y) _Generic((x), \ - float: fdimf, \ - double: fdim, \ - long double: fdiml)(x, y) - -#define floor(x) _Generic((x), \ - float: floorf, \ - double: floor, \ - long double: floorl)(x) - -#define fma(x, y, z) _Generic((x), \ - float: fmaf, \ - double: fma, \ - long double: fmal)(x, y, z) - -#define fmax(x, y) _Generic((x), \ - float: fmaxf, \ - double: fmax, \ - long double: fmaxl)(x, y) - -#define fmin(x, y) _Generic((x), \ - float: fminf, \ - double: fmin, \ - long double: fminl)(x, y) - -#define fmod(x, y) _Generic((x), \ - float: fmodf, \ - double: fmod, \ - long double: fmodl)(x, y) - -#define frexp(x, exp) _Generic((x), \ - float: frexpf, \ - double: frexp, \ - long double: frexpl)(x, exp) - -#define hypot(x, y) _Generic((x), \ - float: hypotf, \ - double: hypot, \ - long double: hypotl)(x, y) - -#define ilogb(x) _Generic((x), \ - float: ilogbf, \ - double: ilogb, \ - long double: ilogbl)(x) - -#define ldexp(x, exp) _Generic((x), \ - float: ldexpf, \ - double: ldexp, \ - long double: ldexpl)(x, exp) - -#define lgamma(x) _Generic((x), \ - float: lgammaf, \ - double: lgamma, \ - long double: lgammal)(x) - -#define llrint(x) _Generic((x), \ - float: llrintf, \ - double: llrint, \ - long double: llrintl)(x) - -#define llround(x) _Generic((x), \ - float: llroundf, \ - double: llround, \ - long double: llroundl)(x) - -#define log10(x) _Generic((x), \ - float: log10f, \ - double: log10, \ - long double: log10l)(x) - -#define log1p(x) _Generic((x), \ - float: log1pf, \ - double: log1p, \ - long double: log1pl)(x) - -#define log2(x) _Generic((x), \ - float: log2f, \ - double: log2, \ - long double: log2l)(x) - -#define logb(x) _Generic((x), \ - float: logbf, \ - double: logb, \ - long double: logbl)(x) - -#define lrint(x) _Generic((x), \ - float: lrintf, \ - double: lrint, \ - long double: lrintl)(x) - -#define lround(x) _Generic((x), \ - float: lroundf, \ - double: lround, \ - long double: lroundl)(x) - -#define nearbyint(x) _Generic((x), \ - float: nearbyintf, \ - double: nearbyint, \ - long double: nearbyintl)(x) - -#define nextafter(x, y) _Generic((x), \ - float: nextafterf, \ - double: nextafter, \ - long double: nextafterl)(x, y) - -#define nexttoward(x, y) _Generic((x), \ - float: nexttowardf, \ - double: nexttoward, \ - long double: nexttowardl)(x, y) - -#define remainder(x, y) _Generic((x), \ - float: remainderf, \ - double: remainder, \ - long double: remainderl)(x, y) - -#define remquo(x, y, quo) _Generic((x), \ - float: remquof, \ - double: remquo, \ - long double: remquol)(x, y, quo) - -#define rint(x) _Generic((x), \ - float: rintf, \ - double: rint, \ - long double: rintl)(x) - -#define round(x) _Generic((x), \ - float: roundf, \ - double: round, \ - long double: roundl)(x) - -#define scalbln(x, n) _Generic((x), \ - float: scalblnf, \ - double: scalbln, \ - long double: scalblnl)(x, n) - -#define scalbn(x, n) _Generic((x), \ - float: scalbnf, \ - double: scalbn, \ - long double: scalbnl)(x, n) - -#define tgamma(x) _Generic((x), \ - float: tgammaf, \ - double: tgamma, \ - long double: tgammal)(x) - -#define trunc(x) _Generic((x), \ - float: truncf, \ - double: trunc, \ - long double: truncl)(x) - -// Type-generic macros for complex-only functions -#define carg(x) _Generic((x), \ - float _Complex: cargf, \ - double _Complex: carg, \ - long double _Complex: cargl)(x) - -#define conj(x) _Generic((x), \ - float _Complex: conjf, \ - double _Complex: conj, \ - long double _Complex: conjl)(x) - -#define creal(x) _Generic((x), \ - float _Complex: crealf, \ - double _Complex: creal, \ - long double _Complex: creall)(x) - -#define cimag(x) _Generic((x), \ - float _Complex: cimagf, \ - double _Complex: cimag, \ - long double _Complex: cimagl)(x) - -#define cproj(x) _Generic((x), \ - float _Complex: cprojf, \ - double _Complex: cproj, \ - long double _Complex: cprojl)(x) - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_TGMATH_H - diff --git a/share/mrdocs/headers/libc-stubs/threads.h b/share/mrdocs/headers/libc-stubs/threads.h deleted file mode 100644 index 2e2ce4929..000000000 --- a/share/mrdocs/headers/libc-stubs/threads.h +++ /dev/null @@ -1,92 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_THREADS_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_THREADS_H - -#include "stdint.h" -#include "stddef.h" - -// Threads -typedef struct { - // Implementation-defined -} thrd_t; - -int thrd_create(thrd_t *thr, int (*func)(void *), void *arg); -int thrd_equal(thrd_t thr0, thrd_t thr1); -thrd_t thrd_current(void); -int thrd_sleep(const struct timespec *duration, struct timespec *remaining); -void thrd_yield(void); -_Noreturn void thrd_exit(int res); -int thrd_detach(thrd_t thr); -int thrd_join(thrd_t thr, int *res); - -#define thrd_success 0 -#define thrd_timedout 1 -#define thrd_busy 2 -#define thrd_nomem 3 -#define thrd_error 4 - -typedef int (*thrd_start_t)(void *); - -// Mutual exclusion -typedef struct { - // Implementation-defined -} mtx_t; - -int mtx_init(mtx_t *mtx, int type); -int mtx_lock(mtx_t *mtx); -int mtx_timedlock(mtx_t *mtx, const struct timespec *ts); -int mtx_trylock(mtx_t *mtx); -int mtx_unlock(mtx_t *mtx); -void mtx_destroy(mtx_t *mtx); - -#define mtx_plain 0 -#define mtx_recursive 1 -#define mtx_timed 2 - -// Call once -typedef struct { - // Implementation-defined -} once_flag; - -#define ONCE_FLAG_INIT {0} - -void call_once(once_flag *flag, void (*func)(void)); - -// Condition variables -typedef struct { - // Implementation-defined -} cnd_t; - -int cnd_init(cnd_t *cond); -int cnd_signal(cnd_t *cond); -int cnd_broadcast(cnd_t *cond); -int cnd_wait(cnd_t *cond, mtx_t *mtx); -int cnd_timedwait(cnd_t *cond, mtx_t *mtx, const struct timespec *ts); -void cnd_destroy(cnd_t *cond); - -// Thread-local storage -#define thread_local _Thread_local - -typedef void (*tss_dtor_t)(void *); -typedef struct { - // Implementation-defined -} tss_t; - -#define TSS_DTOR_ITERATIONS 4 - -int tss_create(tss_t *key, tss_dtor_t dtor); -void *tss_get(tss_t key); -int tss_set(tss_t key, void *val); -void tss_delete(tss_t key); - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_THREADS_H - diff --git a/share/mrdocs/headers/libc-stubs/time.h b/share/mrdocs/headers/libc-stubs/time.h deleted file mode 100644 index c0098d4ac..000000000 --- a/share/mrdocs/headers/libc-stubs/time.h +++ /dev/null @@ -1,50 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_TIME_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_TIME_H - -#include "stddef.h" - -// Types -typedef long time_t; -typedef long clock_t; - -struct timespec { - time_t tv_sec; - long tv_nsec; -}; - -// Functions -double difftime(time_t end, time_t beginning); -time_t time(time_t *timer); -clock_t clock(void); -int timespec_get(struct timespec *ts, int base); -int timespec_getres(struct timespec *ts, int base); - -char *asctime(const struct tm *timeptr); -errno_t asctime_s(char *buf, rsize_t bufsz, const struct tm *timeptr); -char *ctime(const time_t *timer); -errno_t ctime_s(char *buf, rsize_t bufsz, const time_t *timer); -size_t strftime(char *s, size_t max, const char *format, const struct tm *tm); -size_t wcsftime(wchar_t *wcs, size_t maxsize, const wchar_t *format, const struct tm *timeptr); - -struct tm *gmtime(const time_t *timer); -struct tm *gmtime_r(const time_t *timer, struct tm *result); -errno_t gmtime_s(struct tm *result, const time_t *timer); -struct tm *localtime(const time_t *timer); -struct tm *localtime_r(const time_t *timer, struct tm *result); -errno_t localtime_s(struct tm *result, const time_t *timer); -time_t mktime(struct tm *timeptr); - -// Constants -#define CLOCKS_PER_SEC 1000000 - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_TIME_H diff --git a/share/mrdocs/headers/libc-stubs/uchar.h b/share/mrdocs/headers/libc-stubs/uchar.h deleted file mode 100644 index 0876eab02..000000000 --- a/share/mrdocs/headers/libc-stubs/uchar.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_UCHAR_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_UCHAR_H - -#include "stddef.h" -#include "wchar.h" - -// Types -#ifndef __cpp_char8_t -typedef unsigned char char8_t; -#endif - -#ifndef __cpp_unicode_characters -typedef unsigned short char16_t; -typedef unsigned int char32_t; -#endif - -// Functions -size_t mbrtoc8(char8_t *pc8, const char *s, size_t n, mbstate_t *ps); -size_t c8rtomb(char *s, char8_t c8, mbstate_t *ps); -size_t mbrtoc16(char16_t *pc16, const char *s, size_t n, mbstate_t *ps); -size_t c16rtomb(char *s, char16_t c16, mbstate_t *ps); -size_t mbrtoc32(char32_t *pc32, const char *s, size_t n, mbstate_t *ps); -size_t c32rtomb(char *s, char32_t c32, mbstate_t *ps); - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_UCHAR_H diff --git a/share/mrdocs/headers/libc-stubs/unistd.h b/share/mrdocs/headers/libc-stubs/unistd.h deleted file mode 100644 index 63f6b4930..000000000 --- a/share/mrdocs/headers/libc-stubs/unistd.h +++ /dev/null @@ -1,251 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_UNISTD_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_UNISTD_H - -#include "stddef.h" -#include "stdint.h" -#include "sys/types.h" - -// access() -#define F_OK 0 -#define R_OK 4 -#define W_OK 2 -#define X_OK 1 - -// confstr() constants -#define _CS_PATH 1 -#define _CS_XBS5_ILP32_OFF32_CFLAGS 2 -#define _CS_XBS5_ILP32_OFF32_FLAGS 3 -#define _CS_XBS5_ILP32_OFF32_LIB 4 -#define _CS_XBS5_ILP32_OFF32_LINTFLAGS 5 -#define _CS_XBS5_ILP32_OFFBIG_CFLAGS 6 -#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS 7 -#define _CS_XBS5_ILP32_OFFBIG_LIBS 8 -#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS 9 -#define _CS_XBS5_LP64_OFF64_CFLAGS 10 -#define _CS_XBS5_LP64_OFF64_FLAGS 11 -#define _CS_XBS5_LP64_OFF64_LIB 12 -#define _CS_XBS5_LP64_OFF64_LINTFLAGS 13 -#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS 14 -#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS 15 -#define _CS_XBS5_LPBIG_OFFBIG_LIBS 16 -#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS 17 - -// lseek() constants -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 - -// sysconf() -#define _SC_2_C_BIND 1 -#define _SC_2_C_DEV 2 -#define _SC_2_C_VERSION 3 -#define _SC_2_FORT_DEV 4 -#define _SC_2_FORT_RUN 5 -#define _SC_2_LOCALEDEF 6 -#define _SC_2_SW_DEV 7 -#define _SC_2_UPE 8 -#define _SC_2_VERSION 9 -#define _SC_ARG_MAX 10 -#define _SC_AIO_LISTIO_MAX 11 -#define _SC_AIO_MAX 12 -#define _SC_AIO_PRIO_DELTA_MAX 13 -#define _SC_ASYNCHRONOUS_IO 14 -#define _SC_ATEXIT_MAX 15 -#define _SC_BC_BASE_MAX 16 -#define _SC_BC_DIM_MAX 17 -#define _SC_BC_SCALE_MAX 18 -#define _SC_BC_STRING_MAX 19 -#define _SC_CHILD_MAX 20 -#define _SC_CLK_TCK 21 -#define _SC_COLL_WEIGHTS_MAX 22 -#define _SC_DELAYTIMER_MAX 23 -#define _SC_EXPR_NEST_MAX 24 -#define _SC_FSYNC 25 -#define _SC_GETGR_R_SIZE_MAX 26 -#define _SC_GETPW_R_SIZE_MAX 27 -#define _SC_IOV_MAX 28 -#define _SC_JOB_CONTROL 29 -#define _SC_LINE_MAX 30 -#define _SC_LOGIN_NAME_MAX 31 -#define _SC_MAPPED_FILES 32 -#define _SC_MEMLOCK 33 -#define _SC_MEMLOCK_RANGE 34 -#define _SC_MEMORY_PROTECTION 35 -#define _SC_MESSAGE_PASSING 36 -#define _SC_MQ_OPEN_MAX 37 -#define _SC_MQ_PRIO_MAX 38 -#define _SC_NGROUPS_MAX 39 -#define _SC_OPEN_MAX 40 -#define _SC_PAGESIZE 41 -#define _SC_PAGE_SIZE _SC_PAGESIZE -#define _SC_PASS_MAX 42 -#define _SC_PRIORITIZED_IO 43 -#define _SC_PRIORITY_SCHEDULING 44 -#define _SC_RE_DUP_MAX 45 -#define _SC_REALTIME_SIGNALS 46 -#define _SC_RTSIG_MAX 47 -#define _SC_SAVED_IDS 48 -#define _SC_SEMAPHORES 49 -#define _SC_SEM_NSEMS_MAX 50 -#define _SC_SEM_VALUE_MAX 51 -#define _SC_SHARED_MEMORY_OBJECTS 52 -#define _SC_SIGQUEUE_MAX 53 -#define _SC_STREAM_MAX 54 -#define _SC_SYNCHRONIZED_IO 55 -#define _SC_THREADS 56 -#define _SC_THREAD_ATTR_STACKADDR 57 -#define _SC_THREAD_ATTR_STACKSIZE 58 -#define _SC_THREAD_DESTRUCTOR_ITERATIONS 59 -#define _SC_THREAD_KEYS_MAX 60 -#define _SC_THREAD_PRIORITY_SCHEDULING 61 -#define _SC_THREAD_PRIO_INHERIT 62 -#define _SC_THREAD_PRIO_PROTECT 63 -#define _SC_THREAD_PROCESS_SHARED 64 -#define _SC_THREAD_SAFE_FUNCTIONS 65 -#define _SC_THREAD_STACK_MIN 66 -#define _SC_THREAD_THREADS_MAX 67 -#define _SC_TIMERS 68 -#define _SC_TIMER_MAX 69 -#define _SC_TTY_NAME_MAX 70 -#define _SC_TZNAME_MAX 71 -#define _SC_VERSION 72 -#define _SC_XOPEN_VERSION 73 -#define _SC_XOPEN_CRYPT 74 -#define _SC_XOPEN_ENH_I18N 75 -#define _SC_XOPEN_SHM 76 -#define _SC_XOPEN_UNIX 77 -#define _SC_XOPEN_XCU_VERSION 78 -#define _SC_XOPEN_LEGACY 79 -#define _SC_XOPEN_REALTIME 80 -#define _SC_XOPEN_REALTIME_THREADS 81 -#define _SC_XBS5_ILP32_OFF32 82 -#define _SC_XBS5_ILP32_OFF 83 -#define _SC_XBS5_LP64_OFF64 84 -#define _SC_XBS5_LPBIG_OFFBIG 85 - -// lockf() constants -#define F_LOCK 1 -#define F_ULOCK 2 -#define F_TEST 3 -#define F_BLOCK 4 - -// pathconf() and fpathconf() constants -#define _PC_ASYNC_IO 1 -#define _PC_CHOWN_RESTRICTED 2 -#define _PC_FILESIZEBITS 3 -#define _PC_LINK_MAX 4 -#define _PC_MAX_CANON 5 -#define _PC_MAX_INPUT 6 -#define _PC_NAME_MAX 7 -#define _PC_NO_TRUNC 8 -#define _PC_PATH_MAX 9 -#define _PC_PIPE_BUF 10 -#define _PC_PRIO_IO 11 -#define _PC_SYNC_IO 12 -#define _PC_VDISABLE 13 - -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 - -int access(const char *, int); -unsigned int alarm(unsigned int); -int brk(void *); -int chdir(const char *); -int chroot(const char *); -int chown(const char *, uid_t, gid_t); -int close(int); -size_t confstr(int, char *, size_t); -char *crypt(const char *, const char *); -char *ctermid(char *); -char *cuserid(char *s); -int dup(int); -int dup2(int, int); -void encrypt(char[64], int); -int execl(const char *, const char *, ...); -int execle(const char *, const char *, ...); -int execlp(const char *, const char *, ...); -int execv(const char *, char *const []); -int execve(const char *, char *const [], char *const []); -int execvp(const char *, char *const []); -void _exit(int); -int fchown(int, uid_t, gid_t); -int fchdir(int); -int fdatasync(int); -pid_t fork(void); -long int fpathconf(int, int); -int fsync(int); -int ftruncate(int, off_t); -char *getcwd(char *, size_t); -int getdtablesize(void); -gid_t getegid(void); -uid_t geteuid(void); -gid_t getgid(void); -int getgroups(int, gid_t []); -long gethostid(void); -char *getlogin(void); -int getlogin_r(char *, size_t); -int getopt(int, char * const [], const char *); -int getpagesize(void); -char *getpass(const char *); -pid_t getpgid(pid_t); -pid_t getpgrp(void); -pid_t getpid(void); -pid_t getppid(void); -pid_t getsid(pid_t); -uid_t getuid(void); -char *getwd(char *); -int isatty(int); -int lchown(const char *, uid_t, gid_t); -int link(const char *, const char *); -int lockf(int, int, off_t); -off_t lseek(int, off_t, int); -int nice(int); -long int pathconf(const char *, int); -int pause(void); -int pipe(int [2]); -ssize_t pread(int, void *, size_t, off_t); -int pthread_atfork(void (*)(void), void (*)(void), - void(*)(void)); -ssize_t pwrite(int, const void *, size_t, off_t); -ssize_t read(int, void *, size_t); -int readlink(const char *, char *, size_t); -int rmdir(const char *); -void *sbrk(intptr_t); -int setgid(gid_t); -int setpgid(pid_t, pid_t); -pid_t setpgrp(void); -int setregid(gid_t, gid_t); -int setreuid(uid_t, uid_t); -pid_t setsid(void); -int setuid(uid_t); -unsigned int sleep(unsigned int); -void swab(const void *, void *, ssize_t); -int symlink(const char *, const char *); -void sync(void); -long int sysconf(int); -pid_t tcgetpgrp(int); -int tcsetpgrp(int, pid_t); -int truncate(const char *, off_t); -char *ttyname(int); -int ttyname_r(int, char *, size_t); -useconds_t ualarm(useconds_t, useconds_t); -int unlink(const char *); -int usleep(useconds_t); -pid_t vfork(void); -ssize_t write(int, const void *, size_t); - -extern char *optarg; -extern int optind, opterr, optopt; - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_UNISTD_H diff --git a/share/mrdocs/headers/libc-stubs/vcruntime_exception.h b/share/mrdocs/headers/libc-stubs/vcruntime_exception.h deleted file mode 100644 index 67cd84b7c..000000000 --- a/share/mrdocs/headers/libc-stubs/vcruntime_exception.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_VCRUNTIME_EXCEPTION_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_VCRUNTIME_EXCEPTION_H - -namespace std { - class exception { - public: - exception() noexcept; - exception( const exception& other ) noexcept; - virtual ~exception(); - exception& operator=( const exception& other ) noexcept; - virtual const char* what() const noexcept; - }; -} - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_VCRUNTIME_EXCEPTION_H diff --git a/share/mrdocs/headers/libc-stubs/vcruntime_typeinfo.h b/share/mrdocs/headers/libc-stubs/vcruntime_typeinfo.h deleted file mode 100644 index 739d226f9..000000000 --- a/share/mrdocs/headers/libc-stubs/vcruntime_typeinfo.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_VCRUNTIME_TYPEINFO_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_VCRUNTIME_TYPEINFO_H - -namespace std { -class type_info { -public: - virtual ~type_info(); - bool operator==(const type_info& rhs) const; - bool operator!=(const type_info& rhs) const; - bool before(const type_info& rhs) const; - const char* name() const; - size_t hash_code() const; - type_info(const type_info& rhs) = delete; - type_info& operator=(const type_info& rhs) = delete; -}; -} // namespace std - -#endif \ No newline at end of file diff --git a/share/mrdocs/headers/libc-stubs/wchar.h b/share/mrdocs/headers/libc-stubs/wchar.h deleted file mode 100644 index fc3049ffd..000000000 --- a/share/mrdocs/headers/libc-stubs/wchar.h +++ /dev/null @@ -1,70 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_WCHAR_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_WCHAR_H - -#include "stddef.h" -#include "stdint.h" - -// Conversions to numeric formats -long wcstol(const wchar_t *str, wchar_t **endptr, int base); -long long wcstoll(const wchar_t *str, wchar_t **endptr, int base); -unsigned long wcstoul(const wchar_t *str, wchar_t **endptr, int base); -unsigned long long wcstoull(const wchar_t *str, wchar_t **endptr, int base); -float wcstof(const wchar_t *str, wchar_t **endptr); -double wcstod(const wchar_t *str, wchar_t **endptr); -long double wcstold(const wchar_t *str, wchar_t **endptr); -intmax_t wcstoimax(const wchar_t *str, wchar_t **endptr, int base); -uintmax_t wcstoumax(const wchar_t *str, wchar_t **endptr, int base); - -// String manipulation -wchar_t *wcscpy(wchar_t *dest, const wchar_t *src); -errno_t wcscpy_s(wchar_t *dest, rsize_t destsz, const wchar_t *src); -wchar_t *wcsncpy(wchar_t *dest, const wchar_t *src, size_t n); -errno_t wcsncpy_s(wchar_t *dest, rsize_t destsz, const wchar_t *src, rsize_t count); -wchar_t *wcscat(wchar_t *dest, const wchar_t *src); -errno_t wcscat_s(wchar_t *dest, rsize_t destsz, const wchar_t *src); -wchar_t *wcsncat(wchar_t *dest, const wchar_t *src, size_t n); -errno_t wcsncat_s(wchar_t *dest, rsize_t destsz, const wchar_t *src, rsize_t count); -size_t wcsxfrm(wchar_t *dest, const wchar_t *src, size_t n); - -// String examination -size_t wcslen(const wchar_t *str); -size_t wcsnlen_s(const wchar_t *str, size_t maxsize); -int wcscmp(const wchar_t *str1, const wchar_t *str2); -int wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t n); -int wcscoll(const wchar_t *str1, const wchar_t *str2); -wchar_t *wcschr(const wchar_t *str, wchar_t ch); -wchar_t *wcsrchr(const wchar_t *str, wchar_t ch); -size_t wcsspn(const wchar_t *str1, const wchar_t *str2); -size_t wcscspn(const wchar_t *str1, const wchar_t *str2); -wchar_t *wcspbrk(const wchar_t *str1, const wchar_t *str2); -wchar_t *wcsstr(const wchar_t *haystack, const wchar_t *needle); -wchar_t *wcstok(wchar_t *str, const wchar_t *delim, wchar_t **saveptr); -errno_t wcstok_s(wchar_t *str, rsize_t *strmax, const wchar_t *delim, wchar_t **context); - -// Wide character array manipulation -wchar_t *wmemcpy(wchar_t *dest, const wchar_t *src, size_t n); -errno_t wmemcpy_s(wchar_t *dest, rsize_t destsz, const wchar_t *src, rsize_t count); -wchar_t *wmemmove(wchar_t *dest, const wchar_t *src, size_t n); -errno_t wmemmove_s(wchar_t *dest, rsize_t destsz, const wchar_t *src, rsize_t count); -int wmemcmp(const wchar_t *str1, const wchar_t *str2, size_t n); -wchar_t *wmemchr(const wchar_t *str, wchar_t ch, size_t n); -wchar_t *wmemset(wchar_t *str, wchar_t ch, size_t n); - -// Macros -#define WEOF ((wint_t)-1) - -struct mbstate_t { - int __state; -}; - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_WCHAR_H diff --git a/share/mrdocs/headers/libc-stubs/wctype.h b/share/mrdocs/headers/libc-stubs/wctype.h deleted file mode 100644 index 2e3fa598a..000000000 --- a/share/mrdocs/headers/libc-stubs/wctype.h +++ /dev/null @@ -1,43 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_WCTYPE_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_WCTYPE_H - -#include "stddef.h" -#include "wchar.h" - -// Types -typedef int wctrans_t; -typedef int wctype_t; - -// Character classification -int iswalnum(wint_t wc); -int iswalpha(wint_t wc); -int iswlower(wint_t wc); -int iswupper(wint_t wc); -int iswdigit(wint_t wc); -int iswxdigit(wint_t wc); -int iswcntrl(wint_t wc); -int iswgraph(wint_t wc); -int iswspace(wint_t wc); -int iswblank(wint_t wc); -int iswprint(wint_t wc); -int iswpunct(wint_t wc); -int iswctype(wint_t wc, wctype_t desc); -wctype_t wctype(const char *property); - -// Character manipulation -wint_t towlower(wint_t wc); -wint_t towupper(wint_t wc); -wint_t towctrans(wint_t wc, wctrans_t desc); -wctrans_t wctrans(const char *property); - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_WCTYPE_H diff --git a/share/mrdocs/headers/libc-stubs/winapifamily.h b/share/mrdocs/headers/libc-stubs/winapifamily.h deleted file mode 100644 index 70eea4b6f..000000000 --- a/share/mrdocs/headers/libc-stubs/winapifamily.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_WINAPIFAMILY_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_WINAPIFAMILY_H - -#include "winpackagefamily.h" - -#define WINAPI_FAMILY_PC_APP 2 -#define WINAPI_FAMILY_PHONE_APP 3 -#define WINAPI_FAMILY_SYSTEM 4 -#define WINAPI_FAMILY_SERVER 5 -#define WINAPI_FAMILY_DESKTOP_APP 100 -#define WINAPI_FAMILY_APP WINAPI_FAMILY_PC_APP -#ifndef WINAPI_FAMILY -#define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP -#endif - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_WINAPIFAMILY_H diff --git a/share/mrdocs/headers/libc-stubs/winpackagefamily.h b/share/mrdocs/headers/libc-stubs/winpackagefamily.h deleted file mode 100644 index a31f9693b..000000000 --- a/share/mrdocs/headers/libc-stubs/winpackagefamily.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_WINAPIFAMILY_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_WINAPIFAMILY_H - -#define WINAPI_PARTITION_PKG_WINTRUST (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) -#define WINAPI_PARTITION_PKG_WEBSERVICES (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) -#define WINAPI_PARTITION_PKG_EVENTLOGSERVICE (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) -#define WINAPI_PARTITION_PKG_VHD (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) -#define WINAPI_PARTITION_PKG_PERFCOUNTER (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) -#define WINAPI_PARTITION_PKG_SECURESTARTUP (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) -#define WINAPI_PARTITION_PKG_REMOTEFS (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) -#define WINAPI_PARTITION_PKG_BOOTABLESKU (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) -#define WINAPI_PARTITION_PKG_CMD (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) -#define WINAPI_PARTITION_PKG_CMDTOOLS (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) -#define WINAPI_PARTITION_PKG_DISM (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) -#define WINAPI_PARTITION_PKG_CORESETUP (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) -#define WINAPI_PARTITION_PKG_APPRUNTIME (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) -#define WINAPI_PARTITION_PKG_ESENT (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) -#define WINAPI_PARTITION_PKG_WINMGMT (WINAPI_FAMILY == WINAPI_FAMILY_SERVER) - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_WINAPIFAMILY_H diff --git a/share/mrdocs/headers/libc-stubs/xlocale.h b/share/mrdocs/headers/libc-stubs/xlocale.h deleted file mode 100644 index de0621786..000000000 --- a/share/mrdocs/headers/libc-stubs/xlocale.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// Licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Copyright (c) 2024 Alan de Freitas (alandefreitas@gmail.com) -// -// Official repository: https://github.com/cppalliance/mrdocs -// - -#ifndef MRDOCS_SHARE_HEADERS_LIBC_STUBS_XLOCALE_H -#define MRDOCS_SHARE_HEADERS_LIBC_STUBS_XLOCALE_H - -typedef struct __locale_struct -{ - struct locale_data *__locales[13]; - const unsigned short int *__ctype_b; - const int *__ctype_tolower; - const int *__ctype_toupper; - const char *__names[13]; -} *__locale_t; - -typedef __locale_t locale_t; - -#endif // MRDOCS_SHARE_HEADERS_LIBC_STUBS_XLOCALE_H diff --git a/src/lib/ConfigOptions.json b/src/lib/ConfigOptions.json index a75281f17..d9d945f1b 100644 --- a/src/lib/ConfigOptions.json +++ b/src/lib/ConfigOptions.json @@ -481,45 +481,6 @@ "type": "list", "default": [] }, - { - "name": "use-system-stdlib", - "brief": "Use the system C++ standard library", - "details": "To achieve reproducible results, MrDocs bundles the LibC++ headers. To use the C++ standard library available in the system instead, set this option to true.", - "type": "bool", - "default": false - }, - { - "name": "stdlib-includes", - "brief": "C++ Standard Library include paths", - "details": "When `use-system-stdlib` is disabled, the C++ standard library headers are available in these paths.", - "type": "list", - "default": [ - "/share/mrdocs/headers/libcxx", - "/share/mrdocs/headers/clang" - ], - "relative-to": "", - "must-exist": false, - "should-exist": true - }, - { - "name": "use-system-libc", - "brief": "Use the system C standard library", - "details": "To achieve reproducible results, MrDocs bundles the LibC headers with its definitions. To use the C standard library available in the system instead, set this option to true.", - "type": "bool", - "default": false - }, - { - "name": "libc-includes", - "brief": "Standard Library include paths", - "details": "When `use-system-libc` is disabled, the C standard library headers are available in these paths.", - "type": "list", - "default": [ - "/share/mrdocs/headers/libc-stubs" - ], - "relative-to": "", - "must-exist": false, - "should-exist": true - }, { "name": "system-includes", "brief": "System include paths", diff --git a/src/lib/MrDocsCompilationDatabase.cpp b/src/lib/MrDocsCompilationDatabase.cpp index e565db784..4dcc4aef7 100644 --- a/src/lib/MrDocsCompilationDatabase.cpp +++ b/src/lib/MrDocsCompilationDatabase.cpp @@ -435,51 +435,6 @@ adjustCommandLine( } new_cmdline.emplace_back("-D__MRDOCS__"); - if ((*config)->useSystemStdlib || (*config)->useSystemLibc) - { - // ------------------------------------------------------ - // Add implicit include paths - // ------------------------------------------------------ - // Implicit include paths are those which are automatically - // added by the compiler. These will not be defined in the - // compile command, so we add them here so that clang - // can also find these headers. - if (auto const it = implicitIncludeDirectories.find(progName); - it != implicitIncludeDirectories.end()) { - for (auto const& inc : it->second) - { - new_cmdline.emplace_back(std::format("-isystem{}", inc)); - } - } - } - - if (!(*config)->useSystemStdlib) - { - // ------------------------------------------------------ - // Add standard library and system includes - // ------------------------------------------------------ - // Regardless of the implicit include directories of the - // compiler used in the compilation database, we disable - // implicit include paths and add the standard library - // and system includes manually. That gives MrDocs - // access to libc++ in a portable way. - new_cmdline.emplace_back("-nostdinc++"); - new_cmdline.emplace_back("-nostdlib++"); - for (auto const& inc : (*config)->stdlibIncludes) - { - new_cmdline.emplace_back(std::format("-isystem{}", inc)); - } - } - - if (!(*config)->useSystemLibc) - { - new_cmdline.emplace_back("-nostdinc"); - for (auto const& inc : (*config)->libcIncludes) - { - new_cmdline.emplace_back(std::format("-isystem{}", inc)); - } - } - // ------------------------------------------------------ // Add user directories to include search path // ------------------------------------------------------ diff --git a/src/tool/CompilerInfo.cpp b/src/tool/CompilerInfo.cpp index c81e381ac..a2a0fe789 100644 --- a/src/tool/CompilerInfo.cpp +++ b/src/tool/CompilerInfo.cpp @@ -82,12 +82,8 @@ parseIncludePaths(std::string const& compilerOutput) } std::unordered_map> -getCompilersDefaultIncludeDir(clang::tooling::CompilationDatabase const& compDb, bool useSystemStdlib) +getCompilersDefaultIncludeDir(clang::tooling::CompilationDatabase const& compDb) { - if (!useSystemStdlib) - { - return {}; - } std::unordered_map> res; auto const allCommands = compDb.getAllCompileCommands(); diff --git a/src/tool/CompilerInfo.hpp b/src/tool/CompilerInfo.hpp index f0cdae0b0..aa9d112ed 100644 --- a/src/tool/CompilerInfo.hpp +++ b/src/tool/CompilerInfo.hpp @@ -44,11 +44,10 @@ parseIncludePaths(std::string const& compilerOutput); * @brief Get the compiler default include dir. * * @param compDb The compilation database. - * @param useSystemStdlib True if the compiler has to use just the system standard library. * @return std::unordered_map> The compiler default include dir. */ std::unordered_map> -getCompilersDefaultIncludeDir(clang::tooling::CompilationDatabase const& compDb, bool useSystemStdlib); +getCompilersDefaultIncludeDir(clang::tooling::CompilationDatabase const& compDb); } // mrdocs } // clang diff --git a/src/tool/ToolCompilationDatabase.cpp b/src/tool/ToolCompilationDatabase.cpp index 08bb1e225..b932550d0 100644 --- a/src/tool/ToolCompilationDatabase.cpp +++ b/src/tool/ToolCompilationDatabase.cpp @@ -102,7 +102,7 @@ generateCompilationDatabase( { MrDocsSettingsDB compilationDB{*config}; auto const defaultIncludePaths = getCompilersDefaultIncludeDir( - compilationDB, (*config)->useSystemStdlib); + compilationDB); MrDocsCompilationDatabase compilationDatabase( settings.sourceRoot, compilationDB, @@ -149,7 +149,7 @@ generateCompilationDatabase( // Custom compilation database that applies settings from the configuration auto const defaultIncludePaths = getCompilersDefaultIncludeDir( - jsonDatabase, (*config)->useSystemStdlib); + jsonDatabase); auto compileCommandsDir = files::getParentDir(compileCommandsPath); MrDocsCompilationDatabase compilationDatabase( compileCommandsDir, diff --git a/test-files/golden-tests/config/sfinae/redeclare.cpp b/test-files/golden-tests/config/sfinae/redeclare.cpp index 7eb75ff95..5c442a155 100644 --- a/test-files/golden-tests/config/sfinae/redeclare.cpp +++ b/test-files/golden-tests/config/sfinae/redeclare.cpp @@ -1,6 +1,28 @@ // issue #850 -#include +namespace std +{ +template +struct enable_if +{ + using type = T; +}; +template +struct enable_if +{}; + +template +using enable_if_t = typename enable_if::type; + +template +struct is_class +{ + static constexpr bool value = true; +}; + +template +bool is_class_v = is_class::value; +} template void f(std::enable_if_t>); diff --git a/test-files/golden-tests/config/sfinae/redeclare.xml b/test-files/golden-tests/config/sfinae/redeclare.xml index 0aca10feb..392779166 100644 --- a/test-files/golden-tests/config/sfinae/redeclare.xml +++ b/test-files/golden-tests/config/sfinae/redeclare.xml @@ -5,9 +5,9 @@