[m-rev.] diff: avoid warnings from MSVC

Julien Fischer juliensf at csse.unimelb.edu.au
Tue Oct 11 14:41:10 AEDT 2011


Branches: main, 11.07 (maybe)

Avoid warnings from MSVC concerning assignments from uninitialized variables.
These assignments arise due to the assignment of the initial I/O state to the
final I/O state in foreign_proc bodies.  In low-level C grades this leads to
code like the following:

     {
        MR_Word	IO0;
        MR_Word  IO;
        ...
        IO = IO0;
     }

Even though IO is itself unused, MSVC still emits a warning about the
assignment (many hundreds of warnings when the io module is opt-imported).
To avoid this, use don't-care variables for the I/O state in foreign procs
and don't include references to the I/O state in their bodies at all.
(We already did this in some places but not others.)

library/benchmarking.m:
library/dir.m:
library/io.m:
library/par_builtin.m:
library/stm_builtin.m:
library/thread.semaphore.m:
library/time.m:
compiler/make.util.m:
compiler/process_util.m:
 	Make the above change.

 	Delete the MR_update_io macro that is defined in a couple of spots.

library/io.m:
 	Unrelated change: s/MR_CONSERVATIVE_GC/MR_BOEHM_GC/ in a spot
 	since the former does not imply the later and the code that is
 	protecting is Boehm GC specific.

tests/debugger/poly_io_retry2.m:
 	Conform the the above change.

Julien.

