소스 검색

give deprecation warnings by default, allow -D no-deprecation-warnings

Simon Krajewski 11 년 전
부모
커밋
4fa68a94d2
2개의 변경된 파일4개의 추가작업 그리고 6개의 파일을 삭제
  1. 3 3
      common.ml
  2. 1 3
      filters.ml

+ 3 - 3
common.ml

@@ -171,7 +171,6 @@ module Define = struct
 		| Dce
 		| DceDebug
 		| Debug
-		| DeprecationWarnings
 		| Display
 		| DllExport
 		| DllImport
@@ -201,6 +200,7 @@ module Define = struct
 		| NetTarget
 		| NoCompilation
 		| NoCOpt
+		| NoDeprecationWarnings
 		| NoFlashOverride
 		| NoDebug
 		| NoInline
@@ -244,7 +244,6 @@ module Define = struct
 		| Dce -> ("dce","The current DCE mode")
 		| DceDebug -> ("dce_debug","Show DCE log")
 		| Debug -> ("debug","Activated when compiling with -debug")
-		| DeprecationWarnings -> ("deprecation-warnings","Warn if fields annotated with @:deprecated are used")
 		| Display -> ("display","Activated during completion")
 		| DllExport -> ("dll_export", "GenCPP experimental linking")
 		| DllImport -> ("dll_import", "GenCPP experimental linking")
@@ -275,6 +274,7 @@ module Define = struct
 		| NoCompilation -> ("no-compilation","Disable CPP final compilation")
 		| NoCOpt -> ("no_copt","Disable completion optimization (for debug purposes)")
 		| NoDebug -> ("no_debug","Remove all debug macros from cpp output")
+		| NoDeprecationWarnings -> ("no-deprecation-warnings","Do not warn if fields annotated with @:deprecated are used")
 		| NoFlashOverride -> ("no-flash-override", "Change overrides on some basic classes into HX suffixed methods, flash only")
 		| NoOpt -> ("no_opt","Disable optimizations")
 		| NoPatternMatching -> ("no_pattern_matching","Disable pattern matching")
@@ -892,7 +892,7 @@ let find_file ctx f =
 		(match r with
 		| None -> raise Not_found
 		| Some f -> f)
-		
+
 
 let get_full_path f = try Extc.get_full_path f with _ -> f
 

+ 1 - 3
filters.ml

@@ -799,7 +799,6 @@ let rename_local_vars com e =
 
 let check_deprecation com =
 	let curclass = ref null_class in
-	let definition_positions = (Common.defined_value_safe com Define.DeprecationWarnings) = "def-pos" in
 	let warned_positions = Hashtbl.create 0 in
 	let get_deprecation_message meta s p_usage p_definition =
 		try
@@ -811,7 +810,6 @@ let check_deprecation com =
 				Hashtbl.replace warned_positions p_usage true;
 				com.warning s p_usage;
 			end;
-			if definition_positions then com.warning "Defined here" p_definition
 		with Not_found ->
 			()
 	in
@@ -1142,7 +1140,7 @@ let post_process_end() =
 let run com tctx main =
 	if com.display = DMUsage then
 		Codegen.detect_usage com;
-	if Common.defined com Define.DeprecationWarnings then
+	if not (Common.defined com Define.NoDeprecationWarnings) then
 		check_deprecation com;
 
 	(* PASS 1: general expression filters *)