coan prints error when meets ", ##VA_ARGS"
"The C preprocessor chainsaw"
Brought to you by:
imkinghan
V6.0.1 coan can not parse "##VA_ARGS" of preprocessor.
If there are "#define FOO(a, ...) bar(a,##VA_ARGS)" codes in source, it will print error although it is appropriate code.
And, I think that it relate to
{
size_t mark = pos;
ptrdiff_t p(pos);
while (--p >= 0 && isspace(_fmt[p])){}
if (p < 0) {
throw error_misplaced_token_paste();
}
pos = p;
size_t i_off;
size_t h_off;
if (specifier::get_ending_at(_fmt,pos,i_off,h_off) != string::npos) {
_fmt[h_off] = char(handling::substitute_arg);
} else if (!identifier::is_valid_char(_fmt[pos]) && _fmt[pos] != '#') {
// THIS CONDITION IS RELATED WITH ", ##VA_ARGS".
throw error_bad_token_paste();
}
size_t start_cut = pos + 1;
pos = mark + 2;
for ( ;pos < _fmt.length() && isspace(_fmt[pos]); ++pos){}
if (pos >= _fmt.length()) {
throw error_misplaced_token_paste();
}
if (specifier::get_at(_fmt,pos,i_off,h_off) != string::npos) {
_fmt[h_off] = char(handling::substitute_arg);
} else if (!identifier::is_valid_char(_fmt[pos]) && _fmt[pos] != '#') {
throw error_bad_token_paste();
}
size_t cut_len = pos - start_cut;
_fmt.erase(start_cut,cut_len);
return -cut_len;
}
Thank you.
You reference VA_ARGS, but that has no special meaning in C. Are you
thinking of VA_ARGS (with double leading and trailing underscores)?
Would the code work differently if you spelled it that way?
On Sun, Jan 28, 2018 at 8:55 PM, Moonhee Lee <lunarvel@users.sourceforge.net
--
Jonathan Leffler jonathan.leffler@gmail.com #include <disclaimer.h>
Guardian of DBD::Informix - v2015.1101 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."</disclaimer.h>
Related
bugs: #91
Oh, it's my fault obviously.
replace "
VA_ARGS" to "__VA_ARGS__"Thank you.
Last edit: Moonhee Lee 2018-01-30