Index: compiler/make.util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.util.m,v
retrieving revision 1.86
diff -u -r1.86 make.util.m
--- compiler/make.util.m	23 May 2011 05:08:05 -0000	1.86
+++ compiler/make.util.m	10 Oct 2011 13:44:01 -0000
@@ -753,7 +753,7 @@
  :- pred create_job_ctl(int::in, maybe(job_ctl)::out, io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    create_job_ctl(TotalJobs::in, MaybeJobCtl::out, IO0::di, IO::uo),
+    create_job_ctl(TotalJobs::in, MaybeJobCtl::out, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, thread_safe, tabled_for_io,
          may_not_duplicate],
  "
@@ -769,7 +769,6 @@
  #else
      MaybeJobCtl = MC_make_no_job_ctl();
  #endif
-    IO = IO0;
  ").

  create_job_ctl(_, _, _, _) :-
@@ -778,7 +777,7 @@
  :- pred destroy_job_ctl(job_ctl::in, io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    destroy_job_ctl(JobCtl::in, IO0::di, IO::uo),
+    destroy_job_ctl(JobCtl::in, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io,
          may_not_duplicate],
  "
@@ -791,7 +790,6 @@

      munmap(JobCtl, MC_JOB_CTL_SIZE(JobCtl->jc_total_tasks));
  #endif
-    IO = IO0;
  ").

  destroy_job_ctl(_, _, _) :-
@@ -800,7 +798,7 @@
  :- pred accept_task(job_ctl::in, int::out, io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    accept_task(JobCtl::in, TaskNumber::out, IO0::di, IO::uo),
+    accept_task(JobCtl::in, TaskNumber::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io,
          may_not_duplicate],
  "
@@ -823,8 +821,6 @@

      MC_unlock_job_ctl(JobCtl);
  #endif
-
-    IO = IO0;
  ").

  accept_task(_, _, _, _) :-
@@ -833,7 +829,7 @@
  :- pred mark_task_done(job_ctl::in, int::in, io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    mark_task_done(JobCtl::in, TaskNumber::in, IO0::di, IO::uo),
+    mark_task_done(JobCtl::in, TaskNumber::in, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io,
          may_not_duplicate],
  "
@@ -842,7 +838,6 @@
      JobCtl->jc_tasks[TaskNumber] = TASK_DONE;
      MC_unlock_job_ctl(JobCtl);
  #endif
-    IO = IO0;
  ").

  mark_task_done(_, _, _, _) :-
@@ -852,7 +847,7 @@

  :- pragma foreign_proc("C",
      mark_task_error(JobCtl::in, TaskNumber::in, KeepGoing::in,
-        IO0::di, IO::uo),
+        _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io,
          may_not_duplicate],
  "
@@ -866,7 +861,6 @@

      MC_unlock_job_ctl(JobCtl);
  #endif
-    IO = IO0;
  ").

  mark_task_error(_, _, _, _, _) :-
@@ -875,7 +869,7 @@
  :- pred mark_abort(job_ctl::in, io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    mark_abort(JobCtl::in, IO0::di, IO::uo),
+    mark_abort(JobCtl::in, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io,
          may_not_duplicate],
  "
@@ -884,7 +878,6 @@
      JobCtl->jc_abort = MR_TRUE;
      MC_unlock_job_ctl(JobCtl);
  #endif
-    IO = IO0;
  ").

  mark_abort(_, _, _) :-
@@ -1826,28 +1819,25 @@
  %

  :- pragma foreign_proc("C",
-    get_real_milliseconds(Time::out, IO0::di, IO::uo),
+    get_real_milliseconds(Time::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
  "
      Time = MR_get_real_milliseconds();
-    IO = IO0;
  ").

  :- pragma foreign_proc("C#",
-    get_real_milliseconds(Time::out, IO0::di, IO::uo),
+    get_real_milliseconds(Time::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
  "
      Time = System.Environment.TickCount;
-    IO = IO0;
  ").

  :- pragma foreign_proc("Java",
-    get_real_milliseconds(Time::out, IO0::di, IO::uo),
+    get_real_milliseconds(Time::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
  "
      // The loss of precision is acceptable for mmc --make.
      Time = (int) System.currentTimeMillis();
-    IO = IO0;
  ").

  get_real_milliseconds(_, _, _) :-
Index: compiler/process_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/process_util.m,v
retrieving revision 1.37
diff -u -r1.37 process_util.m
--- compiler/process_util.m	23 May 2011 05:08:09 -0000	1.37
+++ compiler/process_util.m	10 Oct 2011 14:53:01 -0000
@@ -214,10 +214,9 @@
  setup_signal_handlers(signal_action::out, IO::di, IO::uo).

  :- pragma foreign_proc("C",
-    setup_signal_handlers(SigintHandler::out, IO0::di, IO::uo),
+    setup_signal_handlers(SigintHandler::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io],
-"{
-    IO = IO0;
+"
      MC_signalled = MR_FALSE;

      /*
@@ -234,17 +233,16 @@
  #ifdef SIGQUIT
      MC_SETUP_SIGNAL_HANDLER(SIGQUIT, MC_mercury_compile_signal_handler);
  #endif
-}").
+").

  :- pred restore_signal_handlers(signal_action::in, io::di, io::uo) is det.

  restore_signal_handlers(_::in, IO::di, IO::uo).

  :- pragma foreign_proc("C",
-    restore_signal_handlers(SigintHandler::in, IO0::di, IO::uo),
+    restore_signal_handlers(SigintHandler::in, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io],
-"{
-    IO = IO0;
+"
      MR_set_signal_action(SIGINT, &SigintHandler,
          ""error resetting SIGINT handler"");
      MC_SETUP_SIGNAL_HANDLER(SIGTERM, SIG_DFL);
@@ -254,7 +252,7 @@
  #ifdef SIGQUIT
      MC_SETUP_SIGNAL_HANDLER(SIGQUIT, SIG_DFL);
  #endif
-}").
+").

      % Restore all signal handlers to default values in the child so that
      % the child will be killed by the signals the parent is catching.
@@ -280,10 +278,9 @@
  check_for_signal(0::out, 0::out, IO::di, IO::uo).

  :- pragma foreign_proc("C",
-    check_for_signal(Signalled::out, Signal::out, IO0::di, IO::uo),
+    check_for_signal(Signalled::out, Signal::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io],
  "
-    IO = IO0;
      Signalled = (MC_signalled ? 1 : 0);
      Signal = MC_signal_received;
  ").
@@ -297,18 +294,16 @@
  raise_signal(_::in, IO::di, IO::uo).

  :- pragma foreign_proc("C",
-    raise_signal(Signal::in, IO0::di, IO::uo),
+    raise_signal(Signal::in, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io],
  "
-    IO = IO0;
      raise(Signal);
  ").

  :- pragma foreign_proc("C",
-    send_signal(Pid::in, Signal::in, IO0::di, IO::uo),
+    send_signal(Pid::in, Signal::in, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io],
  "
-    IO = IO0;
  #ifdef MR_HAVE_KILL
      kill(Pid, Signal);
  #endif
@@ -386,13 +381,11 @@

  :- pragma foreign_proc("C",
      start_in_forked_process_2(Pred::in(io_pred), Pid::out,
-        IO0::di, IO::uo),
+        _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io],
  "
  #ifdef MC_CAN_FORK

-    IO = IO0;
-
      Pid = fork();
      if (Pid == -1) {                        /* error */
          MR_perror(""error in fork()"");
@@ -405,7 +398,6 @@
      }

  #else /* ! MC_CAN_FORK */
-    IO = IO0;
      Pid = 0;
  #endif /* ! MC_CAN_FORK */
  ").
@@ -437,7 +429,7 @@
  :- pred do_wait(pid::in, pid::out, int::out, io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    do_wait(Pid::in, WaitedPid::out, Status::out, IO0::di, IO::uo),
+    do_wait(Pid::in, WaitedPid::out, Status::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io],
  "
  #ifdef MC_CAN_FORK
@@ -503,7 +495,6 @@

  #else /* ! MC_CAN_FORK */
      MR_perror(""cannot wait() when fork() is unavailable: "");
-    IO = IO0;
      Status = 1;
  #endif /* ! MC_CAN_FORK */
  ").
Index: library/benchmarking.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/benchmarking.m,v
retrieving revision 1.88
diff -u -r1.88 benchmarking.m
--- library/benchmarking.m	16 Jun 2011 06:22:22 -0000	1.88
+++ library/benchmarking.m	10 Oct 2011 14:25:33 -0000
@@ -1309,14 +1309,13 @@
  %-----------------------------------------------------------------------------%

  :- pragma foreign_proc("C",
-    log_threadscope_message(Message::in, IO0::di, IO::uo),
+    log_threadscope_message(Message::in, _IO0::di, _IO::uo),
      [will_not_call_mercury, will_not_throw_exception, thread_safe,
          promise_pure, tabled_for_io],
  "
  #if MR_THREADSCOPE
      MR_threadscope_post_log_msg(Message);
  #endif
-    IO = IO0;
  ").

  %-----------------------------------------------------------------------------%
Index: library/dir.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/dir.m,v
retrieving revision 1.61
diff -u -r1.61 dir.m
--- library/dir.m	20 May 2011 04:16:52 -0000	1.61
+++ library/dir.m	10 Oct 2011 14:28:50 -0000
@@ -857,7 +857,7 @@
  %-----------------------------------------------------------------------------%

  :- pragma foreign_proc("C",
-    dir.current_directory(Res::out, IO0::di, IO::uo),
+    dir.current_directory(Res::out, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          may_not_duplicate],
  "
@@ -890,8 +890,6 @@
          /* Buffer too small.  Resize and try again. */
          size *= 1.5;
      }
-
-    IO = IO0;
  ").

  :- pragma foreign_proc("C#",
@@ -1088,11 +1086,11 @@

  :- pragma foreign_proc("C",
      dir.make_single_directory_2(ErrorIfExists::in, DirName::in,
-        Result::out, IO0::di, IO::uo),
+        Result::out, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe,
          terminates, will_not_modify_trail, does_not_affect_liveness,
          may_not_duplicate],
-"{
+"
  #if defined(MR_WIN32)
      if (CreateDirectory(DirName, NULL)) {
          Result = ML_make_mkdir_res_ok();
@@ -1120,8 +1118,7 @@
      MR_fatal_error(
          ""dir.make_single_directory_2 called but not supported"");
  #endif
-    IO = IO0;
-}").
+").
  :- pragma foreign_proc("C#",
      dir.make_single_directory_2(ErrorIfExists::in, DirName::in,
          Result::out, _IO0::di, _IO::uo),
@@ -1625,10 +1622,10 @@
      io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    dir.open_2(DirName::in, Result::out, IO0::di, IO::uo),
+    dir.open_2(DirName::in, Result::out, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe,
          terminates, will_not_modify_trail, does_not_affect_liveness],
-"{
+"
  #if defined(MR_WIN32)
      WIN32_FIND_DATA file_data;
      ML_DIR_STREAM Dir;
@@ -1667,8 +1664,7 @@
  #else /* !MR_WIN32 && !(MR_HAVE_OPENDIR etc.) */
      MR_fatal_error(""dir.open called but not supported"");
  #endif
-    IO = IO0;
-}").
+").

  :- pragma foreign_proc("C#",
      dir.open_2(DirName::in, Result::out, _IO0::di, _IO::uo),
@@ -1869,11 +1865,10 @@
      io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    dir.close_2(Dir::in, Status::out, Error::out, IO0::di, IO::uo),
+    dir.close_2(Dir::in, Status::out, Error::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          will_not_modify_trail, does_not_affect_liveness],
-"{
-    IO = IO0;
+"
  #if defined(MR_WIN32)
      Status = FindClose(Dir);
      Error = GetLastError();
@@ -1883,7 +1878,7 @@
  #else
      MR_fatal_error(""dir.open called but not supported"");
  #endif
-}").
+").

  :- pragma foreign_proc("C#",
      dir.close_2(_Dir::in, Status::out, Error::out, _IO0::di, _IO::uo),
@@ -1945,15 +1940,14 @@

  :- pragma foreign_proc("C",
      dir.read_entry_2(Dir0::in, Dir::out, Status::out, Error::out,
-        FileName::out, IO0::di, IO::uo),
+        FileName::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          will_not_modify_trail, does_not_affect_liveness],
-"{
+"
  #if defined(MR_WIN32)
      WIN32_FIND_DATA file_data;

      Dir = Dir0;
-    IO = IO0;
      if (FindNextFile(Dir, &file_data)) {
          Status = 1;
          MR_make_aligned_string_copy_msg(FileName, file_data.cFileName,
@@ -1968,7 +1962,6 @@
      struct dirent *dir_entry;

      Dir = Dir0;
-    IO = IO0;
      errno = 0;
      dir_entry = readdir(Dir);
      if (dir_entry == NULL) {
@@ -1985,7 +1978,7 @@
  #else /* !MR_WIN32 && !(MR_HAVE_READDIR etc.) */
      MR_fatal_error(""dir.read_entry_2 called but not supported"");
  #endif
-}").
+").

  :- pragma foreign_proc("C#",
      dir.read_entry_2(Dir0::in, Dir::out, Status::out, Error::out,
Index: library/io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.468
diff -u -r1.468 io.m
--- library/io.m	6 Oct 2011 19:08:05 -0000	1.468
+++ library/io.m	10 Oct 2011 14:26:42 -0000
@@ -1973,10 +1973,9 @@
  :- pragma foreign_proc("C",
      io.do_read_bitmap(Stream::in, StartByte::in, NumBytes::in,
          Bitmap0::bitmap_di, Bitmap::bitmap_uo, BytesRead0::in, BytesRead::out,
-        IO0::di, IO::uo),
+        _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe],
  "
-    MR_update_io(IO0, IO);
      Bitmap = Bitmap0,
      BytesRead = BytesRead0 +
                      MR_READ(*Stream, Bitmap->elements + StartByte, NumBytes);
@@ -2163,7 +2162,7 @@

  :- pragma foreign_proc("C",
      io.read_line_as_string_2(Stream::in, _FirstCall::in, Res::out,
-        RetString::out, IO0::di, IO::uo),
+        RetString::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
  "
@@ -2223,12 +2222,11 @@
      if (read_buffer != initial_read_buffer) {
          MR_free(read_buffer);
      }
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("Java",
      io.read_line_as_string_2(Stream::in, _FirstCall::in, Res::out,
-        RetString::out, IO0::di, IO::uo),
+        RetString::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, may_not_duplicate],
  "
@@ -2240,7 +2238,6 @@
          Res = -3;
          RetString = """";
      }
-    IO = IO0;
  ").

  io.read_line_as_string_2(Stream, FirstCall, Res, String, !IO) :-
@@ -2483,7 +2480,7 @@
  :- pred io.clear_err(stream::in, io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    io.clear_err(Stream::in, IO0::di, IO::uo),
+    io.clear_err(Stream::in, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
  "
@@ -2492,7 +2489,6 @@
      } else {
          /* Not a file stream so do nothing */
      }
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C#",
@@ -2540,7 +2536,7 @@
  :- pred io.ferror(stream::in, int::out, string::out, io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    ferror(Stream::in, RetVal::out, RetStr::out, IO0::di, IO::uo),
+    ferror(Stream::in, RetVal::out, RetStr::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
  "
@@ -2552,7 +2548,6 @@

      ML_maybe_make_err_msg(RetVal != 0, errno, ""read failed: "",
          MR_ALLOC_ID, MR_TRUE, RetStr);
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C#",
@@ -2589,7 +2584,7 @@
  :- pred io.get_system_error(io.system_error::out, io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    io.get_system_error(Error::out, IO0::di, IO::uo),
+    io.get_system_error(Error::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
  "{
@@ -2600,7 +2595,6 @@
      ** the same thread in the meantime, the errno could have been clobbered.
      */
      Error = errno;
-    MR_update_io(IO0, IO);
  }").

  :- pragma foreign_proc("C#",
@@ -2632,12 +2626,11 @@
      "ML_make_err_msg").

  :- pragma foreign_proc("C",
-    make_err_msg(Error::in, Msg0::in, Msg::out, IO0::di, IO::uo),
+    make_err_msg(Error::in, Msg0::in, Msg::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
  "
      ML_maybe_make_err_msg(MR_TRUE, Error, Msg0, MR_ALLOC_ID, MR_FALSE, Msg);
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C#",
@@ -2723,12 +2716,11 @@
      ).

  :- pragma foreign_proc("C",
-    make_win32_err_msg(Error::in, Msg0::in, Msg::out, IO0::di, IO::uo),
+    make_win32_err_msg(Error::in, Msg0::in, Msg::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
  "
      ML_maybe_make_win32_err_msg(MR_TRUE, Error, Msg0, MR_ALLOC_ID, Msg);
-    MR_update_io(IO0, IO);
  ").

  make_maybe_win32_err_msg(Error, Msg0, Msg, !IO) :-
@@ -2776,7 +2768,7 @@
  ").

  :- pragma foreign_proc("C",
-    io.stream_file_size(Stream::in, Size::out, IO0::di, IO::uo),
+    io.stream_file_size(Stream::in, Size::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
  "
@@ -2795,7 +2787,6 @@
  #else
      Size = -1;
  #endif
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C#",
@@ -2840,7 +2831,7 @@

  :- pragma foreign_proc("C",
      io.file_modification_time_2(FileName::in, Status::out, Msg::out,
-        Time::out, IO0::di, IO::uo),
+        Time::out, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
  "
@@ -2860,8 +2851,6 @@
      Msg = MR_make_string_const(
          ""io.file_modification_time not available on this platform"");
  #endif
-    MR_update_io(IO0, IO);
-
  ").
  :- pragma foreign_proc("C#",
      io.file_modification_time_2(FileName::in, Status::out, Msg::out,
@@ -2985,7 +2974,7 @@

  :- pragma foreign_proc("C",
      io.file_type_2(FollowSymLinks::in, FileName::in, Result::out,
-        IO0::di, IO::uo),
+        _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          does_not_affect_liveness, no_sharing],
  "
@@ -3111,7 +3100,6 @@
      MR_fatal_error(
          ""Sorry, io.file_type not implemented on this platform"") }
  #endif
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C#",
@@ -3335,7 +3323,7 @@

  :- pragma foreign_proc("C",
      io.check_file_accessibility_2(FileName::in, AccessTypes::in, Result::out,
-        IO0::di, IO::uo),
+        _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          does_not_affect_liveness, no_sharing],
  "
@@ -3386,7 +3374,6 @@
      Result = ML_make_io_res_0_error_msg(
          ""io.check_file_accessibility not supported on this platform"");
  #endif
-    IO = IO0;
  ").

  :- pragma foreign_proc("Java",
@@ -3923,10 +3910,10 @@

  :- pragma foreign_proc("C",
      io.file_id_2(FileName::in, Status::out, Msg::out,
-        FileId::out, IO0::di, IO::uo),
+        FileId::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
-"{
+"
  #ifdef MR_HAVE_STAT
      struct stat s;

@@ -3940,11 +3927,10 @@
              MR_ALLOC_ID, MR_TRUE, Msg);
          Status = 0;
      }
-    MR_update_io(IO0, IO);
  #else
      MR_fatal_error(""io.file_id_2 called but not supported"");
  #endif
-}").
+").

  :- pragma foreign_proc("Java",
      io.file_id_2(_FileName::in, _Status::out, _Msg::out,
@@ -4113,10 +4099,10 @@

  :- pragma foreign_proc("C",
      io.read_into_buffer(Stream::in, Buffer0::buffer_di, Buffer::buffer_uo,
-        Pos0::in, Pos::out, Size::in, IO0::di, IO::uo),
+        Pos0::in, Pos::out, Size::in, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness],
-"{
+"
      int items_read;

      MR_CHECK_EXPR_TYPE(Buffer0, char *);
@@ -4126,8 +4112,7 @@

      Buffer = Buffer0;
      Pos = Pos0 + items_read;
-    MR_update_io(IO0, IO);
-}").
+").

  io.read_into_buffer(Stream, buffer(Array0), buffer(Array), !Pos, Size, !IO) :-
      io.read_into_array(Stream, Array0, Array, !Pos, Size, !IO).
@@ -5043,12 +5028,11 @@
      % Caller must hold the stream_db lock.
      %
  :- pragma foreign_proc("C",
-    io.get_stream_db(StreamDb::out, IO0::di, IO::uo),
+    io.get_stream_db(StreamDb::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io,
          does_not_affect_liveness],
  "
      StreamDb = ML_io_stream_db;
-    MR_update_io(IO0, IO);
  ").

      % Caller must hold the stream_db lock.
@@ -5056,23 +5040,21 @@
  :- pred io.set_stream_db(io.stream_db::in, io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    io.set_stream_db(StreamDb::in, IO0::di, IO::uo),
+    io.set_stream_db(StreamDb::in, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io,
          does_not_affect_liveness, no_sharing],
  "
      ML_io_stream_db = StreamDb;
-    MR_update_io(IO0, IO);
  ").

  :- pred io.lock_stream_db(io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    io.lock_stream_db(IO0::di, IO::uo),
+    io.lock_stream_db(_IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io,
          no_sharing],
  "
      MR_LOCK(&ML_io_stream_db_lock, ""io.lock_stream_db/2"");
-    IO = IO0;
  ").

  io.lock_stream_db(!IO).
@@ -5080,12 +5062,11 @@
  :- pred io.unlock_stream_db(io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    io.unlock_stream_db(IO0::di, IO::uo),
+    io.unlock_stream_db(_IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io,
          no_sharing],
  "
      MR_UNLOCK(&ML_io_stream_db_lock, ""io.unlock_stream_db/2"");
-    IO = IO0;
  ").

  io.unlock_stream_db(!IO).
@@ -5192,12 +5173,11 @@
  :- pred io.may_delete_stream_info(int::out, io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    io.may_delete_stream_info(MayDelete::out, IO0::di, IO::uo),
+    io.may_delete_stream_info(MayDelete::out, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          does_not_affect_liveness, no_sharing],
  "
      MayDelete = !MR_debug_ever_enabled;
-    IO = IO0;
  ").

  io.may_delete_stream_info(1, !IO).
@@ -5243,15 +5223,13 @@

  :- pred io.lock_globals(io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.lock_globals(IO0::di, IO::uo),
+    io.lock_globals(_IO0::di, _IO::uo),
      [promise_pure, will_not_call_mercury, thread_safe, tabled_for_io,
          does_not_affect_liveness, no_sharing],
  "
      #ifdef MR_THREAD_SAFE
          MR_LOCK(&ML_io_user_globals_lock, \"io.lock_globals/2\");
      #endif
-
-    MR_update_io(IO0, IO);
  ").

      % For the non-C backends.
@@ -5260,15 +5238,13 @@

  :- pred io.unlock_globals(io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.unlock_globals(IO0::di, IO::uo),
+    io.unlock_globals(_IO0::di, _IO::uo),
      [promise_pure, will_not_call_mercury, thread_safe, tabled_for_io,
          does_not_affect_liveness, no_sharing],
  "
      #ifdef MR_THREAD_SAFE
          MR_UNLOCK(&ML_io_user_globals_lock, \"io.unlock_globals/2\");
      #endif
-
-    MR_update_io(IO0, IO);
  ").

      % For the non-C backends.
@@ -5297,23 +5273,21 @@
      %
  :- pred io.unsafe_get_globals(univ::out, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.unsafe_get_globals(Globals::out, IO0::di, IO::uo),
+    io.unsafe_get_globals(Globals::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness],
  "
      Globals = ML_io_user_globals;
-    MR_update_io(IO0, IO);
  ").

  :- pred io.unsafe_set_globals(univ::in, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.unsafe_set_globals(Globals::in, IO0::di, IO::uo),
+    io.unsafe_set_globals(Globals::in, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
  "
      /* XXX need to globalize the memory */
      ML_io_user_globals = Globals;
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C#",
@@ -5552,17 +5526,16 @@
  :- pred io.gc_init(type_desc::in, type_desc::in, io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    io.gc_init(StreamDbType::in, UserGlobalsType::in, IO0::di, IO::uo),
+    io.gc_init(StreamDbType::in, UserGlobalsType::in, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
  "
      /* for Windows DLLs, we need to call GC_INIT() from each DLL */
-#ifdef MR_CONSERVATIVE_GC
+#ifdef MR_BOEHM_GC
      GC_INIT();
  #endif
      MR_add_root(&ML_io_stream_db, (MR_TypeInfo) StreamDbType);
      MR_add_root(&ML_io_user_globals, (MR_TypeInfo) UserGlobalsType);
-    MR_update_io(IO0, IO);
  ").

  io.gc_init(_, _, !IO).
@@ -5697,8 +5670,6 @@
  #define MR_initial_io_state()       0   /* some random number */
  #define MR_final_io_state(r)        ((void)0)

-#define MR_update_io(r_src, r_dest) ((r_dest) = (r_src))
-
  void            mercury_init_io(void);
  MercuryFilePtr  mercury_current_text_input(void);
  MercuryFilePtr  mercury_current_text_output(void);
@@ -7444,7 +7415,7 @@
      is det.

  :- pragma foreign_proc("C",
-    io.read_char_code_2(Stream::in, CharCode::out, IO0::di, IO::uo),
+    io.read_char_code_2(Stream::in, CharCode::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing, may_not_duplicate],
  "
@@ -7489,8 +7460,6 @@
              CharCode = -2;
          }
      }
-
-    MR_update_io(IO0, IO);
  ").

  io.read_byte_val(input_stream(Stream), ByteVal, !IO) :-
@@ -7499,12 +7468,11 @@
  :- pred io.read_byte_val_2(io.stream::in, int::out, io::di, io::uo)
      is det.
  :- pragma foreign_proc("C",
-    io.read_byte_val_2(Stream::in, ByteVal::out, IO0::di, IO::uo),
+    io.read_byte_val_2(Stream::in, ByteVal::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
  "
      ByteVal = mercury_get_byte(Stream);
-    MR_update_io(IO0, IO);
  ").

  io.putback_char(input_stream(Stream), Character, !IO) :-
@@ -7512,7 +7480,7 @@

  :- pred io.putback_char_2(io.stream::in, char::in, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.putback_char_2(Stream::in, Character::in, IO0::di, IO::uo),
+    io.putback_char_2(Stream::in, Character::in, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, terminates,
          does_not_affect_liveness, no_sharing, may_not_duplicate],
  "
@@ -7535,7 +7503,6 @@
              }
          }
      }
-    MR_update_io(IO0, IO);
  ").

  io.putback_byte(binary_input_stream(Stream), Character, !IO) :-
@@ -7543,7 +7510,7 @@

  :- pred io.putback_byte_2(io.stream::in, int::in, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.putback_byte_2(Stream::in, Character::in, IO0::di, IO::uo),
+    io.putback_byte_2(Stream::in, Character::in, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, terminates,
          does_not_affect_liveness, no_sharing],
  "
@@ -7551,7 +7518,6 @@
      if (MR_UNGETCH(*mf, Character) == EOF) {
          mercury_io_error(mf, ""io.putback_byte: ungetc failed"");
      }
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C#",
@@ -7669,16 +7635,15 @@
  %

  :- pragma foreign_proc("C",
-    io.write_string(Message::in, IO0::di, IO::uo),
+    io.write_string(Message::in, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          does_not_affect_liveness, no_sharing],
  "
      mercury_print_string(mercury_current_text_output(), Message);
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C",
-    io.write_char(Character::in, IO0::di, IO::uo),
+    io.write_char(Character::in, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          does_not_affect_liveness, no_sharing],
  "
@@ -7702,11 +7667,10 @@
              }
          }
      }
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C",
-    io.write_int(Val::in, IO0::di, IO::uo),
+    io.write_int(Val::in, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          does_not_affect_liveness, no_sharing],
  "
@@ -7714,11 +7678,10 @@
      if (ML_fprintf(out, ""%ld"", (long) Val) < 0) {
          mercury_output_error(out);
      }
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C",
-    io.write_float(Val::in, IO0::di, IO::uo),
+    io.write_float(Val::in, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          does_not_affect_liveness, no_sharing],
  "
@@ -7730,11 +7693,10 @@
      if (ML_fprintf(out, ""%s"", buf) < 0) {
          mercury_output_error(out);
      }
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C",
-    io.write_byte(Byte::in, IO0::di, IO::uo),
+    io.write_byte(Byte::in, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          does_not_affect_liveness, no_sharing],
  "
@@ -7744,7 +7706,6 @@
      {
          mercury_output_error(mercury_current_text_output());
      }
-    MR_update_io(IO0, IO);
  ").

  io.write_bitmap(Bitmap, !IO) :-
@@ -7756,7 +7717,7 @@
      io.write_bitmap(Stream, Bitmap, Start, NumBytes, !IO).

  :- pragma foreign_proc("C",
-    io.flush_output(IO0::di, IO::uo),
+    io.flush_output(_IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          does_not_affect_liveness, no_sharing],
  "
@@ -7764,11 +7725,10 @@
      if (MR_FLUSH(*out) < 0) {
          mercury_output_error(out);
      }
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C",
-    io.flush_binary_output(IO0::di, IO::uo),
+    io.flush_binary_output(_IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          does_not_affect_liveness, no_sharing],
  "
@@ -7776,7 +7736,6 @@
      if (MR_FLUSH(*out) < 0) {
          mercury_output_error(out);
      }
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C#",
@@ -7969,7 +7928,7 @@
      io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    io.seek_binary_2(Stream::in, Flag::in, Off::in, IO0::di, IO::uo),
+    io.seek_binary_2(Stream::in, Flag::in, Off::in, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
  "
@@ -7982,7 +7941,6 @@
      } else {
          mercury_io_error(Stream, ""io.seek_binary_2: unseekable stream"");
      }
-    MR_update_io(IO0, IO);
  ").

  io.binary_input_stream_offset(binary_input_stream(Stream), Offset, !IO) :-
@@ -7994,7 +7952,7 @@
  :- pred io.binary_stream_offset_2(io.stream::in, int::out,
      io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.binary_stream_offset_2(Stream::in, Offset::out, IO0::di, IO::uo),
+    io.binary_stream_offset_2(Stream::in, Offset::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
  "
@@ -8006,7 +7964,6 @@
          mercury_io_error(Stream,
              ""io.primitive_binary_stream_offset: untellable stream"");
      }
-    MR_update_io(IO0, IO);
  ").

  %-----------------------------------------------------------------------------%
@@ -8019,12 +7976,11 @@

  :- pred io.write_string_2(io.stream::in, string::in, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.write_string_2(Stream::in, Message::in, IO0::di, IO::uo),
+    io.write_string_2(Stream::in, Message::in, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          does_not_affect_liveness, no_sharing],
  "
      mercury_print_string(Stream, Message);
-    MR_update_io(IO0, IO);
  ").

  io.write_char(output_stream(Stream), Character, !IO) :-
@@ -8032,7 +7988,7 @@

  :- pred io.write_char_2(io.stream::in, char::in, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.write_char_2(Stream::in, Character::in, IO0::di, IO::uo),
+    io.write_char_2(Stream::in, Character::in, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          does_not_affect_liveness, no_sharing],
  "
@@ -8055,7 +8011,6 @@
              }
          }
      }
-    MR_update_io(IO0, IO);
  ").

  io.write_int(output_stream(Stream), Val, !IO) :-
@@ -8063,14 +8018,13 @@

  :- pred io.write_int_2(io.stream::in, int::in, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.write_int_2(Stream::in, Val::in, IO0::di, IO::uo),
+    io.write_int_2(Stream::in, Val::in, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          does_not_affect_liveness, no_sharing],
  "
      if (ML_fprintf(Stream, ""%ld"", (long) Val) < 0) {
          mercury_output_error(Stream);
      }
-    MR_update_io(IO0, IO);
  ").

  io.write_float(output_stream(Stream), Val, !IO) :-
@@ -8078,7 +8032,7 @@

  :- pred io.write_float_2(io.stream::in, float::in, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.write_float_2(Stream::in, Val::in, IO0::di, IO::uo),
+    io.write_float_2(Stream::in, Val::in, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          does_not_affect_liveness, no_sharing],
  "
@@ -8087,7 +8041,6 @@
      if (ML_fprintf(Stream, ""%s"", buf) < 0) {
          mercury_output_error(Stream);
      }
-    MR_update_io(IO0, IO);
  ").

  io.write_byte(binary_output_stream(Stream), Byte, !IO) :-
@@ -8095,7 +8048,7 @@

  :- pred io.write_byte_2(io.stream::in, int::in, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.write_byte_2(Stream::in, Byte::in, IO0::di, IO::uo),
+    io.write_byte_2(Stream::in, Byte::in, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          does_not_affect_liveness, no_sharing],
  "
@@ -8103,7 +8056,6 @@
      if (MR_PUTCH(*Stream, (int) ((unsigned char) Byte)) < 0) {
          mercury_output_error(Stream);
      }
-    MR_update_io(IO0, IO);
  ").

  io.write_bitmap(binary_output_stream(Stream), Bitmap, !IO) :-
@@ -8141,7 +8093,7 @@

  :- pragma foreign_proc("C",
      io.do_write_bitmap(Stream::in, Bitmap::in, Start::in, Length::in,
-        IO0::di, IO::uo),
+        _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          no_sharing],
  "
@@ -8150,7 +8102,6 @@
      if (bytes_written != Length) {
          mercury_io_error(Stream, \"Error writing bitmap.\");
      }
-    MR_update_io(IO0, IO);
  ").

  io.flush_output(output_stream(Stream), !IO) :-
@@ -8158,14 +8109,13 @@

  :- pred io.flush_output_2(io.stream::in, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.flush_output_2(Stream::in, IO0::di, IO::uo),
+    io.flush_output_2(Stream::in, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          does_not_affect_liveness, no_sharing],
  "
      if (MR_FLUSH(*Stream) < 0) {
          mercury_output_error(Stream);
      }
-    MR_update_io(IO0, IO);
  ").

  io.flush_binary_output(binary_output_stream(Stream), !IO) :-
@@ -8173,14 +8123,13 @@

  :- pred io.flush_binary_output_2(io.stream::in, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.flush_binary_output_2(Stream::in, IO0::di, IO::uo),
+    io.flush_binary_output_2(Stream::in, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          does_not_affect_liveness, no_sharing],
  "
      if (MR_FLUSH(*Stream) < 0) {
          mercury_output_error(Stream);
      }
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C#",
@@ -8445,13 +8394,12 @@

  :- pred io.stdin_stream_2(io.stream::out, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.stdin_stream_2(Stream::out, IO0::di, IO::uo),
+    io.stdin_stream_2(Stream::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
      % no_sharing is okay as io.stream is a foreign type so can't be reused.
  "
      Stream = &mercury_stdin;
-    MR_update_io(IO0, IO);
  ").

  io.stdout_stream = output_stream(io.stdout_stream_2).
@@ -8487,13 +8435,12 @@

  :- pred io.stdout_stream_2(io.stream::out, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.stdout_stream_2(Stream::out, IO0::di, IO::uo),
+    io.stdout_stream_2(Stream::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          no_sharing],
      % no_sharing is okay as io.stream is a foreign type so can't be reused.
  "
      Stream = &mercury_stdout;
-    MR_update_io(IO0, IO);
  ").

  io.stderr_stream = output_stream(io.stderr_stream_2).
@@ -8529,13 +8476,12 @@

  :- pred io.stderr_stream_2(io.stream::out, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.stderr_stream_2(Stream::out, IO0::di, IO::uo),
+    io.stderr_stream_2(Stream::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
      % no_sharing is okay as io.stream is a foreign type so can't be reused.
  "
      Stream = &mercury_stderr;
-    MR_update_io(IO0, IO);
  ").

  io.stdin_binary_stream(binary_input_stream(Stream), !IO) :-
@@ -8543,13 +8489,12 @@

  :- pred io.stdin_binary_stream_2(io.stream::out, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.stdin_binary_stream_2(Stream::out, IO0::di, IO::uo),
+    io.stdin_binary_stream_2(Stream::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
      % no_sharing is okay as io.stream is a foreign type so can't be reused.
  "
      Stream = &mercury_stdin_binary;
-    MR_update_io(IO0, IO);
  ").

  io.stdout_binary_stream(binary_output_stream(Stream), !IO) :-
@@ -8557,13 +8502,12 @@

  :- pred io.stdout_binary_stream_2(io.stream::out, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.stdout_binary_stream_2(Stream::out, IO0::di, IO::uo),
+    io.stdout_binary_stream_2(Stream::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
      % no_sharing is okay as io.stream is a foreign type so can't be reused.
  "
      Stream = &mercury_stdout_binary;
-    MR_update_io(IO0, IO);
  ").

  io.input_stream(input_stream(Stream), !IO) :-
@@ -8571,13 +8515,12 @@

  :- pred io.input_stream_2(io.stream::out, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.input_stream_2(Stream::out, IO0::di, IO::uo),
+    io.input_stream_2(Stream::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
      % no_sharing is okay as io.stream is a foreign type so can't be reused.
  "
      Stream = mercury_current_text_input();
-    MR_update_io(IO0, IO);
  ").

  io.output_stream(output_stream(Stream), !IO) :-
@@ -8585,13 +8528,12 @@

  :- pred io.output_stream_2(io.stream::out, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.output_stream_2(Stream::out, IO0::di, IO::uo),
+    io.output_stream_2(Stream::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
      % no_sharing is okay as io.stream is a foreign type so can't be reused.
  "
      Stream = mercury_current_text_output();
-    MR_update_io(IO0, IO);
  ").

  io.binary_input_stream(binary_input_stream(Stream), !IO) :-
@@ -8599,13 +8541,12 @@

  :- pred io.binary_input_stream_2(io.stream::out, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.binary_input_stream_2(Stream::out, IO0::di, IO::uo),
+    io.binary_input_stream_2(Stream::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
      % no_sharing is okay as io.stream is a foreign type so can't be reused.
  "
      Stream = mercury_current_binary_input();
-    MR_update_io(IO0, IO);
  ").

  io.binary_output_stream(binary_output_stream(Stream), !IO) :-
@@ -8613,22 +8554,20 @@

  :- pred io.binary_output_stream_2(io.stream::out, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.binary_output_stream_2(Stream::out, IO0::di, IO::uo),
+    io.binary_output_stream_2(Stream::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
      % no_sharing is okay as io.stream is a foreign type so can't be reused.
  "
      Stream = mercury_current_binary_output();
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C",
-    io.get_line_number(LineNum::out, IO0::di, IO::uo),
+    io.get_line_number(LineNum::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
  "
      LineNum = MR_line_number(*mercury_current_text_input());
-    MR_update_io(IO0, IO);
  ").

  io.get_line_number(input_stream(Stream), LineNum, !IO) :-
@@ -8636,21 +8575,19 @@

  :- pred io.get_line_number_2(io.stream::in, int::out, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.get_line_number_2(Stream::in, LineNum::out, IO0::di, IO::uo),
+    io.get_line_number_2(Stream::in, LineNum::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
  "
      LineNum = MR_line_number(*Stream);
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C",
-    io.set_line_number(LineNum::in, IO0::di, IO::uo),
+    io.set_line_number(LineNum::in, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
  "
      MR_line_number(*mercury_current_text_input()) = LineNum;
-    MR_update_io(IO0, IO);
  ").

  io.set_line_number(input_stream(Stream), LineNum, !IO) :-
@@ -8660,21 +8597,19 @@
      is det.

  :- pragma foreign_proc("C",
-    io.set_line_number_2(Stream::in, LineNum::in, IO0::di, IO::uo),
+    io.set_line_number_2(Stream::in, LineNum::in, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
  "
      MR_line_number(*Stream) = LineNum;
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C",
-    io.get_output_line_number(LineNum::out, IO0::di, IO::uo),
+    io.get_output_line_number(LineNum::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
  "
      LineNum = MR_line_number(*mercury_current_text_output());
-    MR_update_io(IO0, IO);
  ").

  io.get_output_line_number(output_stream(Stream), LineNum, !IO) :-
@@ -8684,21 +8619,19 @@
      io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    io.get_output_line_number_2(Stream::in, LineNum::out, IO0::di, IO::uo),
+    io.get_output_line_number_2(Stream::in, LineNum::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
  "
      LineNum = MR_line_number(*Stream);
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C",
-    io.set_output_line_number(LineNum::in, IO0::di, IO::uo),
+    io.set_output_line_number(LineNum::in, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
  "
      MR_line_number(*mercury_current_text_output()) = LineNum;
-    MR_update_io(IO0, IO);
  ").

  io.set_output_line_number(output_stream(Stream), LineNum, !IO) :-
@@ -8707,12 +8640,11 @@
  :- pred io.set_output_line_number_2(io.stream::in, int::in,
      io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.set_output_line_number_2(Stream::in, LineNum::in, IO0::di, IO::uo),
+    io.set_output_line_number_2(Stream::in, LineNum::in, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
  "
      MR_line_number(*Stream) = LineNum;
-    MR_update_io(IO0, IO);
  ").

  io.set_input_stream(input_stream(NewStream), input_stream(OutStream), !IO) :-
@@ -8721,7 +8653,7 @@
  :- pred io.set_input_stream_2(io.stream::in, io.stream::out,
      io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    io.set_input_stream_2(NewStream::in, OutStream::out, IO0::di, IO::uo),
+    io.set_input_stream_2(NewStream::in, OutStream::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
      % no_sharing is okay as io.stream is a foreign type so can't be reused.
@@ -8729,7 +8661,6 @@
      OutStream = mercury_current_text_input();
      MR_set_thread_local_mutable(MercuryFilePtr, NewStream,
          mercury_current_text_input_index);
-    MR_update_io(IO0, IO);
  ").

  io.set_output_stream(output_stream(NewStream), output_stream(OutStream),
@@ -8740,7 +8671,7 @@
      io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    io.set_output_stream_2(NewStream::in, OutStream::out, IO0::di, IO::uo),
+    io.set_output_stream_2(NewStream::in, OutStream::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
      % no_sharing is okay as io.stream is a foreign type so can't be reused.
@@ -8748,7 +8679,6 @@
      OutStream = mercury_current_text_output();
      MR_set_thread_local_mutable(MercuryFilePtr, NewStream,
          mercury_current_text_output_index);
-    MR_update_io(IO0, IO);
  ").

  io.set_binary_input_stream(binary_input_stream(NewStream),
@@ -8759,7 +8689,7 @@
      io::di, io::uo) is det.
  :- pragma foreign_proc("C",
      io.set_binary_input_stream_2(NewStream::in, OutStream::out,
-        IO0::di, IO::uo),
+        _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
      % no_sharing is okay as io.stream is a foreign type so can't be reused.
@@ -8767,7 +8697,6 @@
      OutStream = mercury_current_binary_input();
      MR_set_thread_local_mutable(MercuryFilePtr, NewStream,
          mercury_current_binary_input_index);
-    MR_update_io(IO0, IO);
  ").

  io.set_binary_output_stream(binary_output_stream(NewStream),
@@ -8778,7 +8707,7 @@
      io::di, io::uo) is det.
  :- pragma foreign_proc("C",
      io.set_binary_output_stream_2(NewStream::in, OutStream::out,
-        IO0::di, IO::uo),
+        _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
      % no_sharing is okay as io.stream is a foreign type so can't be reused.
@@ -8786,7 +8715,6 @@
      OutStream = mercury_current_binary_output();
      MR_set_thread_local_mutable(MercuryFilePtr, NewStream,
          mercury_current_binary_output_index);
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C#",
@@ -9304,7 +9232,7 @@

  :- pragma foreign_proc("C",
      io.do_open_text(FileName::in, Mode::in, ResultCode::out,
-        StreamId::out, Stream::out, IO0::di, IO::uo),
+        StreamId::out, Stream::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
  "
@@ -9316,12 +9244,11 @@
          ResultCode = -1;
          StreamId = -1;
      }
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C",
      io.do_open_binary(FileName::in, Mode::in, ResultCode::out,
-        StreamId::out, Stream::out, IO0::di, IO::uo),
+        StreamId::out, Stream::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
  "
@@ -9333,7 +9260,6 @@
          ResultCode = -1;
          StreamId = -1;
      }
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C#",
@@ -9497,12 +9423,11 @@
  :- pred io.close_stream(stream::in, io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    io.close_stream(Stream::in, IO0::di, IO::uo),
+    io.close_stream(Stream::in, _IO0::di, _IO::uo),
      [may_call_mercury, promise_pure, tabled_for_io, thread_safe, terminates,
          does_not_affect_liveness, no_sharing],
  "
      mercury_close(Stream);
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C#",
@@ -9535,7 +9460,7 @@
  % Miscellaneous predicates.

  :- pragma foreign_proc("C",
-    io.progname(DefaultProgname::in, PrognameOut::out, IO0::di, IO::uo),
+    io.progname(DefaultProgname::in, PrognameOut::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, may_not_duplicate],
  "
@@ -9544,11 +9469,10 @@
      } else {
          PrognameOut = DefaultProgname;
      }
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C",
-    io.command_line_arguments(Args::out, IO0::di, IO::uo),
+    io.command_line_arguments(Args::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, may_not_duplicate,
          no_sharing],
@@ -9565,25 +9489,22 @@
          Args = MR_string_list_cons_msg((MR_Word) mercury_argv[i], Args,
              MR_ALLOC_ID);
      }
-    MR_update_io(IO0, IO);
  }").

  :- pragma foreign_proc("C",
-    io.get_exit_status(ExitStatus::out, IO0::di, IO::uo),
+    io.get_exit_status(ExitStatus::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
  "
      ExitStatus = mercury_exit_status;
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("C",
-    io.set_exit_status(ExitStatus::in, IO0::di, IO::uo),
+    io.set_exit_status(ExitStatus::in, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness, no_sharing],
  "
      mercury_exit_status = ExitStatus;
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_decl("C", "
@@ -9623,7 +9544,7 @@

  :- pragma foreign_proc("C",
      io.call_system_code(Command::in, Status::out, Msg::out,
-        IO0::di, IO::uo),
+        _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
  "
@@ -9701,8 +9622,6 @@
      }

  #endif  /* !MR_THREAD_SAFE || !MR_HAVE_POSIX_SPAWN || !MR_HAVE_ENVIRON */
-
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("Erlang",
@@ -10210,10 +10129,10 @@

  :- pragma foreign_proc("C",
      io.do_make_temp(Dir::in, Prefix::in, Sep::in, FileName::out,
-        Error::out, ErrorMessage::out, IO0::di, IO::uo),
+        Error::out, ErrorMessage::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io,
          does_not_affect_liveness],
-"{
+"
  #ifdef MR_HAVE_MKSTEMP
      int err, fd;

@@ -10286,8 +10205,7 @@
          Error = err;
      }
  #endif
-    MR_update_io(IO0, IO);
-}").
+").

  :- pragma foreign_proc("C#",
      io.do_make_temp(_Dir::in, _Prefix::in, _Sep::in, FileName::out,
@@ -10566,15 +10484,14 @@

  :- pragma foreign_proc("C",
      io.remove_file_2(FileName::in, RetVal::out, RetStr::out,
-        IO0::di, IO::uo),
+        _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
-"{
+"
      RetVal = remove(FileName);
      ML_maybe_make_err_msg(RetVal != 0, errno, ""remove failed: "",
          MR_ALLOC_ID, MR_TRUE, RetStr);
-    MR_update_io(IO0, IO);
-}").
+").

  :- pragma foreign_proc("C#",
      io.remove_file_2(FileName::in, RetVal::out, RetStr::out,
@@ -10705,15 +10622,14 @@

  :- pragma foreign_proc("C",
      io.rename_file_2(OldFileName::in, NewFileName::in, RetVal::out,
-        RetStr::out, IO0::di, IO::uo),
+        RetStr::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
-"{
+"
      RetVal = rename(OldFileName, NewFileName);
      ML_maybe_make_err_msg(RetVal != 0, errno, ""rename failed: "",
          MR_ALLOC_ID, MR_TRUE, RetStr);
-    MR_update_io(IO0, IO);
-}").
+").

  :- pragma foreign_proc("C#",
      io.rename_file_2(OldFileName::in, NewFileName::in, RetVal::out,
@@ -10823,7 +10739,7 @@

  :- pragma foreign_proc("C",
      io.make_symlink_2(FileName::in, LinkFileName::in, Status::out,
-        IO0::di, IO::uo),
+        _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
  "
@@ -10832,7 +10748,6 @@
  #else
      Status = 0;
  #endif
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("Erlang",
@@ -10871,7 +10786,7 @@

  :- pragma foreign_proc("C",
      io.read_symlink_2(FileName::in, TargetFileName::out,
-        Status::out, Error::out, IO0::di, IO::uo),
+        Status::out, Error::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, tabled_for_io, thread_safe,
          does_not_affect_liveness, no_sharing],
  "
@@ -10922,7 +10837,6 @@
      TargetFileName = MR_make_string_const("""");
      Status = 0;
  #endif
-    MR_update_io(IO0, IO);
  ").

  :- pragma foreign_proc("Erlang",
Index: library/par_builtin.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/par_builtin.m,v
retrieving revision 1.33
diff -u -r1.33 par_builtin.m
--- library/par_builtin.m	9 Oct 2011 14:31:28 -0000	1.33
+++ library/par_builtin.m	10 Oct 2011 14:30:57 -0000
@@ -520,7 +520,7 @@
  ").

  :- pragma foreign_proc("C",
-    par_cond_close_stats_file(IO0::di, IO::uo),
+    par_cond_close_stats_file(_IO0::di, _IO::uo),
      [will_not_call_mercury, thread_safe, promise_pure, tabled_for_io],
  "
  #if defined(MR_LL_PARALLEL_CONJ) && \
@@ -529,7 +529,6 @@
  #else
      MR_fatal_error(""par_cond_close_stats_file is unavailable in this grade"");
  #endif
-    IO = IO0;
  ").

  %-----------------------------------------------------------------------------%
Index: library/stm_builtin.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/stm_builtin.m,v
retrieving revision 1.18
diff -u -r1.18 stm_builtin.m
--- library/stm_builtin.m	13 Apr 2011 13:19:41 -0000	1.18
+++ library/stm_builtin.m	10 Oct 2011 14:31:13 -0000
@@ -229,11 +229,10 @@
  %----------------------------------------------------------------------------%

  :- pragma foreign_proc("C",
-    new_stm_var(T::in, TVar::out, IO0::di, IO::uo),
+    new_stm_var(T::in, TVar::out, _IO0::di, _IO::uo),
      [promise_pure, will_not_call_mercury, thread_safe],
  "
      MR_STM_new_stm_var(T, TVar);
-    IO = IO0;
  ").

  :- pragma foreign_proc("C",
Index: library/thread.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/thread.m,v
retrieving revision 1.25
diff -u -r1.25 thread.m
--- library/thread.m	2 Aug 2011 04:18:59 -0000	1.25
+++ library/thread.m	10 Oct 2011 14:30:08 -0000
@@ -112,7 +112,7 @@
  %-----------------------------------------------------------------------------%

  :- pragma foreign_proc("C",
-    spawn(Goal::(pred(di, uo) is cc_multi), IO0::di, IO::uo),
+    spawn(Goal::(pred(di, uo) is cc_multi), _IO0::di, _IO::uo),
      [promise_pure, will_not_call_mercury, thread_safe, tabled_for_io,
          may_not_duplicate],
  "
@@ -145,7 +145,6 @@
  #endif

  #endif /* MR_HIGHLEVEL_CODE */
-    IO = IO0;
  ").

  :- pragma foreign_proc("C#",
@@ -175,7 +174,7 @@

  :- pragma no_inline(yield/2).
  :- pragma foreign_proc("C",
-    yield(IO0::di, IO::uo),
+    yield(_IO0::di, _IO::uo),
      [promise_pure, will_not_call_mercury, thread_safe, tabled_for_io,
          may_not_duplicate],
  "
@@ -196,7 +195,6 @@
      yield_skip_to_the_end:
    #endif
  #endif
-    IO = IO0;
  ").

  :- pragma foreign_proc("C#",
Index: library/thread.semaphore.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/thread.semaphore.m,v
retrieving revision 1.23
diff -u -r1.23 thread.semaphore.m
--- library/thread.semaphore.m	20 May 2011 04:16:53 -0000	1.23
+++ library/thread.semaphore.m	10 Oct 2011 14:30:34 -0000
@@ -194,7 +194,7 @@
      %
  :- pragma no_inline(semaphore.signal/3).
  :- pragma foreign_proc("C",
-    signal(Semaphore::in, IO0::di, IO::uo),
+    signal(Semaphore::in, _IO0::di, _IO::uo),
      [promise_pure, will_not_call_mercury, thread_safe, tabled_for_io],
  "
      ML_Semaphore    *sem;
@@ -262,7 +262,6 @@
      MR_SIGNAL(&(sem->cond), ""semaphore.signal"");
      MR_UNLOCK(&(sem->lock), ""semaphore__signal"");
  #endif
-    IO = IO0;
  ").

  :- pragma foreign_proc("C#",
Index: library/time.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/time.m,v
retrieving revision 1.70
diff -u -r1.70 time.m
--- library/time.m	30 Sep 2010 07:23:33 -0000	1.70
+++ library/time.m	10 Oct 2011 13:46:31 -0000
@@ -212,8 +212,6 @@
          #include <unistd.h>
      #endif

-    #define MR_update_io(r_src, r_dest) ((r_dest) = (r_src))
-
      #include ""mercury_timing.h"" /* for MR_CLOCK_TICKS_PER_SECOND */
  ").

@@ -265,11 +263,10 @@
  :- pred time.c_clock(int::out, io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    time.c_clock(Ret::out, IO0::di, IO::uo),
+    time.c_clock(Ret::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
  "
      Ret = (MR_Integer) clock();
-    MR_update_io(IO0, IO);
  ").
  /* XXX need to add System.dll to the references list.
  :- pragma foreign_proc("C#",
@@ -347,8 +344,9 @@

  :- pragma foreign_proc("C",
      time.c_times(Ret::out, Ut::out, St::out, CUt::out, CSt::out,
-        IO0::di, IO::uo),
-    [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io, may_not_duplicate],
+        _IO0::di, _IO::uo),
+    [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io,
+        may_not_duplicate],
  "{
  #ifdef MR_HAVE_POSIX_TIMES
      struct tms t;
@@ -385,7 +383,6 @@
      Ret = -1;
    #endif
  #endif
-    MR_update_io(IO0, IO);
  }").

  :- pragma foreign_proc("Java",
@@ -473,11 +470,10 @@
  :- pred time.c_time(time_t_rep::out, io::di, io::uo) is det.

  :- pragma foreign_proc("C",
-    time.c_time(Ret::out, IO0::di, IO::uo),
+    time.c_time(Ret::out, _IO0::di, _IO::uo),
      [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
  "
      Ret = time(NULL);
-    MR_update_io(IO0, IO);
  ").
  :- pragma foreign_proc("C#",
      time.c_time(Ret::out, _IO0::di, _IO::uo),
Index: tests/debugger/poly_io_retry2.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/poly_io_retry2.m,v
retrieving revision 1.2
diff -u -r1.2 poly_io_retry2.m
--- tests/debugger/poly_io_retry2.m	29 Mar 2006 08:07:55 -0000	1.2
+++ tests/debugger/poly_io_retry2.m	11 Oct 2011 03:19:24 -0000
@@ -48,7 +48,7 @@
  	[will_not_call_mercury, promise_pure, tabled_for_io],
  "
  	Globals = poly_io_retry_test_globals;
-	MR_update_io(IOState0, IOState);
+	IOState = IOState0;
  ").

  :- pragma foreign_proc("C",
@@ -56,5 +56,5 @@
  	[will_not_call_mercury, promise_pure, tabled_for_io],
  "
  	poly_io_retry_test_globals = Globals;
-	MR_update_io(IOState0, IOState);
+	IOState = IOState0;
  ").

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