On 26/10/18 16:26, Ben Dooks wrote:
+static int decompose_format_printf(const char *string, struct symbol **result)
+{
+ int count = 0;
+
+ for (; string[0] != '\0'; string++) {
+ if (string[0] == '%') {
+ int len = 0;
+ struct symbol *sym = NULL;
+ if (string[1] == '%') {
+ string++;
+ continue;
+ }
+
+ /* get rid of any formatting width bits */
+ while (isdigit(string[1]) || string[1] == '+' || string[1] == '-')
+ string++;
+
+ switch (string[1]) {
+ case 'C':
+ /* TODO - same as lc */
+ break;
+ case 'c':
+ /* TODO - can take l modifier */
+ sym = &char_ctype;
+ break;
+ case 'f':
+ case 'g':
+ sym = &double_ctype;
+ break;
+ case 'h':
+ /* TODO hh */
+ len = -1;
+ break;
+ case 'j': /* ignore intmax/uintmax for the moment */
+ break;
+ case 'L':
+ sym = &ldouble_ctype;
+ break;
+ case 'l':
+ len++;
+ break;
+ case 'p':
+ /* TODO - deal with void * not being de-referenced in some cases*/
+ sym = &ptr_ctype;
+ break;
+ case 'q':
For the case of %p, is MOD_NODEREF sufficient, or should we also have
a flag (either MOD_NOADDRSPACE) or some other way of specifying the
type is safe for any address space?
I added a ptr_ctype_noderef, but still get:
test.c:27:37: warning: incorrect type in argument 3 (different address
spaces)
test.c:27:37: expected string
test.c:27:37: got void [noderef] <asn:1>*b
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
https://www.codethink.co.uk/privacy.html