makefile: move pdlibc to extlib, add C++ stub standard headers
It now kind of compiles with x86_64-elf gcc (does not link though)
This commit is contained in:
5
libstd/README
Normal file
5
libstd/README
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
This folder is in place for the most standard headers not in the PDLibC extlib.
|
||||
|
||||
Mostly for C++ standard headers.
|
||||
|
25
libstd/__cpp_config.hpp
Normal file
25
libstd/__cpp_config.hpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
#define __CXX11
|
||||
#endif
|
||||
#if __cplusplus >= 201402L
|
||||
#define __CXX14
|
||||
#endif
|
||||
#if __cplusplus >= 201703L
|
||||
#define __CXX17
|
||||
#endif
|
||||
#if __cplusplus >= 202002L
|
||||
#define __CXX20
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __CXX11
|
||||
#define __NOTHROW noexcept
|
||||
#define __NOTHROW_SINCECXX11 __NOTHROW
|
||||
#else
|
||||
#define __NOTHROW throw()
|
||||
#define __NOTHROW_SINCECXX11
|
||||
#endif
|
||||
|
23
libstd/exception
Normal file
23
libstd/exception
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include <__cpp_config.hpp>
|
||||
|
||||
extern "C++" {
|
||||
namespace std {
|
||||
|
||||
|
||||
class exception {
|
||||
public:
|
||||
exception() __NOTHROW {}
|
||||
#ifdef __CXX11
|
||||
exception(const exception &) = default;
|
||||
exception &operator=(const exception &) = default;
|
||||
exception(exception &&) = default;
|
||||
exception &operator=(exception &&) = default;
|
||||
#endif
|
||||
|
||||
virtual const char *what() const __NOTHROW { return "std::exception"; };
|
||||
};
|
||||
|
||||
|
||||
} // namespace std
|
||||
}
|
51
libstd/new
Normal file
51
libstd/new
Normal file
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
#include <__cpp_config.hpp>
|
||||
|
||||
#include <exception>
|
||||
|
||||
extern "C++" {
|
||||
namespace std {
|
||||
|
||||
|
||||
class bad_alloc: public exception {
|
||||
public:
|
||||
bad_alloc() __NOTHROW {}
|
||||
#ifdef __CXX11
|
||||
bad_alloc(const bad_alloc &) = default;
|
||||
bad_alloc &operator=(const bad_alloc &) = default;
|
||||
#endif
|
||||
virtual ~bad_alloc() __NOTHROW {}
|
||||
|
||||
virtual const char *what() const __NOTHROW { return "std::bad_alloc"; }
|
||||
};
|
||||
|
||||
#ifdef __CXX11
|
||||
class bad_array_new_length: public bad_alloc {
|
||||
public:
|
||||
bad_array_new_length() __NOTHROW {}
|
||||
virtual ~bad_array_new_length() __NOTHROW {}
|
||||
|
||||
virtual const char *what() const __NOTHROW { return "std::bad_array_new_length"; }
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __CXX17
|
||||
enum class align_val_t : size_t {};
|
||||
#endif
|
||||
|
||||
struct nothrow_t {
|
||||
#ifdef __CXX11
|
||||
explicit nothrow_t() = default;
|
||||
#endif
|
||||
};
|
||||
extern const nothrow_t nothrow;
|
||||
|
||||
|
||||
// new_handler omitted
|
||||
|
||||
// new/delete omitted, use memory/memory.hpp
|
||||
|
||||
|
||||
} // namespace std
|
||||
}
|
Reference in New Issue
Block a user