<commit_before>#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>

#include "../util/where.h"
#include "../util/util.h"

#include "data_structs.h"
#include "expr.h"
#include "sue.h"
#include "type_ref.h"
#include "decl.h"
#include "const.h"
#include "funcargs.h"
#include "cc1.h" /* fopt_mode */

#include "type_ref_is.h"

static enum type_cmp type_ref_cmp_r(
		type_ref *const orig_a,
		type_ref *const orig_b,
		enum type_cmp_opts opts)
{
	enum type_cmp ret;
	type_ref *a, *b;

	if(!orig_a || !orig_b)
		return orig_a == orig_b ? TYPE_EQUAL : TYPE_NOT_EQUAL;

	a = type_ref_skip_tdefs_casts(orig_a);
	b = type_ref_skip_tdefs_casts(orig_b);

	/* array/func decay takes care of any array->ptr checks */
	if(a->type != b->type){
		/* allow int <-> ptr */
		if((type_ref_is_ptr(a) && type_ref_is_integral(b))
		|| (type_ref_is_ptr(b) && type_ref_is_integral(a)))
		{
			return TYPE_CONVERTIBLE_EXPLICIT;
		}

		/* allow void <- anything */
		if(type_ref_is_void(a))
			return TYPE_CONVERTIBLE_IMPLICIT;
<commit_msg>Pointers can convert implicitly to _Bool<commit_after>#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>

#include "../util/where.h"
#include "../util/util.h"

#include "data_structs.h"
#include "expr.h"
#include "sue.h"
#include "type_ref.h"
#include "decl.h"
#include "const.h"
#include "funcargs.h"
#include "cc1.h" /* fopt_mode */

#include "type_ref_is.h"

static enum type_cmp type_ref_cmp_r(
		type_ref *const orig_a,
		type_ref *const orig_b,
		enum type_cmp_opts opts)
{
	enum type_cmp ret;
	type_ref *a, *b;

	if(!orig_a || !orig_b)
		return orig_a == orig_b ? TYPE_EQUAL : TYPE_NOT_EQUAL;

	a = type_ref_skip_tdefs_casts(orig_a);
	b = type_ref_skip_tdefs_casts(orig_b);

	/* array/func decay takes care of any array->ptr checks */
	if(a->type != b->type){
		/* allow _Bool <- pointer */
		if(type_ref_is_type(a, type__Bool) && type_ref_is_ptr(b))
			return TYPE_CONVERTIBLE_IMPLICIT;

		/* allow int <-> ptr */
		if((type_ref_is_ptr(a) && type_ref_is_integral(b))
		|| (type_ref_is_ptr(b) && type_ref_is_integral(a)))
		{
			return TYPE_CONVERTIBLE_EXPLICIT;
		}

		/* allow void <- anything */
		if(type_ref_is_void(a))
			return TYPE_CONVERTIBLE_IMPLICIT;

{'fraction_non_alphanumeric': 0.15195632393084624, 'fraction_numerical': 0.0009099181073703367, 'mean_word_length': 4.483790523690773, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1412702', 'n_tokens_mistral': 989, 'n_tokens_neox': 921, 'n_words': 181}