[m-rev.] diff: fix test failures for --warn-suspicious-foreign-procs

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Mar 11 17:13:42 AEDT 2010


Branches: main, 10.04

Fix the failure of the tests for --warn-suspicious-foreign-procs when
--intermodule-optimization is enabled; additional warnings were being
generated for opt imported foreign procs.

compiler/make_hlds_warn.m:
	Only perform the suspicious foreign code check for foreign_procs
	that are defined in the module currently being compiled.

Julien.

Index: compiler/make_hlds_warn.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make_hlds_warn.m,v
retrieving revision 1.34
diff -u -r1.34 make_hlds_warn.m
--- compiler/make_hlds_warn.m	2 Feb 2010 05:29:39 -0000	1.34
+++ compiler/make_hlds_warn.m	11 Mar 2010 06:06:25 -0000
@@ -618,10 +618,18 @@

 pragma_foreign_proc_body_checks(Lang, Context, PredOrFuncCallId, PredId, ProcId,
         ModuleInfo, BodyPieces, !Specs) :-
-    check_fp_body_for_success_indicator(Lang, Context, PredOrFuncCallId,
-        PredId, ProcId, ModuleInfo, BodyPieces, !Specs),
-    check_fp_body_for_return(Lang, Context, PredOrFuncCallId, BodyPieces,
-        !Specs).
+    module_info_pred_info(ModuleInfo, PredId, PredInfo),
+    pred_info_get_import_status(PredInfo, ImportStatus),
+    IsImported = status_is_imported(ImportStatus),
+    (
+        IsImported = yes
+    ;
+        IsImported = no,
+        check_fp_body_for_success_indicator(Lang, Context, PredOrFuncCallId,
+            PredId, ProcId, ModuleInfo, BodyPieces, !Specs),
+        check_fp_body_for_return(Lang, Context, PredOrFuncCallId, BodyPieces,
+            !Specs)
+    ).

 :- pred check_fp_body_for_success_indicator(foreign_language::in,
     prog_context::in, simple_call_id::in, pred_id::in, proc_id::in,
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list