diff options
-rw-r--r-- | CHANGELOG.txt | 17 | ||||
-rw-r--r-- | test.cc | 2 | ||||
-rw-r--r-- | zp/GNUmakefile | 37 | ||||
-rw-r--r-- | zp/include-private/zp/prv | 2 | ||||
-rw-r--r-- | zp/include-private/zp/prv.d/strcpy.ii | 2 | ||||
-rw-r--r-- | zp/include-private/zp/prv.d/strequ.ii | 2 | ||||
-rw-r--r-- | zp/include-private/zp/prv.d/strfil.ii | 2 | ||||
-rw-r--r-- | zp/include-private/zp/prv.d/strlen.ii | 2 | ||||
-rw-r--r-- | zp/include-private/zp/prv.d/strsrh.ii | 2 | ||||
-rw-r--r-- | zp/include-private/zp/prv.h | 2 | ||||
-rw-r--r-- | zp/include/zp/bas (renamed from zp/include/zp/bs) | 105 | ||||
-rw-r--r-- | zp/include/zp/bas.d/iscstevl.ii (renamed from zp/include/zp/bs.d/isconsteval.ii) | 2 | ||||
-rw-r--r-- | zp/include/zp/bas.h (renamed from zp/include/zp/bs.h) | 46 | ||||
-rw-r--r-- | zp/include/zp/mem | 2 | ||||
-rw-r--r-- | zp/include/zp/mem.h | 2 | ||||
-rw-r--r-- | zp/include/zp/mth | 2 | ||||
-rw-r--r-- | zp/include/zp/mth.h | 2 | ||||
-rw-r--r-- | zp/include/zp/prv/std.h | 6 | ||||
-rw-r--r-- | zp/include/zp/str | 2 | ||||
-rw-r--r-- | zp/include/zp/str.d/fmtlen.ii | 2 | ||||
-rw-r--r-- | zp/include/zp/str.d/numdig.ii | 2 | ||||
-rw-r--r-- | zp/include/zp/str.h | 2 | ||||
-rw-r--r-- | zp/source/amd64/bas/syscal.s (renamed from zp/source/amd64/bs/syscl.s) | 4 | ||||
-rw-r--r-- | zp/source/amd64/bas/trp.s (renamed from zp/source/amd64/bs/trp.s) | 0 | ||||
-rw-r--r-- | zp/source/any/bas/syscal.c (renamed from zp/source/any/bs/syscl.c) | 4 | ||||
-rw-r--r-- | zp/source/any/bas/trp.c (renamed from zp/source/any/bs/trp.c) | 2 | ||||
-rw-r--r-- | zp/source/arm/bas/syscal.s (renamed from zp/source/arm/bs/syscl.s) | 4 | ||||
-rw-r--r-- | zp/source/arm64/bas/syscal.s (renamed from zp/source/arm64/bs/syscl.s) | 4 | ||||
-rw-r--r-- | zp/source/ia32/bas/syscl.s (renamed from zp/source/ia32/bs/syscl.s) | 4 |
29 files changed, 159 insertions, 108 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 7b6f204..60e5b81 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -26,9 +26,9 @@ * Update readme (fix typo); * Fix useq; * Add more comments to headers; -* Rename sysclret to sysclres; +* Rename syscalret to syscalres; * Rename cpyret to cpyres; -* Update sysclid and sysclres types; +* Update syscalid and syscalres types; * Add development guidelines to readme; * Fix nulptrtyp; @@ -128,6 +128,17 @@ * Update readme; +* Add matching concepts for C++20; +* Rename bs module to bas; +* Rename is* metaprogramming classes back to is*typ; +* Rename isconsteval to iscstevl; +* Rename syscal to syscal; +* Don't declare C++ syscal as noexcept; +* Rename syscalid to syscalidt; +* Add more comments to headers; +* Update and fix standard-detection macros; +* Update target detection in makefile; + # 0.0.2 * Migrate to CMake; @@ -241,7 +252,7 @@ * Add null pointer type: nullptrtyp; * Rename cmp to impl; * Rename lang to std; -* Rename syscall to syscl; +* Rename syscall to syscal; * Add more comments to headers; * Rename nullptr to nulptr; * Add attribute for warning against unused results; @@ -164,7 +164,7 @@ template<typename ltyp,typename rtyp> static auto cmp(int unsigned & num,int uns auto const getval = [](auto const & valref) { using typ = typename ::zp::remref<decltype (valref)>::typ; - if constexpr (::zp::ischr<typ>::val) {return static_cast<::zp::i02m>(valref);} + if constexpr (::zp::ischrtyp<typ>::val) {return static_cast<::zp::i02m>(valref);} else if constexpr (::zp::isptr<typ>::val) {return reinterpret_cast<void *>(valref);} else {return valref;} }; diff --git a/zp/GNUmakefile b/zp/GNUmakefile index 04e9047..b3ec799 100644 --- a/zp/GNUmakefile +++ b/zp/GNUmakefile @@ -4,10 +4,7 @@ ifeq "$(targ)" "" targ := $(shell ../getTarget.sh) -ifeq "$(targ)" "unknown" -$(error Unable to detect target!) -endif -$(info Detected target $(targ)!) +$(info Targeting $(targ)!) endif ifeq "$(targ)" "amd64" @@ -24,7 +21,7 @@ ifeq "$(stdcxx)" "" stdcxx := c++98 endif -OBJ_BS_TRP := source/any/bs/trp.o +OBJ_BAS_TRP := source/any/bas/trp.o OBJ_MEM_MEMCPY := source/any/mem/memcpy.o OBJ_MEM_MEMEQU := source/any/mem/memequ.o @@ -65,34 +62,34 @@ OBJ_STR_WSTRFIL := source/any/str/wstrfil.o OBJ_STR_WSTRLEN := source/any/str/wstrlen.o OBJ_STR_WSTRSRH := source/any/str/wstrsrh.o -OBJ_BS_SYSCL := source/any/bs/syscl.o +OBJ_BAS_SYSCAL := source/any/bas/syscal.o ifeq "$(targ)" "amd64" -OBJ_BS_SYSCL := source/amd64/bs/syscl.o -OBJ_BS_TRP := source/amd64/bs/trp.o +OBJ_BAS_SYSCAL := source/amd64/bas/syscal.o +OBJ_BAS_TRP := source/amd64/bas/trp.o OBJ_MEM_MEMCPY := source/amd64/mem/memcpy.o OBJ_MEM_MEMFIL := source/amd64/mem/memfil.o else ifeq "$(targ)" "arm" -OBJ_BS_SYSCL := source/arm/bs/syscl.o +OBJ_BAS_SYSCAL := source/arm/bas/syscal.o OBJ_MEM_MEMCPY := source/arm/mem/memcpy.o else ifeq "$(targ)" "arm64" -OBJ_BS_SYSCL := source/arm64/bs/syscl.o +OBJ_BAS_SYSCAL := source/arm64/bas/syscal.o OBJ_MEM_MEMCPY := source/arm64/mem/memcpy.o else ifeq "$(targ)" "ia32" -OBJ_BS_SYSCL := source/ia32/bs/syscl.o +OBJ_BAS_SYSCAL := source/ia32/bas/syscal.o endif OBJS := \ - $(OBJ_BS_TRP) \ + $(OBJ_BAS_TRP) \ \ $(OBJ_MEM_MEMCPY) \ $(OBJ_MEM_MEMEQU) \ @@ -133,10 +130,10 @@ OBJS := \ $(OBJ_STR_WSTRLEN) \ $(OBJ_STR_WSTRSRH) -ifneq "$(nosyscl)" "true" +ifneq "$(nosyscal)" "true" OBJS := \ $(OBJS) \ - $(OBJ_BS_SYSCL) + $(OBJ_BAS_SYSCL) endif ifeq "$(shrlib)" "true" @@ -146,15 +143,15 @@ LIB := libzp.a endif HDRS := \ - include/zp/bs \ - include/zp/bs.h \ + include/zp/bas \ + include/zp/bas.h \ include/zp/mem \ include/zp/mem.h \ include/zp/mth \ include/zp/mth.h \ include/zp/str \ include/zp/str.h \ - include/zp/bs.d/isconsteval.ii \ + include/zp/bas.d/iscstevl.ii \ include/zp/mem.d/cpy.ii \ include/zp/mem.d/equ.ii \ include/zp/mem.d/fil.ii \ @@ -241,11 +238,11 @@ $(OBJS): $(HDRS) install: $(LIB) mkdir -pvm755 "$(HDRDIR)/zp/prv" - mkdir -pvm755 "$(HDRDIR)/zp/"{"bs","mem","str"}".d" + mkdir -pvm755 "$(HDRDIR)/zp/"{"bas","mem","str"}".d" mkdir -pvm755 "$(LIBDIR)" - install -vm644 "include/zp/"{"bs","mem","mth","str"}{"",".h"} "$(HDRDIR)/zp" + install -vm644 "include/zp/"{"bas","mem","mth","str"}{"",".h"} "$(HDRDIR)/zp" install -vm644 "include/zp/prv/"{"arc","chr","flt","imp","int","std","sys"}".h" "$(HDRDIR)/zp/prv" - install -vm644 "include/zp/bs.d/"isconsteval".ii" "$(HDRDIR)/zp/bs.d" + install -vm644 "include/zp/bas.d/"iscstevl".ii" "$(HDRDIR)/zp/bas.d" install -vm644 "include/zp/mem.d/"{"cpy","equ","fil","memcpy","srh"}".ii" "$(HDRDIR)/zp/mem.d" install -vm644 "include/zp/str.d/numdig.ii" "$(HDRDIR)/zp/str.d" install -vm755 "$(LIB)" "$(LIBDIR)" diff --git a/zp/include-private/zp/prv b/zp/include-private/zp/prv index 02aa80e..76c58ab 100644 --- a/zp/include-private/zp/prv +++ b/zp/include-private/zp/prv @@ -7,7 +7,7 @@ #ifndef zp_prv_cxxhdr_prv #define zp_prv_cxxhdr_prv -#include <zp/bs> +#include <zp/bas> #include <zp/prv.h> namespace zp { diff --git a/zp/include-private/zp/prv.d/strcpy.ii b/zp/include-private/zp/prv.d/strcpy.ii index c858359..1f5cf11 100644 --- a/zp/include-private/zp/prv.d/strcpy.ii +++ b/zp/include-private/zp/prv.d/strcpy.ii @@ -5,7 +5,7 @@ */ template<typename typ> zp_nthrw ::zp::siz zp::det::strcpy(typ * dst,typ const * src) { - //static_assert(::zp::ischr<typ>::val,"type must be a character type"); + //static_assert(::zp::ischrtyp<typ>::val,"type must be a character type"); typ * const dstsrt = dst; diff --git a/zp/include-private/zp/prv.d/strequ.ii b/zp/include-private/zp/prv.d/strequ.ii index 8fa8fdf..cad90a6 100644 --- a/zp/include-private/zp/prv.d/strequ.ii +++ b/zp/include-private/zp/prv.d/strequ.ii @@ -5,7 +5,7 @@ */ template<typename typ> zp_nthrw bool zp::det::strequ(typ const * lstr,typ const * rstr) { - //static_assert(::zp::ischr<typ>::val,"type must be a character type"); + //static_assert(::zp::ischrtyp<typ>::val,"type must be a character type"); for (;;++lstr,++rstr) { zp_lik (*lstr != *rstr) {return false;} diff --git a/zp/include-private/zp/prv.d/strfil.ii b/zp/include-private/zp/prv.d/strfil.ii index 1a1a725..8211035 100644 --- a/zp/include-private/zp/prv.d/strfil.ii +++ b/zp/include-private/zp/prv.d/strfil.ii @@ -5,7 +5,7 @@ */ template<typename typ> zp_nthrw ::zp::siz zp::det::strfil(typ * str,typ const chr) { - //static_assert(::zp::ischr<typ>::val,"type must be a character type"); /* If the string format uses multiple values per character, the number of these values is returned (use utfXdeclen if the number of characters is needed). */ + //static_assert(::zp::ischrtyp<typ>::val,"type must be a character type"); /* If the string format uses multiple values per character, the number of these values is returned (use utfXdeclen if the number of characters is needed). */ typ * const srt = str; diff --git a/zp/include-private/zp/prv.d/strlen.ii b/zp/include-private/zp/prv.d/strlen.ii index 0bef5f3..2c32ef2 100644 --- a/zp/include-private/zp/prv.d/strlen.ii +++ b/zp/include-private/zp/prv.d/strlen.ii @@ -5,7 +5,7 @@ */ template<typename typ> zp_nthrw ::zp::siz zp::det::strlen(typ const * str) { - //static_assert(::zp::ischr<typ>::val,"type must be a character type"); /* If the string format uses multiple values per character, the number of these values is returned (use utfXdeclen if the number of characters is needed). */ + //static_assert(::zp::ischrtyp<typ>::val,"type must be a character type"); /* If the string format uses multiple values per character, the number of these values is returned (use utfXdeclen if the number of characters is needed). */ typ const * const srt = str; diff --git a/zp/include-private/zp/prv.d/strsrh.ii b/zp/include-private/zp/prv.d/strsrh.ii index a701005..7a66e8e 100644 --- a/zp/include-private/zp/prv.d/strsrh.ii +++ b/zp/include-private/zp/prv.d/strsrh.ii @@ -5,7 +5,7 @@ */ template<typename typ> zp_nthrw typ * zp::det::strsrh(typ const * str,typ const chr) { - //static_assert(::zp::ischr<typ>::val,"type must be a character type"); + //static_assert(::zp::ischrtyp<typ>::val,"type must be a character type"); for (;;++str) { typ const curchr = *str; diff --git a/zp/include-private/zp/prv.h b/zp/include-private/zp/prv.h index 02fa770..55e61bf 100644 --- a/zp/include-private/zp/prv.h +++ b/zp/include-private/zp/prv.h @@ -7,7 +7,7 @@ #ifndef zp_prv_hdr_prv #define zp_prv_hdr_prv -#include <zp/bs.h> +#include <zp/bas.h> zp_prv_cdecl diff --git a/zp/include/zp/bs b/zp/include/zp/bas index 05c421a..bf0ca33 100644 --- a/zp/include/zp/bs +++ b/zp/include/zp/bas @@ -11,7 +11,7 @@ #error C++ header included from C #endif -#include <zp/bs.h> +#include <zp/bas.h> /* ttval: @@ -88,8 +88,8 @@ namespace zp { typedef ::zp_c01 c01; typedef ::zp_c02 c02; - typedef ::zp_sysclid sysclid; - typedef ::zp_sysclres sysclres; + typedef ::zp_syscalidt syscalidt; + typedef ::zp_syscalres syscalres; #if zp_std_cxx11 using nulptrtyp = ::zp_nulptrtyp; @@ -263,89 +263,106 @@ namespace zp { template<typename typ> struct isusgn<typ volatile> {constexpr static bool val = isusgn<typ>::val;}; template<typename typ> struct isusgn<typ const volatile> {constexpr static bool val = isusgn<typ>::val;}; - template<typename typ> struct isflt {constexpr static bool val = false;}; + template<typename typ> struct isflttyp {constexpr static bool val = false;}; - template<> struct isflt<double> {constexpr static bool val = true;}; - template<> struct isflt<double long> {constexpr static bool val = true;}; - template<> struct isflt<float> {constexpr static bool val = true;}; + template<> struct isflttyp<double> {constexpr static bool val = true;}; + template<> struct isflttyp<double long> {constexpr static bool val = true;}; + template<> struct isflttyp<float> {constexpr static bool val = true;}; #if __STDCPP_BFLOAT16_T__ - template<> struct isflt<decltype (0.0bf16)> {constexpr static bool val = true;}; + template<> struct isflttyp<decltype (0.0bf16)> {constexpr static bool val = true;}; #endif #if __STDCPP_FLOAT128_T__ - template<> struct isflt<decltype (0.0f128)> {constexpr static bool val = true;}; + template<> struct isflttyp<decltype (0.0f128)> {constexpr static bool val = true;}; #endif #if __STDCPP_FLOAT16_T__ - template<> struct isflt<decltype (0.0f16)> {constexpr static bool val = true;}; + template<> struct isflttyp<decltype (0.0f16)> {constexpr static bool val = true;}; #endif #if __STDCPP_FLOAT32_T__ - template<> struct isflt<decltype (0.0f32)> {constexpr static bool val = true;}; + template<> struct isflttyp<decltype (0.0f32)> {constexpr static bool val = true;}; #endif #if __STDCPP_FLOAT64_T__ - template<> struct isflt<decltype (0.0f64)> {constexpr static bool val = true;}; + template<> struct isflttyp<decltype (0.0f64)> {constexpr static bool val = true;}; #endif - template<typename typ> struct isflt<typ const> {constexpr static bool val = isflt<typ>::val;}; - template<typename typ> struct isflt<typ volatile> {constexpr static bool val = isflt<typ>::val;}; - template<typename typ> struct isflt<typ const volatile> {constexpr static bool val = isflt<typ>::val;}; + template<typename typ> struct isflttyp<typ const> {constexpr static bool val = isflttyp<typ>::val;}; + template<typename typ> struct isflttyp<typ volatile> {constexpr static bool val = isflttyp<typ>::val;}; + template<typename typ> struct isflttyp<typ const volatile> {constexpr static bool val = isflttyp<typ>::val;}; - template<typename typ> struct isint {constexpr static bool val = false;}; + template<typename typ> struct isinttyp {constexpr static bool val = false;}; - template<> struct isint<char signed> {constexpr static bool val = true;}; - template<> struct isint<char unsigned> {constexpr static bool val = true;}; - template<> struct isint<int> {constexpr static bool val = true;}; - template<> struct isint<int unsigned> {constexpr static bool val = true;}; - template<> struct isint<long> {constexpr static bool val = true;}; - template<> struct isint<long long> {constexpr static bool val = true;}; - template<> struct isint<long long unsigned> {constexpr static bool val = true;}; - template<> struct isint<long unsigned> {constexpr static bool val = true;}; - template<> struct isint<short> {constexpr static bool val = true;}; - template<> struct isint<short unsigned> {constexpr static bool val = true;}; + template<> struct isinttyp<char signed> {constexpr static bool val = true;}; + template<> struct isinttyp<char unsigned> {constexpr static bool val = true;}; + template<> struct isinttyp<int> {constexpr static bool val = true;}; + template<> struct isinttyp<int unsigned> {constexpr static bool val = true;}; + template<> struct isinttyp<long> {constexpr static bool val = true;}; + template<> struct isinttyp<long long> {constexpr static bool val = true;}; + template<> struct isinttyp<long long unsigned> {constexpr static bool val = true;}; + template<> struct isinttyp<long unsigned> {constexpr static bool val = true;}; + template<> struct isinttyp<short> {constexpr static bool val = true;}; + template<> struct isinttyp<short unsigned> {constexpr static bool val = true;}; - template<typename typ> struct isint<typ const> {constexpr static bool val = isint<typ>::val;}; - template<typename typ> struct isint<typ volatile> {constexpr static bool val = isint<typ>::val;}; - template<typename typ> struct isint<typ const volatile> {constexpr static bool val = isint<typ>::val;}; + template<typename typ> struct isinttyp<typ const> {constexpr static bool val = isinttyp<typ>::val;}; + template<typename typ> struct isinttyp<typ volatile> {constexpr static bool val = isinttyp<typ>::val;}; + template<typename typ> struct isinttyp<typ const volatile> {constexpr static bool val = isinttyp<typ>::val;}; - template<typename typ> struct isari {constexpr static bool val = ::zp::isflt<typ>::val || ::zp::isint<typ>::val;}; + template<typename typ> struct isarityp {constexpr static bool val = ::zp::isflttyp<typ>::val || ::zp::isinttyp<typ>::val;}; - template<typename typ> struct ischr {constexpr static bool val = false;}; + template<typename typ> struct ischrtyp {constexpr static bool val = false;}; - template<> struct ischr<char> {constexpr static bool val = true;}; - template<> struct ischr<char unsigned> {constexpr static bool val = true;}; - template<> struct ischr<char16_t> {constexpr static bool val = true;}; - template<> struct ischr<char32_t> {constexpr static bool val = true;}; - template<> struct ischr<wchar_t> {constexpr static bool val = true;}; + template<> struct ischrtyp<char> {constexpr static bool val = true;}; + template<> struct ischrtyp<char unsigned> {constexpr static bool val = true;}; + template<> struct ischrtyp<char16_t> {constexpr static bool val = true;}; + template<> struct ischrtyp<char32_t> {constexpr static bool val = true;}; + template<> struct ischrtyp<wchar_t> {constexpr static bool val = true;}; #if __cpp_char8_t >= 201811 - template<> struct ischr<char8_t> {constexpr static bool val = true;}; + template<> struct ischrtyp<char8_t> {constexpr static bool val = true;}; #endif - template<typename typ> struct ischr<typ const> {constexpr static bool val = ischr<typ>::val;}; - template<typename typ> struct ischr<typ volatile> {constexpr static bool val = ischr<typ>::val;}; - template<typename typ> struct ischr<typ const volatile> {constexpr static bool val = ischr<typ>::val;}; + template<typename typ> struct ischrtyp<typ const> {constexpr static bool val = ischrtyp<typ>::val;}; + template<typename typ> struct ischrtyp<typ volatile> {constexpr static bool val = ischrtyp<typ>::val;}; + template<typename typ> struct ischrtyp<typ const volatile> {constexpr static bool val = ischrtyp<typ>::val;}; #endif // c++11 +#if zp_std_cxx20 + template<typename typ> concept arityp = ::zp::isarityp<typ>::val; + template<typename typ> concept chrtyp = ::zp::ischrtyp<typ>::val; + template<typename typ> concept flttyp = ::zp::isflttyp<typ>::val; + template<typename typ> concept inttyp = ::zp::isinttyp<typ>::val; + +#define zp_prv_arityp ::zp::arityp +#define zp_prv_chrtyp ::zp::chrtyp +#define zp_prv_flttyp ::zp::flttyp +#define zp_prv_inttyp ::zp::inttyp +#else +#define zp_prv_arityp typename +#define zp_prv_chrtyp typename +#define zp_prv_flttyp typename +#define zp_prv_inttyp typename +#endif + zp_prv_ttval(::zp::i04m) ver = zp_ver; zp_prv_ttval(::zp::i04m) extver = zp_extver; zp_prv_ttval(::zp::siz) bytelen = zp_bytelen; - zp_prv_ttval(::zp::siz) nopos = zp_nopos; + zp_prv_ttval(::zp::siz) nopos = zp_nopos; zp_prv_ttval(::zp::c02) unimax = zp_unimax; #if zp_std_cxx11 - zp_iln constexpr auto isconsteval() noexcept -> bool; + zp_iln constexpr auto iscstevl() noexcept -> bool; // is constant-evaluated #endif zp_iln zp_nret zp_nthrw inline void trp() {::zp_trp();} zp_iln zp_nret zp_nthrw inline void urch() {zp_urch();} #if zp_std_cxx11 // We cannot use template parameter packs before C++11, so this function becomes quite non-trivial to implement. - template<typename... typs> zp_iln inline auto syscl(::zp::sysclid id,typs const &... args) noexcept -> ::zp::sysclres {return ::zp_syscl(id,args...);} + template<typename... typs> zp_iln inline auto syscal(::zp::syscalidt idt,typs const &... args) -> ::zp::syscalres {return ::zp_syscal(idt,args...);} #endif } #if zp_std_cxx11 -#include <zp/bs.d/isconsteval.ii> +#include <zp/bas.d/iscstevl.ii> #endif #endif diff --git a/zp/include/zp/bs.d/isconsteval.ii b/zp/include/zp/bas.d/iscstevl.ii index 8718c60..333a9a7 100644 --- a/zp/include/zp/bs.d/isconsteval.ii +++ b/zp/include/zp/bas.d/iscstevl.ii @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -constexpr auto zp::isconsteval() noexcept -> bool { +constexpr auto zp::iscstevl() noexcept -> bool { #if zp_prv_hasbltin(__builtin_is_constant_evaluated) return __builtin_is_constant_evaluated(); #elif __cpp_if_consteval >= 202106 diff --git a/zp/include/zp/bs.h b/zp/include/zp/bas.h index 7782ef6..7c852bf 100644 --- a/zp/include/zp/bs.h +++ b/zp/include/zp/bas.h @@ -64,7 +64,7 @@ Otherwise, we look at the compiler. Otherwise, we define it in a standard-compliant manner that doesn't result in ANY "broken" code, such - as just always returning true in isconsteval, + as just always returning true in iscstevl, which would break if we returned false, as this could lead to reaching non-constexpr friendly code. @@ -240,12 +240,12 @@ zp_prv_cdecl #include <zp/prv/chr.h> /* - We define the sysclid as the platform type + We define the syscalidt as the platform type used for system call identifiers (on FreeBSD ARM64, this is int, and on Linux AMD64, this is long, despite the __NR macros being int). - We likewise define the sysclres type for the + We likewise define the syscalres type for the return type of the system calls. Usually, you can see "/usr/include/unistd.h" @@ -259,14 +259,14 @@ zp_prv_cdecl */ #if zp_sys_freebsd -typedef int zp_sysclid; -typedef int zp_sysclres; +typedef int zp_syscalidt; +typedef int zp_syscalres; #elif zp_sys_linux -typedef long zp_sysclid; -typedef long zp_sysclres; +typedef long zp_syscalidt; +typedef long zp_syscalres; #else -typedef long unsigned zp_sysclid; -typedef long unsigned zp_sysclres; +typedef long unsigned zp_syscalidt; +typedef long unsigned zp_syscalres; #endif #if zp_std_c23 @@ -283,6 +283,32 @@ typedef decltype (nullptr) zp_nulptrtyp; #define zp_nopos zp_maxvalz +/* + Note: Taking the type of nulptr is not (always) + allowed. Take the following example: + + // C++ + void foo(__typeof__ (zp_nulptr) arg) { + // ... + } + + The declaration for this will in C++98 evaluate + the type of arg to int unsigned, resulting in + the following mangled name: + + _Z3fooj + + Whilst in C++11, the type would be evaluated as + ::std::nullptr_t, resulting in the following + mangled name: + + _Z3fooDn + + This can result in a symbol-mismatch, which in + turn will result in the linking failing. Do + note, however, that C++11 projects will not get + this error, and it is here allowed and valid. +*/ #if zp_std_c23 || zp_std_cxx11 #define zp_nulptr (nullptr) #elif zp_std_cxx @@ -295,7 +321,7 @@ typedef decltype (nullptr) zp_nulptrtyp; zp_nret void zp_trp(void); -zp_sysclres zp_syscl(zp_sysclid id,...); +zp_syscalres zp_syscal(zp_syscalidt idt,...); zp_prv_cdeclend diff --git a/zp/include/zp/mem b/zp/include/zp/mem index dc80ecf..c6b400a 100644 --- a/zp/include/zp/mem +++ b/zp/include/zp/mem @@ -7,7 +7,7 @@ #ifndef zp_prv_cxxhdr_mem #define zp_prv_cxxhdr_mem -#include <zp/bs> +#include <zp/bas> #include <zp/mem.h> namespace zp { diff --git a/zp/include/zp/mem.h b/zp/include/zp/mem.h index c51fd98..b8fe85a 100644 --- a/zp/include/zp/mem.h +++ b/zp/include/zp/mem.h @@ -7,7 +7,7 @@ #ifndef zp_prv_hdr_mem #define zp_prv_hdr_mem -#include <zp/bs.h> +#include <zp/bas.h> zp_prv_cdecl diff --git a/zp/include/zp/mth b/zp/include/zp/mth index 1da0342..528e46b 100644 --- a/zp/include/zp/mth +++ b/zp/include/zp/mth @@ -7,7 +7,7 @@ #ifndef zp_prv_cxxhdr_mth #define zp_prv_cxxhdr_mth -#include <zp/bs> +#include <zp/bas> #include <zp/mth.h> namespace zp { diff --git a/zp/include/zp/mth.h b/zp/include/zp/mth.h index 9b380fe..2535f1e 100644 --- a/zp/include/zp/mth.h +++ b/zp/include/zp/mth.h @@ -7,7 +7,7 @@ #ifndef zp_prv_hdr_mth #define zp_prv_hdr_mth -#include <zp/bs.h> +#include <zp/bas.h> zp_prv_cdecl diff --git a/zp/include/zp/prv/std.h b/zp/include/zp/prv/std.h index 9062cea..8f9fc2f 100644 --- a/zp/include/zp/prv/std.h +++ b/zp/include/zp/prv/std.h @@ -8,10 +8,8 @@ #define zp_std_cxx (0x1) -#define zp_std_cxx89 (0x1) - #if __cplusplus >= 199711 -#define zp_std_cxx99 (0x1) +#define zp_std_cxx98 (0x1) #if __cplusplus >= 201103 #define zp_std_cxx11 (0x1) @@ -38,6 +36,7 @@ #define zp_std_c (0x1) +#if __STDC__ #define zp_std_c90 (0x1) #if __STDC_VERSION__ >= 199409 @@ -60,5 +59,6 @@ #endif #endif #endif +#endif #endif diff --git a/zp/include/zp/str b/zp/include/zp/str index 44953f6..ab954ef 100644 --- a/zp/include/zp/str +++ b/zp/include/zp/str @@ -7,7 +7,7 @@ #ifndef zp_prv_cxxhdr_str #define zp_prv_cxxhdr_str -#include <zp/bs> +#include <zp/bas> #include <zp/str.h> namespace zp { diff --git a/zp/include/zp/str.d/fmtlen.ii b/zp/include/zp/str.d/fmtlen.ii index 955b7ad..7509b1a 100644 --- a/zp/include/zp/str.d/fmtlen.ii +++ b/zp/include/zp/str.d/fmtlen.ii @@ -5,7 +5,7 @@ */ template<typename typ> constexpr auto zp::fmtlen(typ val,::zp::i8m const bs) noexcept -> ::zp::siz { - static_assert(::zp::isint<typ>::val,"type must be an integral type"); + static_assert(::zp::isinttyp<typ>::val,"type must be an integral type"); ::zp::siz len = 0x0u; diff --git a/zp/include/zp/str.d/numdig.ii b/zp/include/zp/str.d/numdig.ii index c3d93da..f7a792d 100644 --- a/zp/include/zp/str.d/numdig.ii +++ b/zp/include/zp/str.d/numdig.ii @@ -5,7 +5,7 @@ */ template<typename typ> zp_nthrw ::zp::siz zp::prv::numdig(typ fmtval,::zp::i8m const bs) { - //static_assert(::zp::isint<typ>::val,"type must be an integral type"); + //static_assert(::zp::isinttyp<typ>::val,"type must be an integral type"); if (fmtval == typ (0x0)) return 0x1u; diff --git a/zp/include/zp/str.h b/zp/include/zp/str.h index 68f84b5..324853e 100644 --- a/zp/include/zp/str.h +++ b/zp/include/zp/str.h @@ -7,7 +7,7 @@ #ifndef zp_prv_hdr_str #define zp_prv_hdr_str -#include <zp/bs.h> +#include <zp/bas.h> zp_prv_cdecl diff --git a/zp/source/amd64/bs/syscl.s b/zp/source/amd64/bas/syscal.s index 4842577..fac5a6e 100644 --- a/zp/source/amd64/bs/syscl.s +++ b/zp/source/amd64/bas/syscal.s @@ -2,9 +2,9 @@ ; This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. ; If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. -global zp_syscl +global zp_syscal -zp_syscl: +zp_syscal: ; System calls on AMD64 use the following registers: ; rax : System call identifier ; rdi : First parameter diff --git a/zp/source/amd64/bs/trp.s b/zp/source/amd64/bas/trp.s index 91efa4e..91efa4e 100644 --- a/zp/source/amd64/bs/trp.s +++ b/zp/source/amd64/bas/trp.s diff --git a/zp/source/any/bs/syscl.c b/zp/source/any/bas/syscal.c index a83e285..6efa3e9 100644 --- a/zp/source/any/bs/syscl.c +++ b/zp/source/any/bas/syscal.c @@ -4,8 +4,8 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -#include <zp/bs.h> +#include <zp/bas.h> -zp_sysclres zp_syscl(zp_nuse zp_sysclid id,...) { +zp_syscalres zp_syscal(zp_nuse zp_syscalidt idt,...) { zp_urch(); /* Unsupported. */ } diff --git a/zp/source/any/bs/trp.c b/zp/source/any/bas/trp.c index d462d69..f303bf0 100644 --- a/zp/source/any/bs/trp.c +++ b/zp/source/any/bas/trp.c @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -#include <zp/bs.h> +#include <zp/bas.h> void zp_trp(void) { #if zp_prv_hasbltin(__builtin_trap) diff --git a/zp/source/arm/bs/syscl.s b/zp/source/arm/bas/syscal.s index c7cca36..6609332 100644 --- a/zp/source/arm/bs/syscl.s +++ b/zp/source/arm/bas/syscal.s @@ -6,9 +6,9 @@ .arm -.globl zp_syscl +.globl zp_syscal -zp_syscl: +zp_syscal: @ System calls on ARM EABI use the following registers: @ r0 : System call identifier @ r1 : First parameter diff --git a/zp/source/arm64/bs/syscl.s b/zp/source/arm64/bas/syscal.s index 673cc5f..b5d928e 100644 --- a/zp/source/arm64/bs/syscl.s +++ b/zp/source/arm64/bas/syscal.s @@ -2,9 +2,9 @@ /* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. */ /* If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -.globl zp_syscl +.globl zp_syscal -zp_syscl: +zp_syscal: /* System calls on ARM64 use the following registers: */ /* x0 : System call identifier */ /* x1 : First parameter */ diff --git a/zp/source/ia32/bs/syscl.s b/zp/source/ia32/bas/syscl.s index 9fe18e2..c482c9d 100644 --- a/zp/source/ia32/bs/syscl.s +++ b/zp/source/ia32/bas/syscl.s @@ -2,9 +2,9 @@ ; This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. ; If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. -global zp_syscl +global zp_syscal -zp_syscl: +zp_syscal: ; System calls on IA-32 use the following registers: ; eax : System call identifier ; ebx : First parameter |