Skip to content

Commit

Permalink
Don't always assert
Browse files Browse the repository at this point in the history
This removes the inclusion of PONY_ALWAYS_ASSERT when building and
adds the small changes needed to compile with that change.

We haven't been running with PONY_NDEBUG on for a long time as
PONY_ALWAYS_ASSERT "turns off" PONY_NDEBUG. This means that for the
most part, config=release has result in debug versions of the runtime.
  • Loading branch information
SeanTAllen committed May 11, 2022
1 parent c17c86d commit 8204529
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/libponyc/ast/ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ static void set_scope_and_parent(ast_t* ast, ast_t* parent)
// Set the scope for the given node, but set it no have no parent
static void set_scope_no_parent(ast_t* ast, ast_t* scope)
{
ast = NULL;
pony_assert(ast != NULL);
pony_assert(!ast->frozen);

Expand Down Expand Up @@ -1613,6 +1612,7 @@ bool ast_is_frozen(ast_t* ast)
#ifndef PONY_NDEBUG
return ast->frozen;
#else
(void)ast;
return false;
#endif
}
Expand Down
3 changes: 2 additions & 1 deletion src/libponyc/ast/token.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,10 @@ static void token_docstring_signature_serialise_trace(pony_ctx_t* ctx,
void* object)
{
(void)ctx;
(void)object;

token_t* token = (token_t*)object;

(void)token;
pony_assert(token->id == TK_STRING);
}

Expand Down
1 change: 1 addition & 0 deletions src/libponyc/codegen/gencall.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,7 @@ static LLVMTypeRef ffi_return_type(compile_t* c, reach_type_t* t,

if(t->underlying == TK_TUPLETYPE)
{
(void)intrinsic;
pony_assert(intrinsic);

// Can't use the named type. Build an unnamed type with the same elements.
Expand Down
1 change: 1 addition & 0 deletions src/libponyc/codegen/genreference.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ LLVMValueRef gen_fieldembed(compile_t* c, ast_t* ast)
static LLVMValueRef make_tupleelemptr(compile_t* c, LLVMValueRef l_value,
ast_t* l_type, ast_t* right)
{
(void)l_type;
pony_assert(ast_id(l_type) == TK_TUPLETYPE);
int index = (int)ast_int(right)->low;

Expand Down
1 change: 1 addition & 0 deletions src/libponyc/expr/reference.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ bool expr_dontcareref(pass_opt_t* opt, ast_t* ast)
bool expr_local(pass_opt_t* opt, ast_t* ast)
{
(void)opt;
(void)ast;
pony_assert(ast_type(ast) != NULL);

return true;
Expand Down
1 change: 1 addition & 0 deletions src/libponyc/pass/expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ ast_t* find_antecedent_type(pass_opt_t* opt, ast_t* ast, bool* is_recovered)
case TK_FUN:
{
ast_t* body = ast_childidx(parent, 6);
(void)body;
pony_assert(ast == body);

ast_t* ret_type = ast_childidx(parent, 4);
Expand Down
1 change: 1 addition & 0 deletions src/libponyc/pkg/program.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ const char* program_signature(ast_t* program)

blake2b_state hash_state;
int status = blake2b_init(&hash_state, SIGNATURE_LENGTH);
(void)status;
pony_assert(status == 0);

package_group_list_t* iter = data->package_groups;
Expand Down

0 comments on commit 8204529

Please sign in to comment.