Skip to content

Commit e79d8a2

Browse files
committed
Output the input up to that point before macro expansion
1 parent 8ded5e1 commit e79d8a2

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

src/cpp/preprocessor.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,16 +167,13 @@ static void process_line(const char *line, Stream *stream) {
167167
match(TK_IDENT);
168168
match(TK_RPAR);
169169
} else if ((macro = can_expand_ident(ident->ident)) != NULL) {
170-
const char *p = begin;
171-
begin = ident->end; // Update for EOF callback.
170+
if (ident->begin != begin)
171+
fwrite(begin, ident->begin - begin, 1, pp_ofp);
172172

173173
Vector *tokens = new_vector();
174174
vec_push(tokens, ident);
175175
macro_expand(tokens);
176176

177-
if (ident->begin != p)
178-
fwrite(p, ident->begin - p, 1, pp_ofp);
179-
180177
// Everything should have been expanded, so output
181178
for (int i = 0; i < tokens->len; ++i) {
182179
const Token *tok = tokens->data[i];

0 commit comments

Comments
 (0)