projects
/
cparser
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
do not fail when initializing tokens multiple times
[cparser]
/
format_check.c
diff --git
a/format_check.c
b/format_check.c
index
f808b11
..
4c1d670
100644
(file)
--- a/
format_check.c
+++ b/
format_check.c
@@
-127,12
+127,11
@@
static int internal_check_printf_format(const expression_t *fmt_expr,
return nt > nf ? nt : nf;
}
return nt > nf ? nt : nf;
}
- if (fmt_expr->kind != EXPR_STRING_LITERAL
- && fmt_expr->kind != EXPR_WIDE_STRING_LITERAL)
+ if (fmt_expr->kind != EXPR_STRING_LITERAL)
return -1;
return -1;
- const char *string = fmt_expr->literal.value.begin;
- size_t size = fmt_expr->literal.value.size;
+ const char *string = fmt_expr->
string_
literal.value.begin;
+ size_t size = fmt_expr->
string_
literal.value.size;
const char *c = string;
const source_position_t *pos = &fmt_expr->base.source_position;
const char *c = string;
const source_position_t *pos = &fmt_expr->base.source_position;
@@
-144,10
+143,6
@@
static int internal_check_printf_format(const expression_t *fmt_expr,
continue;
fmt = *(++c);
continue;
fmt = *(++c);
- if (fmt == '\0') {
- warningf(WARN_FORMAT, pos, "dangling %% in format string");
- break;
- }
if (fmt == '%')
continue;
if (fmt == '%')
continue;
@@
-322,6
+317,10
@@
break_fmt_flags:
break;
}
break;
}
+ if (fmt == '\0') {
+ warningf(WARN_FORMAT, pos, "dangling %% in format string");
+ break;
+ }
type_t *expected_type;
type_qualifiers_t expected_qual = TYPE_QUALIFIER_NONE;
type_t *expected_type;
type_qualifiers_t expected_qual = TYPE_QUALIFIER_NONE;
@@
-600,12
+599,11
@@
static void check_scanf_format(const call_argument_t *arg,
fmt_expr = fmt_expr->unary.value;
}
fmt_expr = fmt_expr->unary.value;
}
- if (fmt_expr->kind != EXPR_STRING_LITERAL
- && fmt_expr->kind != EXPR_WIDE_STRING_LITERAL)
+ if (fmt_expr->kind != EXPR_STRING_LITERAL)
return;
return;
- const char *string = fmt_expr->literal.value.begin;
- size_t size = fmt_expr->literal.value.size;
+ const char *string = fmt_expr->
string_
literal.value.begin;
+ size_t size = fmt_expr->
string_
literal.value.size;
const char *c = string;
/* find the real args */
const char *c = string;
/* find the real args */