[m-dev.] diff: pragma c_code fix

Peter Ross peter.ross at miscrit.be
Fri Nov 10 23:53:49 AEDT 2000


On Fri, Nov 10, 2000 at 10:59:01PM +1100, Fergus Henderson wrote:
> On 10-Nov-2000, Peter Ross <peter.ross at miscrit.be> wrote:
> > The documentation should reflect the above then.
> 
> I agree.  Are you volunteering? ;-)
> 
> Anyway, please undo the change to the compiler and the test case that
> you recently committed.
> 

===================================================================


Estimated hours taken: 0.1

tests/hard_coded/Mmakefile:
tests/hard_coded/pragma_c_code_order.exp:
tests/hard_coded/pragma_c_code_order.m:
mercury/compiler/llds_out.m:
    Remove petdr's previous changes which changed the order which
    `pragma c_code' was processed.


Index: tests/hard_coded/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/Mmakefile,v
retrieving revision 1.102
diff -u -r1.102 Mmakefile
--- tests/hard_coded/Mmakefile	2000/11/10 11:00:35	1.102
+++ tests/hard_coded/Mmakefile	2000/11/10 12:45:30
@@ -80,7 +80,6 @@
 	nondet_ctrl_vn \
 	nullary_ho_func \
 	pragma_c_code \
-	pragma_c_code_order \
 	pragma_export \
 	pragma_import \
 	pragma_inline \
Index: tests/hard_coded/pragma_c_code_order.exp
===================================================================
RCS file: pragma_c_code_order.exp
diff -N pragma_c_code_order.exp
--- /tmp/cvsGOu6M1	Fri Nov 10 23:46:00 2000
+++ /dev/null	Sat Aug  7 21:45:41 1999
@@ -1 +0,0 @@
-30
Index: tests/hard_coded/pragma_c_code_order.m
===================================================================
RCS file: pragma_c_code_order.m
diff -N pragma_c_code_order.m
--- /tmp/cvsQWbWpB	Fri Nov 10 23:46:00 2000
+++ /dev/null	Sat Aug  7 21:45:41 1999
@@ -1,33 +0,0 @@
-% Ensure that the pragma c_code sections are output in the same order
-% they are declared in and that they appear in the generated source file
-% before any variables defined in the c_code can be used.
-:- module pragma_c_code_order.
-
-:- interface.
-
-:- import_module io.
-
-:- pred main(io__state::di, io__state::uo) is det.
-
-:- implementation.
-
-main -->
-	io__write_int(p),
-	io__nl.
-
-:- pragma c_header_code("
-#define INTEGER	10
-").
-
-:- pragma c_code("
-#define INTEGER2 20
-").
-
-:- pragma c_code("
-static int global = INTEGER + INTEGER2;
-").
-
-:- func p = int.
-:- pragma c_code(p = (X::out), "{
-	X = global;
-}").
Index: mercury/compiler/llds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.163
diff -u -r1.163 llds_out.m
--- mercury/compiler/llds_out.m	2000/11/09 10:41:50	1.163
+++ mercury/compiler/llds_out.m	2000/11/10 12:46:52
@@ -491,9 +491,9 @@
 			DeclSet1, DeclSet2),
 		output_comp_gen_c_var_list(Vars, DeclSet2, DeclSet3),
 		output_comp_gen_c_data_list(Datas, DeclSet3, DeclSet4),
-		output_user_foreign_code_list(UserForeignCode),
 		output_comp_gen_c_module_list(Modules, StackLayoutLabels,
 			DeclSet4, _DeclSet),
+		output_user_foreign_code_list(UserForeignCode),
 		output_exported_c_functions(Exports),
 
 		( { SplitFiles = yes(_) } ->
@@ -991,10 +991,8 @@
 
 output_user_foreign_code_list([]) --> [].
 output_user_foreign_code_list([UserForeignCode | UserCCodes]) -->
-	output_user_foreign_code_list(UserCCodes),
-		% This list is in reverse declared order and we want to
-		% output in the declared order.
-	output_user_foreign_code(UserForeignCode).
+	output_user_foreign_code(UserForeignCode),
+	output_user_foreign_code_list(UserCCodes).
 
 :- pred output_user_foreign_code(user_foreign_code::in,
 	io__state::di, io__state::uo) is det.

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list