[m-rev.] diff: fix hlc.gc.memprof with MSVC

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Oct 20 14:08:48 AEDT 2011


Branches: main, 11.07

Make the hlc.gc.memprof grade work with MSVC again.

compiler/mlds_to_c.m:
 	Don't use incomplete array types in forward declarations
 	of static arrays of MR_AllocSitesInfos since MSVC reports
 	an error for them.

Julien.

Index: compiler/mlds_to_c.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mlds_to_c.m,v
retrieving revision 1.260
diff -u -r1.260 mlds_to_c.m
--- compiler/mlds_to_c.m	16 Sep 2011 07:03:35 -0000	1.260
+++ compiler/mlds_to_c.m	19 Oct 2011 11:19:58 -0000
@@ -1729,8 +1729,10 @@
          AllocSites = []
      ;
          AllocSites = [_ | _],
+        list.length(AllocSites, NumAllocSites),
          mlds_indent(Indent, !IO),
-        io.write_string("static MR_AllocSiteInfo MR_alloc_sites[];\n", !IO)
+        io.format("static MR_AllocSiteInfo MR_alloc_sites[%d];\n",
+            [i(NumAllocSites)], !IO)
      ).

  :- pred mlds_output_alloc_site_defns(mlds_to_c_opts::in, indent::in,
@@ -1743,7 +1745,9 @@
      ;
          AllocSites = [_ | _],
          mlds_indent(Indent, !IO),
-        io.write_string("static MR_AllocSiteInfo MR_alloc_sites[] = {\n", !IO),
+        list.length(AllocSites, NumAllocSites),
+        io.format("static MR_AllocSiteInfo MR_alloc_sites[%d] = {\n", 
+            [i(NumAllocSites)], !IO),
          list.foldl(
              mlds_output_alloc_site_defn(Opts, Indent + 1, MLDS_ModuleName),
              AllocSites, !IO),

--------------------------------------------------------------------------
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