Skip to content

Commit 9563019

Browse files
committed
Preparing for Adept 2.4 Release
1 parent accb84f commit 9563019

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

src/INFER/infer.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,6 @@ errorcode_t infer_in_funcs(infer_ctx_t *ctx, ast_func_t *funcs, length_t funcs_l
100100
const bool force_used = ctx->compiler->ignore & COMPILER_IGNORE_UNUSED
101101
? true
102102
: function->traits & AST_FUNC_MAIN || (a == 0 && strcmp(function->arg_names[a], "this") == 0);
103-
104-
if(strcmp(function->arg_names[a], "this") == 0 && a != 0)
105-
printf("%zu\n", a);
106103

107104
infer_var_scope_add_variable(&func_scope, function->arg_names[a], &function->arg_types[a], function->arg_sources[a], force_used, false);
108105
}
@@ -1292,10 +1289,9 @@ void infer_var_list_nearest(infer_var_list_t *list, const char *name, char **out
12921289
*out_nearest_name = NULL;
12931290
if(out_distance) *out_distance = -1;
12941291

1295-
// Stack array to contain all of the distances
1296-
// NOTE: This may be bad if the length of the variable list is really long
1292+
// Heap-allocated array to contain all of the distances
12971293
length_t list_length = list->length;
1298-
int distances[list_length];
1294+
int *distances = malloc(sizeof(int) * list_length);
12991295

13001296
// Calculate distance for every variable name
13011297
for(length_t i = 0; i != list_length; i++){
@@ -1315,6 +1311,8 @@ void infer_var_list_nearest(infer_var_list_t *list, const char *name, char **out
13151311

13161312
// Output minimum distance if a name close enough was found
13171313
if(out_distance && *out_nearest_name) *out_distance = minimum;
1314+
1315+
free(distances);
13181316
}
13191317

13201318
void infer_mention_expression_literal_type(infer_ctx_t *ctx, unsigned int expression_literal_id){

src/IR/ir.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@
88

99
strong_cstr_t ir_value_str(ir_value_t *value){
1010
if(value == NULL){
11-
terminal_set_color(TERMINAL_COLOR_RED);
12-
printf("INTERNAL ERROR: The value passed to ir_value_str is NULL, a crash will probably follow...\n");
13-
terminal_set_color(TERMINAL_COLOR_DEFAULT);
11+
internalerrorprintf("The value passed to ir_value_str is NULL, a crash will probably follow...\n");
1412
}
1513

1614
if(value->type == NULL){
17-
terminal_set_color(TERMINAL_COLOR_RED);
18-
printf("INTERNAL ERROR: The value passed to ir_value_str has a type pointer to NULL, a crash will probably follow...\n");
19-
terminal_set_color(TERMINAL_COLOR_DEFAULT);
15+
internalerrorprintf("The value passed to ir_value_str has a type pointer to NULL, a crash will probably follow...\n");
2016
}
2117

2218
char *typename = ir_type_str(value->type);

src/UTIL/filename.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ void filename_auto_ext(strong_cstr_t *out_filename, unsigned int cross_compile_f
223223

224224
if(mode == FILENAME_AUTO_EXECUTABLE){
225225
#if defined(__WIN32__)
226+
// Ignore unused variable 'cross_compile_for'
227+
(void) cross_compile_for;
228+
226229
// Windows file extensions
227230
filename_append_if_missing(out_filename, ".exe");
228231
return;

src/UTIL/memory.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ void memory_free(void* data){
9191
}
9292

9393
#ifdef TRACK_MEMORY_FILE_AND_LINE
94-
printf("INTERNAL ERROR: Tried to free memory that isn't in the global memblocks table! (Address: %p) - %s %d\n", data, file, line);
94+
internalerrorprintf("Tried to free memory that isn't in the global memblocks table! (Address: %p) - %s %d\n", data, file, line);
9595
#else // TRACK_MEMORY_FILE_AND_LINE
96-
printf("INTERNAL ERROR: Tried to free memory that isn't in the global memblocks table! (Address: %p)\n", data);
96+
internalerrorprintf("Tried to free memory that isn't in the global memblocks table! (Address: %p)\n", data);
9797
#endif
9898
return;
9999
}

0 commit comments

Comments
 (0)