[vala] Do not warn when internal member is unused with --internal-header



commit 67289a76c898fc17f15187ff8fc170d54c5f04ad
Author: Jürg Billeter <j bitron ch>
Date:   Sun Mar 21 12:09:17 2010 +0100

    Do not warn when internal member is unused with --internal-header
    
    Fixes bug 613035.

 vala/valaflowanalyzer.vala |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/vala/valaflowanalyzer.vala b/vala/valaflowanalyzer.vala
index a90e157..96bf759 100644
--- a/vala/valaflowanalyzer.vala
+++ b/vala/valaflowanalyzer.vala
@@ -131,7 +131,11 @@ public class Vala.FlowAnalyzer : CodeVisitor {
 
 	public override void visit_field (Field f) {
 		if (f.is_internal_symbol () && !f.used) {
-			Report.warning (f.source_reference, "field `%s' never used".printf (f.get_full_name ()));
+			if (!f.is_private_symbol () && context.internal_header_filename != null) {
+				// do not warn if internal member may be used outside this compilation unit
+			} else {
+				Report.warning (f.source_reference, "field `%s' never used".printf (f.get_full_name ()));
+			}
 		}
 	}
 
@@ -158,7 +162,11 @@ public class Vala.FlowAnalyzer : CodeVisitor {
 		if (m.is_internal_symbol () && !m.used && !m.entry_point
 		    && !m.overrides && (m.base_interface_method == null || m.base_interface_method == m)
 		    && !(m is CreationMethod)) {
-			Report.warning (m.source_reference, "method `%s' never used".printf (m.get_full_name ()));
+			if (!m.is_private_symbol () && context.internal_header_filename != null) {
+				// do not warn if internal member may be used outside this compilation unit
+			} else {
+				Report.warning (m.source_reference, "method `%s' never used".printf (m.get_full_name ()));
+			}
 		}
 
 		if (m.body == null) {



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