From 00ccc4cfdd391e2f37e601c55af7a55081ac73d9 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 28 Feb 2025 20:52:50 +0100 Subject: ADD: Add __cplusplus macro to preprocessor. Signed-off-by: Amlal El Mahrouss --- dev/LibC++/lc_runtime.h | 13 +++++++++++++ dev/LibCompiler/src/CPlusPlusCompilerPreProcessor.cc | 14 ++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 dev/LibC++/lc_runtime.h (limited to 'dev') diff --git a/dev/LibC++/lc_runtime.h b/dev/LibC++/lc_runtime.h new file mode 100644 index 0000000..c98fefe --- /dev/null +++ b/dev/LibC++/lc_runtime.h @@ -0,0 +1,13 @@ +/* ------------------------------------------- + \ + Copyright (C) 2024-2025 Amlal EL Mahrouss, all rights reserved. \ + \ +------------------------------------------- */ + +#pragma once + +#ifdef __cplusplus + +extern "C" void __cxx_libcompiler_unreachable(void); + +#endif \ No newline at end of file diff --git a/dev/LibCompiler/src/CPlusPlusCompilerPreProcessor.cc b/dev/LibCompiler/src/CPlusPlusCompilerPreProcessor.cc index 2d4c11a..1986d61 100644 --- a/dev/LibCompiler/src/CPlusPlusCompilerPreProcessor.cc +++ b/dev/LibCompiler/src/CPlusPlusCompilerPreProcessor.cc @@ -922,6 +922,13 @@ LIBCOMPILER_MODULE(CPlusPlusPreprocessorMain) kMacros.push_back(macro_1); + Detail::bpp_macro macro_unreachable; + + macro_unreachable.fName = "__unreachable"; + macro_unreachable.fValue = "__cxx_libcompiler_unreachable"; + + kMacros.push_back(macro_unreachable); + Detail::bpp_macro macro_0; macro_0.fName = "__false"; @@ -936,6 +943,13 @@ LIBCOMPILER_MODULE(CPlusPlusPreprocessorMain) kMacros.push_back(macro_zka); + Detail::bpp_macro macro_cxx; + + macro_cxx.fName = "__cplusplus"; + macro_cxx.fValue = "202302L"; + + kMacros.push_back(macro_cxx); + Detail::bpp_macro macro_size_t; macro_size_t.fName = "__SIZE_TYPE__"; macro_size_t.fValue = "unsigned long long int"; -- cgit v1.2.3