Browse Source

Change `#c_vararg` checking to only disallow odin calling conventions

gingerBill 3 years ago
parent
commit
ab9d1f99fd
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/check_type.cpp

+ 6 - 2
src/check_type.cpp

@@ -2031,10 +2031,14 @@ bool check_procedure_type(CheckerContext *ctx, Type *type, Ast *proc_type_node,
 	if (param_count > 0) {
 	if (param_count > 0) {
 		Entity *end = params->Tuple.variables[param_count-1];
 		Entity *end = params->Tuple.variables[param_count-1];
 		if (end->flags&EntityFlag_CVarArg) {
 		if (end->flags&EntityFlag_CVarArg) {
-			if (cc == ProcCC_StdCall || cc == ProcCC_CDecl) {
+			switch (cc) {
+			default:
 				type->Proc.c_vararg = true;
 				type->Proc.c_vararg = true;
-			} else {
+				break;
+			case ProcCC_Odin:
+			case ProcCC_Contextless:
 				error(end->token, "Calling convention does not support #c_vararg");
 				error(end->token, "Calling convention does not support #c_vararg");
+				break;
 			}
 			}
 		}
 		}
 	}
 	}