~pixelherodev/c3lib

87e44b3d6071db5201fdbfab018fe73c78959e4c — Noam Preil 2 months ago e790262
[sema/scope] add disabled warnings
1 files changed, 16 insertions(+), 0 deletions(-)

M sema/scope.c
M sema/scope.c => sema/scope.c +16 -0
@@ 9,6 9,9 @@
#include "../stb_ds.h"
#include "scope.h"

#undef WARN
#define WARN(...)

struct c3scope{
	struct c3scope_rc{
		// a value contained within the scope


@@ 69,6 72,11 @@ scope_find_decl(uint32_t scope_handle, uint32_t ident, uint32_t *parent, int onl
	uint32_t i;
	struct c3scope *scope;
	uint32_t t_ident;
	if(c3nodechild(*ctx.c3, ident, 0) != -1){
		WARN("finding decl by ident %d: '%s' in scope %d", ident, h_c3str(*ctx.c3, c3nodechild(*ctx.c3, ident, 0)), scope_handle);
		}
	else
		FATAL("bad ident: %d", ident);
	c3tag tag;
	scope = &ctx.scopes[scope_handle];
	for(i = 0; i < stbds_hmlenu(scope->values); i += 1){


@@ 78,9 86,12 @@ scope_find_decl(uint32_t scope_handle, uint32_t ident, uint32_t *parent, int onl
		if(scope->values[i].value == 0 && only_analyzed)
			continue;
		t_ident = c3nodechild(*ctx.c3, scope->values[i].key, 0);
		WARN("checking against %d", t_ident);
		WARN("str: '%s'", h_c3str(*ctx.c3, c3nodechild(*ctx.c3, t_ident, 0)));
		if(t_ident == ident){
			if(parent != NULL)
				*parent = scope_handle;
			WARN("Found tag: %s", c3tagstr(tag));
			return scope->values[i].key;
		}
	}


@@ 117,6 128,11 @@ scope_mark_used(uint32_t handle, uint32_t value)
int
scope_insert(uint32_t scope, uint32_t value)
{
	uint32_t ident = c3nodechild(*ctx.c3, value, 0);
	if(ident != -1 && c3nodetag(*ctx.c3, ident) == C3_IDENT)
		ident = c3nodechild(*ctx.c3, ident, 0);
	if(ident != -1)
		WARN("inserting '%s' into scope %d", h_c3str(*ctx.c3, ident), scope);
	stbds_hmput(ctx.scopes[scope].values, value, 0);
	return 1;
}