[m-rev.] diff: fix RTTI->MLDS problem with MSVC

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Nov 10 15:43:14 AEDT 2011

Branches: main

Fix one of the bugs that is preventing the trunk compiling with MSVC in the
hlc.gc grade.  MSVC complains about the forward declaration of the DuArgLocn
array for the token/0 type in library/lexer.m having unknown size.  The array
size is not being printed in the forward declaration (as it should be) because
when we convert the RTTI to MLDS the initializer is set to be an initializer
for a struct, not an array.

 	Use the correct kind of initializer for DuArgLocn arrays.


Index: compiler/rtti_to_mlds.m
RCS file: /home/mercury/mercury1/repository/mercury/compiler/rtti_to_mlds.m,v
retrieving revision 1.103
diff -u -r1.103 rtti_to_mlds.m
--- compiler/rtti_to_mlds.m	6 Sep 2011 05:20:43 -0000	1.103
+++ compiler/rtti_to_mlds.m	10 Nov 2011 03:56:34 -0000
@@ -978,8 +978,7 @@
          RttiId = ctor_rtti_id(RttiTypeCtor, RttiName),
          list.map_foldl(gen_field_locn(RttiId), ArgInfos, ArgLocnInitializers,
              -1, _Offset),
-        Initializer = init_struct(mlds_rtti_type(item_type(RttiId)),
-            ArgLocnInitializers),
+        Initializer = init_array(ArgLocnInitializers),
          rtti_id_and_init_to_defn(RttiId, Initializer, !GlobalData)
          HaveArgLocns = no

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