Updated errno. Socket constants and some functions added. Fix error when a macro returns a void! and that macro is in turn set to a return. Removed too permissive casts to subarrays.

This commit is contained in:
Christoffer Lerno
2023-01-06 01:26:46 +01:00
committed by Christoffer Lerno
parent 8390655d79
commit ad48770977
16 changed files with 388 additions and 11 deletions

View File

@@ -207,7 +207,7 @@ void x64_classify_post_merge(ByteSize size, X64Class *lo_class, X64Class *hi_cla
// If one is MEM => both is mem
// If X87UP is not before X87 => mem
// If size > 16 && first isn't SSE or any other is not SSEUP => mem
// If SSEUP is not preceeded by SSE/SSEUP => convert to SSE.
// If SSEUP is not preceded by SSE/SSEUP => convert to SSE.
if (*hi_class == CLASS_MEMORY) goto DEFAULT_TO_MEMORY;
if (size > 16 && (*lo_class != CLASS_SSE || *hi_class != CLASS_SSEUP)) goto DEFAULT_TO_MEMORY;
if (*hi_class == CLASS_SSEUP && *lo_class != CLASS_SSE && *lo_class != CLASS_SSEUP)

View File

@@ -296,8 +296,9 @@ void llvm_emit_return_abi(GenContext *c, BEValue *return_value, BEValue *optiona
// In this case we use the optional as the actual return.
if (prototype->is_optional)
{
if (return_value && return_value->value)
if (return_value && return_value->type != type_void)
{
assert(return_value->value);
llvm_store_to_ptr_aligned(c, c->return_out, return_value, type_alloca_alignment(return_value->type));
}
return_out = c->optional_out;

View File

@@ -1471,7 +1471,7 @@ CAST:
static inline bool cast_pointer(SemaContext *context, Expr *expr, Type *from, Type *to, Type *to_type, bool add_optional, CastOptions options)
{
// pointer -> any, void* -> pointer pointer -> void*
if (to == type_any || to == type_voidptr || from == type_voidptr) return cast_with_optional(expr, to_type, add_optional);
if (to == type_any || to == type_voidptr || (from == type_voidptr && type_is_pointer(to))) return cast_with_optional(expr, to_type, add_optional);
Type *pointee = from->pointer;
bool is_explicit = options.is_explicit;

View File

@@ -6969,7 +6969,7 @@ static inline bool sema_cast_rvalue(SemaContext *context, Expr *expr)
case EXPR_ACCESS:
if (expr->access_expr.ref->decl_kind == DECL_FUNC)
{
SEMA_ERROR(expr, "A function name must be followed by '(' or preceeded by '&'.");
SEMA_ERROR(expr, "A function name must be followed by '(' or preceded by '&'.");
return false;
}
if (expr->access_expr.ref->decl_kind == DECL_MACRO)

View File

@@ -1 +1 @@
#define COMPILER_VERSION "0.4.3"
#define COMPILER_VERSION "0.4.4"