[vala] Drop warnings about unused internal symbols when using fast vapi files



commit d07f2e54b7be3ad54cd8be12f9e2d926c1263021
Author: JÃrg Billeter <j bitron ch>
Date:   Mon Aug 6 14:00:40 2012 +0200

    Drop warnings about unused internal symbols when using fast vapi files
    
    It is impossible to determine whether internal symbols are used when
    using fast vapi files.
    
    Fixes bug 680218.

 compiler/valacompiler.vala |    3 ++-
 vala/valacodecontext.vala  |    4 +++-
 vala/valaflowanalyzer.vala |    4 ++--
 3 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala
index c30614f..c1c9f6f 100644
--- a/compiler/valacompiler.vala
+++ b/compiler/valacompiler.vala
@@ -1,6 +1,6 @@
 /* valacompiler.vala
  *
- * Copyright (C) 2006-2010  JÃrg Billeter
+ * Copyright (C) 2006-2012  JÃrg Billeter
  * Copyright (C) 1996-2002, 2004, 2005, 2006 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
@@ -266,6 +266,7 @@ class Vala.Compiler {
 				var source_file = new SourceFile (context, SourceFileType.FAST, rpath);
 				context.add_source_file (source_file);
 			}
+			context.use_fast_vapi = true;
 		}
 		
 		if (context.report.get_errors () > 0 || (fatal_warnings && context.report.get_warnings () > 0)) {
diff --git a/vala/valacodecontext.vala b/vala/valacodecontext.vala
index e68cf41..e716b33 100644
--- a/vala/valacodecontext.vala
+++ b/vala/valacodecontext.vala
@@ -1,6 +1,6 @@
 /* valacodecontext.vala
  *
- * Copyright (C) 2006-2009  JÃrg Billeter
+ * Copyright (C) 2006-2012  JÃrg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -166,6 +166,8 @@ public class Vala.CodeContext {
 
 	public bool nostdpkg { get; set; }
 
+	public bool use_fast_vapi { get; set; }
+
 	/**
 	 * Returns true if the target version of glib is greater than or 
 	 * equal to the specified version.
diff --git a/vala/valaflowanalyzer.vala b/vala/valaflowanalyzer.vala
index b059bbd..4528337 100644
--- a/vala/valaflowanalyzer.vala
+++ b/vala/valaflowanalyzer.vala
@@ -140,7 +140,7 @@ public class Vala.FlowAnalyzer : CodeVisitor {
 
 	public override void visit_field (Field f) {
 		if (f.is_internal_symbol () && !f.used) {
-			if (!f.is_private_symbol () && context.internal_header_filename != null) {
+			if (!f.is_private_symbol () && (context.internal_header_filename != null || context.use_fast_vapi)) {
 				// 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 ()));
@@ -166,7 +166,7 @@ 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)) {
-			if (!m.is_private_symbol () && context.internal_header_filename != null) {
+			if (!m.is_private_symbol () && (context.internal_header_filename != null || context.use_fast_vapi)) {
 				// 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 ()));



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