Unified · Split
| @@ -7,6 +7,7 @@ version 0.9.17: · 6 unmodified lines | |||
| 7 | - function parameters must be converted to pointers (signaled by Neil Brown) | 7 | - function parameters must be converted to pointers (signaled by Neil Brown) |
| 8 | - sanitized string and character constant parsing | 8 | - sanitized string and character constant parsing |
| 9 | - fixed comment parse (signaled by Damian M Gryski) | 9 | - fixed comment parse (signaled by Damian M Gryski) |
| 10 | - fixed macro function bug (signaled by Philippe Ribet) | ||
| 10 | 11 | ||
| 11 | version 0.9.16: | 12 | version 0.9.16: |
| 12 | 13 | ||
| @@ -3749,7 +3749,14 @@ static int macro_subst_tok(TokenString *tok_str, · 3748 unmodified lines | |||
| 3749 | next token. XXX: find better solution */ | 3749 | next token. XXX: find better solution */ |
| 3750 | if (macro_ptr) { | 3750 | if (macro_ptr) { |
| 3751 | t = *macro_ptr; | 3751 | t = *macro_ptr; |
| 3752 | if (t == 0) { | ||
| 3753 | /* end of macro stream: we must look at the token | ||
| 3754 | after in the file */ | ||
| 3755 | macro_ptr = NULL; | ||
| 3756 | goto parse_stream; | ||
| 3757 | } | ||
| 3752 | } else { | 3758 | } else { |
| 3759 | parse_stream: | ||
| 3753 | /* XXX: incorrect with comments */ | 3760 | /* XXX: incorrect with comments */ |
| 3754 | ch = file->buf_ptr[0]; | 3761 | ch = file->buf_ptr[0]; |
| 3755 | while (is_space(ch) || ch == '\n') | 3762 | while (is_space(ch) || ch == '\n') |
| @@ -3981,6 +3988,10 @@ static void macro_subst(TokenString *tok_str, · 225 unmodified lines | |||
| 3981 | if (macro_str1) | 3988 | if (macro_str1) |
| 3982 | ptr = macro_str1; | 3989 | ptr = macro_str1; |
| 3983 | while (1) { | 3990 | while (1) { |
| 3991 | /* NOTE: ptr == NULL can only happen if tokens are read from | ||
| 3992 | file stream due to a macro function call */ | ||
| 3993 | if (ptr == NULL) | ||
| 3994 | break; | ||
| 3984 | TOK_GET(t, ptr, cval); | 3995 | TOK_GET(t, ptr, cval); |
| 3985 | if (t == 0) | 3996 | if (t == 0) |
| 3986 | break; | 3997 | break; |