summaryrefslogtreecommitdiffstats
path: root/clang-plugin
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-11 17:26:06 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-11 17:26:06 +0000
commit8ca7e0347adc650e6f48de1156855d02194c88eb (patch)
treea7289fa32c20246ff1bbdf801afe3ebb0dcede43 /clang-plugin
parente1bc656430d0f68a6676b39e6e08d58903dafe40 (diff)
downloadrspamd-8ca7e0347adc650e6f48de1156855d02194c88eb.tar.gz
rspamd-8ca7e0347adc650e6f48de1156855d02194c88eb.zip
Add gboolean check support.
Diffstat (limited to 'clang-plugin')
-rw-r--r--clang-plugin/printf_check.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/clang-plugin/printf_check.cc b/clang-plugin/printf_check.cc
index 5d0411ab4..821aae852 100644
--- a/clang-plugin/printf_check.cc
+++ b/clang-plugin/printf_check.cc
@@ -75,6 +75,9 @@ namespace rspamd {
static bool int32_arg_handler (const Expr *arg,
struct PrintfArgChecker *ctx);
+ static bool gboolean_arg_handler (const Expr *arg,
+ struct PrintfArgChecker *ctx);
+
static bool tok_arg_handler (const Expr *arg,
struct PrintfArgChecker *ctx);
@@ -187,6 +190,9 @@ namespace rspamd {
case 'D':
return llvm::make_unique<PrintfArgChecker> (int32_arg_handler,
this->pcontext, this->ci);
+ case 'b':
+ return llvm::make_unique<PrintfArgChecker> (gboolean_arg_handler,
+ this->pcontext, this->ci);
case 'T':
return llvm::make_unique<PrintfArgChecker> (tok_arg_handler,
this->pcontext, this->ci);
@@ -350,7 +356,7 @@ namespace rspamd {
format_specs = {
's', 'd', 'l', 'L', 'v', 'V', 'f', 'F', 'g', 'G',
- 'T', 'z', 'D', 'c', 'p', 'P', 'e'
+ 'T', 'z', 'D', 'c', 'p', 'P', 'e', 'b'
};
};
@@ -675,6 +681,15 @@ namespace rspamd {
}
static bool
+ gboolean_arg_handler (const Expr *arg, struct PrintfArgChecker *ctx)
+ {
+ return check_builtin_type (arg,
+ ctx,
+ {BuiltinType::Kind::Int}, // gboolean is int in fact
+ "%b");
+ }
+
+ static bool
check_struct_type (const Expr *arg, struct PrintfArgChecker *ctx,
const std::string &sname, const std::string &fmt)
{