[vala/staging: 6/7] Warn about non-literal printf format strings



commit 1eed21c9ba7415501d33f4904845f6f4ab9e83e6
Author: Jürg Billeter <j bitron ch>
Date:   Tue Nov 1 18:02:08 2016 +0100

    Warn about non-literal printf format strings

 vala/valamethodcall.vala               |    2 ++
 vala/valaobjectcreationexpression.vala |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index cacb41d..97db2fb 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -460,6 +460,8 @@ public class Vala.MethodCall : Expression {
                                if (!context.analyzer.check_print_format (format, arg_it, source_reference)) {
                                        return false;
                                }
+                       } else {
+                               Report.warning (source_reference, "format not a string literal, argument 
types not checked");
                        }
                }
 
diff --git a/vala/valaobjectcreationexpression.vala b/vala/valaobjectcreationexpression.vala
index 4e75824..eeb9c1e 100644
--- a/vala/valaobjectcreationexpression.vala
+++ b/vala/valaobjectcreationexpression.vala
@@ -428,6 +428,8 @@ public class Vala.ObjectCreationExpression : Expression {
                                                error = true;
                                                return false;
                                        }
+                               } else {
+                                       Report.warning (source_reference, "format not a string literal, 
argument types not checked");
                                }
 
                                arg_it = get_argument_list ().iterator ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]