Debian Codegraph @

src/typesystem.c

raw symbols SCIP
1 // ACME - a crossassembler for producing 6502/65c02/65816/65ce02 code.
2 // Copyright (C) 1998-2024 Marco Baye
3 // Have a look at "acme.c" for further info
4 //
5 // type system stuff
6 #include "typesystem.h"
7 #include "global.h"
8
9
10 // Functions
11
12 // warn if result is not integer
13 void typesystem_want_nonaddr(struct number *result)
14 {
15 if (!config.warn_on_type_mismatch)
16 return;
17
18 if (result->ntype == NUMTYPE_UNDEFINED)
19 return;
20
21 if (result->addr_refs != 0) {
22 throw_finalpass_warning("Wrong type - expected integer.");
23 //printf("refcount should be 0, but is %d\n", result->addr_refs);
24 }
25 }
26
27 // warn if result is not address
28 void typesystem_want_addr(struct number *result)
29 {
30 if (!config.warn_on_type_mismatch)
31 return;
32
33 if (result->ntype == NUMTYPE_UNDEFINED)
34 return;
35
36 if (result->addr_refs != 1) {
37 throw_finalpass_warning("Wrong type - expected address.");
38 //printf("refcount should be 1, but is %d\n", result->addr_refs);
39 }
40 }