Browse Source

Remove custom alignment limit

gingerBill 3 years ago
parent
commit
526a42c6ca
2 changed files with 3 additions and 9 deletions
  1. 1 7
      src/check_type.cpp
  2. 2 2
      src/types.cpp

+ 1 - 7
src/check_type.cpp

@@ -215,13 +215,7 @@ bool check_custom_align(CheckerContext *ctx, Ast *node, i64 *align_) {
 				error(node, "#align must be a power of 2, got %lld", align);
 				return false;
 			}
-
-			// NOTE(bill): Success!!!
-			i64 custom_align = gb_clamp(align, 1, build_context.max_align);
-			if (custom_align < align) {
-				warning(node, "Custom alignment has been clamped to %lld from %lld", align, custom_align);
-			}
-			*align_ = custom_align;
+			*align_ = align;
 			return true;
 		}
 	}

+ 2 - 2
src/types.cpp

@@ -2972,7 +2972,7 @@ i64 type_align_of_internal(Type *t, TypePath *path) {
 			return 1;
 		}
 		if (t->Union.custom_align > 0) {
-			return gb_clamp(t->Union.custom_align, 1, build_context.max_align);
+			return gb_max(t->Union.custom_align, 1);
 		}
 
 		i64 max = 1;
@@ -2993,7 +2993,7 @@ i64 type_align_of_internal(Type *t, TypePath *path) {
 
 	case Type_Struct: {
 		if (t->Struct.custom_align > 0) {
-			return gb_clamp(t->Struct.custom_align, 1, build_context.max_align);
+			return gb_max(t->Struct.custom_align, 1);
 		}
 		if (t->Struct.is_raw_union) {
 			i64 max = 1;