diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2007-06-26 16:06:32 -0400 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2007-06-26 17:31:50 -0400 |
| commit | a194f3e092f7b1c31502564b3fd7fcfce0910aff (patch) | |
| tree | c4982b8a7fda7d28098e6eabd1e2f4f9ed6a9856 /inline.c | |
| parent | 361908cf099b011f173a1ea3053f84eb8a08841e (diff) | |
| download | sparse-dev-a194f3e092f7b1c31502564b3fd7fcfce0910aff.tar.gz | |
[PATCH] implement __builtin_offsetof()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'inline.c')
| -rw-r--r-- | inline.c | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -237,7 +237,23 @@ static struct expression * copy_expression(struct expression *expr) expr->init_expr = val; break; } - + case EXPR_OFFSETOF: { + struct expression *val = copy_expression(expr->down); + if (expr->op == '.') { + if (expr->down != val) { + expr = dup_expression(expr); + expr->down = val; + } + } else { + struct expression *idx = copy_expression(expr->index); + if (expr->down != val || expr->index != idx) { + expr = dup_expression(expr); + expr->down = val; + expr->index = idx; + } + } + break; + } default: warning(expr->pos, "trying to copy expression type %d", expr->type); } |
