diff --git a/libc/spec/llvm_libc_ext.td b/libc/spec/llvm_libc_ext.td --- a/libc/spec/llvm_libc_ext.td +++ b/libc/spec/llvm_libc_ext.td @@ -14,7 +14,42 @@ ] >; + HeaderSpec Assert = HeaderSpec< + "assert.h", + [], // Macros + [], // Types + [], // Enumerations + [ + FunctionSpec< + "__assert_fail", + RetValSpec, + [ArgSpec, + ArgSpec, + ArgSpec, + ArgSpec,] + + >, + ] + >; + + HeaderSpec Errno = HeaderSpec< + "errno.h", + [], // Macros + [], // Types + [], // Enumerations + [ + FunctionSpec< + "__errno_location", + RetValSpec, + [ArgSpec] + + >, + ] + >; + let Headers = [ String, + Assert, + Errno, ]; } diff --git a/libc/spec/spec.td b/libc/spec/spec.td --- a/libc/spec/spec.td +++ b/libc/spec/spec.td @@ -48,12 +48,41 @@ def VoidPtr : PtrType; def ConstVoidPtr : ConstType; def SizeTType : NamedType<"size_t">; -def FloatPtr : PtrType; def LongDoublePtr : PtrType; // _Noreturn is really not a type, but it is convenient to treat it as a type. def NoReturn : NamedType<"_Noreturn void">; +//types moved from stdc.td +def VoidRestrictedPtr : RestrictedPtrType; +def ConstVoidRestrictedPtr : ConstType; + +def CharPtr : PtrType; +def ConstCharPtr : ConstType; +def CharRestrictedPtr : RestrictedPtrType; +def ConstCharRestrictedPtr : ConstType; + +def OnceFlagType : NamedType<"once_flag">; +def OnceFlagTypePtr : PtrType; +// TODO(sivachandra): Remove this non-standard type when a formal +// way to describe callable types is available. +def CallOnceFuncType : NamedType<"__call_once_func_t">; +def MtxTType : NamedType<"mtx_t">; +def MtxTTypePtr : PtrType; +def ThrdStartTType : NamedType<"thrd_start_t">; +def ThrdTType : NamedType<"thrd_t">; +def ThrdTTypePtr : PtrType; + +def IntPtr : PtrType; +def FloatPtr : PtrType; +def DoublePtr : PtrType; + +def SigHandlerT : NamedType<"__sighandler_t">; + +//added because __assert_fail needs it. +def UnsignedType : NamedType<"unsigned">; + + class Macro { string Name = name; } diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td --- a/libc/spec/stdc.td +++ b/libc/spec/stdc.td @@ -1,29 +1,4 @@ def StdC : StandardSpec<"stdc"> { - ConstType ConstVoidPtr = ConstType; - RestrictedPtrType VoidRestrictedPtr = RestrictedPtrType; - ConstType ConstVoidRestrictedPtr = ConstType; - - PtrType CharPtr = PtrType; - ConstType ConstCharPtr = ConstType; - RestrictedPtrType CharRestrictedPtr = RestrictedPtrType; - ConstType ConstCharRestrictedPtr = ConstType; - - NamedType OnceFlagType = NamedType<"once_flag">; - PtrType OnceFlagTypePtr = PtrType; - // TODO(sivachandra): Remove this non-standard type when a formal - // way to describe callable types is available. - NamedType CallOnceFuncType = NamedType<"__call_once_func_t">; - NamedType MtxTType = NamedType<"mtx_t">; - PtrType MtxTTypePtr = PtrType; - NamedType ThrdStartTType = NamedType<"thrd_start_t">; - NamedType ThrdTType = NamedType<"thrd_t">; - PtrType ThrdTTypePtr = PtrType; - - PtrType IntPtr = PtrType; - PtrType FloatPtr = PtrType; - PtrType DoublePtr = PtrType; - - NamedType SigHandlerT = NamedType<"__sighandler_t">; NamedType FILE = NamedType<"FILE">; PtrType FILEPtr = PtrType;