vala r2017 - in trunk: . gen-project gobject vala vapi vapigen
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r2017 - in trunk: . gen-project gobject vala vapi vapigen
- Date: Fri, 14 Nov 2008 18:13:48 +0000 (UTC)
Author: juergbi
Date: Fri Nov 14 18:13:48 2008
New Revision: 2017
URL: http://svn.gnome.org/viewvc/vala?rev=2017&view=rev
Log:
2008-11-14 JÃrg Billeter <j bitron ch>
* vala/valagenieparser.vala:
* vala/valainterface.vala:
* vala/valainterfacewriter.vala:
* vala/valaparser.vala:
* vala/valasemanticanalyzer.vala:
* gobject/valaccodeassignmentmodule.vala:
* gobject/valaccodebasemodule.vala:
* gobject/valaccodeinvocationexpressionmodule.vala:
* vapi/glib-2.0.vapi:
* vapigen/valagidlparser.vala:
* vapigen/valagirparser.vala:
* vapigen/valamarkupreader.vala:
* vapigen/valavapicheck.vala:
* gen-project/valaprojectgenerator.vala:
Do not use possibly uninitialized variables
Modified:
trunk/ChangeLog
trunk/gen-project/valaprojectgenerator.vala
trunk/gobject/valaccodeassignmentmodule.vala
trunk/gobject/valaccodebasemodule.vala
trunk/gobject/valaccodeinvocationexpressionmodule.vala
trunk/vala/valagenieparser.vala
trunk/vala/valainterface.vala
trunk/vala/valainterfacewriter.vala
trunk/vala/valaparser.vala
trunk/vala/valasemanticanalyzer.vala
trunk/vapi/glib-2.0.vapi
trunk/vapigen/valagidlparser.vala
trunk/vapigen/valagirparser.vala
trunk/vapigen/valamarkupreader.vala
trunk/vapigen/valavapicheck.vala
Modified: trunk/gen-project/valaprojectgenerator.vala
==============================================================================
--- trunk/gen-project/valaprojectgenerator.vala (original)
+++ trunk/gen-project/valaprojectgenerator.vala Fri Nov 14 18:13:48 2008
@@ -374,8 +374,7 @@
private string generate_source_file_header (string filename) {
var s = new StringBuilder ();
- TimeVal tv;
- tv.get_current_time ();
+ TimeVal tv = TimeVal ();
Date d = Date ();
d.set_time_val (tv);
Modified: trunk/gobject/valaccodeassignmentmodule.vala
==============================================================================
--- trunk/gobject/valaccodeassignmentmodule.vala (original)
+++ trunk/gobject/valaccodeassignmentmodule.vala Fri Nov 14 18:13:48 2008
@@ -70,6 +70,8 @@
cop = CCodeBinaryOperator.SHIFT_LEFT;
} else if (assignment.operator == AssignmentOperator.SHIFT_RIGHT) {
cop = CCodeBinaryOperator.SHIFT_RIGHT;
+ } else {
+ assert_not_reached ();
}
cexpr = new CCodeBinaryExpression (cop, (CCodeExpression) get_ccodenode (assignment.left), new CCodeParenthesizedExpression (cexpr));
}
Modified: trunk/gobject/valaccodebasemodule.vala
==============================================================================
--- trunk/gobject/valaccodebasemodule.vala (original)
+++ trunk/gobject/valaccodebasemodule.vala Fri Nov 14 18:13:48 2008
@@ -2338,7 +2338,7 @@
}
if (expr.symbol_reference == null) {
- CCodeFunctionCall creation_call;
+ CCodeFunctionCall creation_call = null;
// no creation method
if (expr.type_reference.data_type == glist_type ||
@@ -2616,6 +2616,8 @@
op = CCodeUnaryOperator.ADDRESS_OF;
} else if (expr.operator == UnaryOperator.OUT) {
op = CCodeUnaryOperator.ADDRESS_OF;
+ } else {
+ assert_not_reached ();
}
expr.ccodenode = new CCodeUnaryExpression (op, (CCodeExpression) expr.inner.ccodenode);
}
@@ -2743,6 +2745,8 @@
expr.ccodenode = new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, new CCodeParenthesizedExpression (new CCodeBinaryExpression (CCodeBinaryOperator.BITWISE_AND, new CCodeParenthesizedExpression (cright), new CCodeParenthesizedExpression (cleft))), new CCodeParenthesizedExpression (cleft));
return;
+ } else {
+ assert_not_reached ();
}
if (expr.operator == BinaryOperator.EQUALITY ||
@@ -2782,11 +2786,15 @@
left = ((CCodeIdentifier) cleft).name;
} else if (cleft is CCodeConstant) {
left = ((CCodeConstant) cleft).name;
+ } else {
+ assert_not_reached ();
}
if (cright is CCodeIdentifier) {
right = ((CCodeIdentifier) cright).name;
} else if (cright is CCodeConstant) {
right = ((CCodeConstant) cright).name;
+ } else {
+ assert_not_reached ();
}
expr.ccodenode = new CCodeConstant ("%s %s".printf (left, right));
Modified: trunk/gobject/valaccodeinvocationexpressionmodule.vala
==============================================================================
--- trunk/gobject/valaccodeinvocationexpressionmodule.vala (original)
+++ trunk/gobject/valaccodeinvocationexpressionmodule.vala Fri Nov 14 18:13:48 2008
@@ -73,7 +73,7 @@
requires_array_move = true;
}
- CCodeExpression instance;
+ CCodeExpression instance = null;
if (m != null && m.binding == MemberBinding.INSTANCE && !(m is CreationMethod)) {
instance = (CCodeExpression) ma.inner.ccodenode;
@@ -258,7 +258,7 @@
}
// call function
- LocalVariable ret_temp_var;
+ LocalVariable ret_temp_var = null;
if (m.return_type is VoidType) {
ccomma.append_expression (ccall_expr);
} else {
Modified: trunk/vala/valagenieparser.vala
==============================================================================
--- trunk/vala/valagenieparser.vala (original)
+++ trunk/vala/valagenieparser.vala Fri Nov 14 18:13:48 2008
@@ -886,7 +886,7 @@
Expression parse_array_creation_expression (SourceLocation begin, MemberAccess member) throws ParseError {
bool size_specified = false;
- Gee.List<Expression> size_specifier_list;
+ Gee.List<Expression> size_specifier_list = null;
bool first = true;
DataType element_type = UnresolvedType.new_from_expression (member);
@@ -1482,7 +1482,7 @@
&& current () != TokenType.WHEN
&& current () != TokenType.DEFAULT) {
try {
- Statement stmt;
+ Statement stmt = null;
bool is_decl = false;
comment = scanner.pop_comment ();
switch (current ()) {
@@ -2203,14 +2203,14 @@
}
} catch (ParseError e) {
int r;
- while (true) {
+ do {
r = recover ();
if (r == RecoveryState.STATEMENT_BEGIN) {
next ();
} else {
break;
}
- }
+ } while (true);
if (r == RecoveryState.EOF) {
return;
}
@@ -2792,7 +2792,7 @@
prop.get_accessor = new PropertyAccessor (true, false, false, block, get_src (accessor_begin));
prop.get_accessor.access = SymbolAccessibility.PUBLIC;
} else {
- bool _construct;
+ bool _construct = false;
if (accept (TokenType.SET)) {
if (readonly) {
throw new ParseError.SYNTAX (get_error ("set block not allowed for a read only property"));
Modified: trunk/vala/valainterface.vala
==============================================================================
--- trunk/vala/valainterface.vala (original)
+++ trunk/vala/valainterface.vala Fri Nov 14 18:13:48 2008
@@ -570,7 +570,7 @@
}
/* check prerequisites */
- Class prereq_class;
+ Class prereq_class = null;
foreach (DataType prereq in get_prerequisites ()) {
TypeSymbol class_or_interface = prereq.data_type;
/* skip on previous errors */
Modified: trunk/vala/valainterfacewriter.vala
==============================================================================
--- trunk/vala/valainterfacewriter.vala (original)
+++ trunk/vala/valainterfacewriter.vala Fri Nov 14 18:13:48 2008
@@ -156,7 +156,7 @@
}
bool first = true;
- string cheaders;
+ string cheaders = "";
foreach (string cheader in cl.get_cheader_filenames ()) {
if (first) {
cheaders = cheader;
@@ -273,7 +273,7 @@
}
var first = true;
- string cheaders;
+ string cheaders = "";
foreach (string cheader in st.get_cheader_filenames ()) {
if (first) {
cheaders = cheader;
@@ -351,7 +351,7 @@
write_indent ();
var first = true;
- string cheaders;
+ string cheaders = "";
foreach (string cheader in iface.get_cheader_filenames ()) {
if (first) {
cheaders = cheader;
@@ -432,7 +432,7 @@
write_indent ();
bool first = true;
- string cheaders;
+ string cheaders = "";
foreach (string cheader in en.get_cheader_filenames ()) {
if (first) {
cheaders = cheader;
@@ -507,7 +507,7 @@
write_indent ();
var first = true;
- string cheaders;
+ string cheaders = "";
foreach (string cheader in edomain.get_cheader_filenames ()) {
if (first) {
cheaders = cheader;
@@ -562,7 +562,7 @@
}
bool first = true;
- string cheaders;
+ string cheaders = "";
foreach (string cheader in c.get_cheader_filenames ()) {
if (first) {
cheaders = cheader;
@@ -623,7 +623,7 @@
}
bool first = true;
- string cheaders;
+ string cheaders = "";
foreach (string cheader in f.get_cheader_filenames ()) {
if (first) {
cheaders = cheader;
@@ -764,7 +764,7 @@
write_indent ();
var first = true;
- string cheaders;
+ string cheaders = "";
foreach (string cheader in cb.get_cheader_filenames ()) {
if (first) {
cheaders = cheader;
@@ -834,7 +834,7 @@
}
if (m.parent_symbol is Namespace) {
bool first = true;
- string cheaders;
+ string cheaders = "";
foreach (string cheader in m.get_cheader_filenames ()) {
if (first) {
cheaders = cheader;
Modified: trunk/vala/valaparser.vala
==============================================================================
--- trunk/vala/valaparser.vala (original)
+++ trunk/vala/valaparser.vala Fri Nov 14 18:13:48 2008
@@ -685,7 +685,7 @@
Expression parse_array_creation_expression (SourceLocation begin, MemberAccess member) throws ParseError {
bool size_specified = false;
- Gee.List<Expression> size_specifier_list;
+ Gee.List<Expression> size_specifier_list = null;
bool first = true;
DataType element_type = UnresolvedType.new_from_expression (member);
do {
@@ -1170,7 +1170,7 @@
&& current () != TokenType.CASE
&& current () != TokenType.DEFAULT) {
try {
- Statement stmt;
+ Statement stmt = null;
bool is_decl = false;
comment = scanner.pop_comment ();
switch (current ()) {
@@ -1788,14 +1788,14 @@
}
} catch (ParseError e) {
int r;
- while (true) {
+ do {
r = recover ();
if (r == RecoveryState.STATEMENT_BEGIN) {
next ();
} else {
break;
}
- }
+ } while (true);
if (r == RecoveryState.EOF) {
return;
}
Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala (original)
+++ trunk/vala/valasemanticanalyzer.vala Fri Nov 14 18:13:48 2008
@@ -599,7 +599,7 @@
Report.error (init.source_reference, "Access to private member `%s' denied".printf (init.symbol_reference.get_full_name ()));
return;
}
- DataType member_type;
+ DataType member_type = null;
if (init.symbol_reference is Field) {
var f = (Field) init.symbol_reference;
member_type = f.field_type;
Modified: trunk/vapi/glib-2.0.vapi
==============================================================================
--- trunk/vapi/glib-2.0.vapi (original)
+++ trunk/vapi/glib-2.0.vapi Fri Nov 14 18:13:48 2008
@@ -1545,6 +1545,8 @@
public long tv_usec;
[CCode (cname = "g_get_current_time")]
+ public TimeVal ();
+ [CCode (cname = "g_get_current_time")]
public void get_current_time ();
public void add (long microseconds);
[CCode (instance_pos = -1)]
Modified: trunk/vapigen/valagidlparser.vala
==============================================================================
--- trunk/vapigen/valagidlparser.vala (original)
+++ trunk/vapigen/valagidlparser.vala Fri Nov 14 18:13:48 2008
@@ -108,8 +108,7 @@
if (FileUtils.test (metadata_filename, FileTest.EXISTS)) {
try {
string metadata;
- ulong metadata_len;
- FileUtils.get_contents (metadata_filename, out metadata, out metadata_len);
+ FileUtils.get_contents (metadata_filename, out metadata, null);
foreach (string line in metadata.split ("\n")) {
if (line.has_prefix ("#")) {
Modified: trunk/vapigen/valagirparser.vala
==============================================================================
--- trunk/vapigen/valagirparser.vala (original)
+++ trunk/vapigen/valagirparser.vala Fri Nov 14 18:13:48 2008
@@ -320,7 +320,7 @@
start_element ("parameters");
next ();
while (current_token == MarkupTokenType.START_ELEMENT) {
- int array_length_idx = -1;
+ int array_length_idx;
var param = parse_parameter (out array_length_idx);
if (array_length_idx != -1) {
array_length_parameters.add (array_length_idx);
@@ -353,7 +353,11 @@
}
FormalParameter parse_parameter (out int array_length_idx = null) {
- FormalParameter param = null;
+ FormalParameter param;
+
+ if (&array_length_idx != null) {
+ array_length_idx = -1;
+ }
start_element ("parameter");
string name = reader.get_attribute ("name");
@@ -841,8 +845,7 @@
if (FileUtils.test (metadata_filename, FileTest.EXISTS)) {
try {
string metadata;
- ulong metadata_len;
- FileUtils.get_contents (metadata_filename, out metadata, out metadata_len);
+ FileUtils.get_contents (metadata_filename, out metadata, null);
foreach (string line in metadata.split ("\n")) {
if (line.has_prefix ("#")) {
Modified: trunk/vapigen/valamarkupreader.vala
==============================================================================
--- trunk/vapigen/valamarkupreader.vala (original)
+++ trunk/vapigen/valamarkupreader.vala Fri Nov 14 18:13:48 2008
@@ -96,7 +96,7 @@
space ();
- MarkupTokenType type;
+ MarkupTokenType type = MarkupTokenType.NONE;
char* begin = current;
token_begin.pos = begin;
token_begin.line = line;
Modified: trunk/vapigen/valavapicheck.vala
==============================================================================
--- trunk/vapigen/valavapicheck.vala (original)
+++ trunk/vapigen/valavapicheck.vala Fri Nov 14 18:13:48 2008
@@ -129,7 +129,7 @@
private int check_metadata () {
try {
var metafile = new IOChannel.file (metadata.filename, "r");
- string line = null;
+ string line;
int lineno = 1;
while (IOStatus.NORMAL == metafile.read_line (out line, null, null)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]