[m-rev.] trivial diff: suppress C compiler warnings

Julien Fischer juliensf at csse.unimelb.edu.au
Sun Sep 16 23:09:15 AEST 2007


Shut up warnings from the C compiler.

runtime/mercury_stm.[ch]:
 	Don't use log as a local variable or function parameter name since
 	it shadows a global variable in the system headers on some systems.

Julien.

Index: runtime/mercury_stm.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stm.c,v
retrieving revision 1.2
diff -u -r1.2 mercury_stm.c
--- runtime/mercury_stm.c	15 Sep 2007 14:25:56 -0000	1.2
+++ runtime/mercury_stm.c	16 Sep 2007 13:05:27 -0000
@@ -19,7 +19,7 @@
  #endif

  void
-MR_STM_record_transaction(MR_STM_TransLog *log, MR_STM_Var *var,
+MR_STM_record_transaction(MR_STM_TransLog *tlog, MR_STM_Var *var,
      MR_Word old_value, MR_Word new_value)
  {
      MR_STM_TransRecord  *new_record;
@@ -28,8 +28,8 @@
      new_record->MR_STM_tr_var = var;
      new_record->MR_STM_tr_old_value = old_value;
      new_record->MR_STM_tr_new_value = new_value;
-    new_record->MR_STM_tr_next = log->MR_STM_tl_records;
-    log->MR_STM_tl_records = new_record;
+    new_record->MR_STM_tr_next = tlog->MR_STM_tl_records;
+    tlog->MR_STM_tl_records = new_record;
  }

  void
@@ -45,11 +45,11 @@
  }

  MR_Integer
-MR_STM_validate(MR_STM_TransLog *log)
+MR_STM_validate(MR_STM_TransLog *tlog)
  {
      MR_STM_TransRecord  *current;

-    current = log->MR_STM_tl_records;
+    current = tlog->MR_STM_tl_records;
      while (current != NULL) {
          if (current->MR_STM_tr_var->MR_STM_var_value !=
              current->MR_STM_tr_old_value)
@@ -63,11 +63,11 @@
  }

  void
-MR_STM_commit(MR_STM_TransLog *log) {
+MR_STM_commit(MR_STM_TransLog *tlog) {

      MR_STM_TransRecord  *current;

-    current = log->MR_STM_tl_records;
+    current = tlog->MR_STM_tl_records;
      while (current != NULL) {
          current->MR_STM_tr_var->MR_STM_var_value
              = current->MR_STM_tr_new_value;
@@ -76,14 +76,14 @@
  }

  void
-MR_STM_wait(MR_STM_TransLog *log)
+MR_STM_wait(MR_STM_TransLog *tlog)
  {
      MR_STM_TransRecord  *current;
      MR_ThreadId         this_thread_id;

      this_thread_id = MR_THIS_THREAD_ID;

-    current = log->MR_STM_tl_records;
+    current = tlog->MR_STM_tl_records;
      while (current != NULL) {
          MR_STM_attach_waiter(current->MR_STM_tr_var, this_thread_id);
          current = current->MR_STM_tr_next;
@@ -91,13 +91,13 @@
  }

  void
-MR_STM_unwait(MR_STM_TransLog *log)
+MR_STM_unwait(MR_STM_TransLog *tlog)
  {
      MR_STM_TransRecord  *current;
      MR_ThreadId         this_thread_id;

      this_thread_id = MR_THIS_THREAD_ID;
-    current = log->MR_STM_tl_records;
+    current = tlog->MR_STM_tl_records;

      while (current != NULL) {
          MR_STM_detach_waiter(current->MR_STM_tr_var, this_thread_id);
@@ -106,7 +106,7 @@
  }

  void
-MR_STM_write_var(MR_STM_Var *var, MR_Word value, MR_STM_TransLog *log)
+MR_STM_write_var(MR_STM_Var *var, MR_Word value, MR_STM_TransLog *tlog)
  {
      MR_STM_TransRecord  *current;
      MR_bool             has_existing_record = MR_FALSE;
@@ -115,7 +115,7 @@
      ** Check to see if this transaction variable has an existing record in
      ** transaction log; if so, update it.
      */
-    current = log->MR_STM_tl_records;
+    current = tlog->MR_STM_tl_records;
      while (current != NULL) {
          if (current->MR_STM_tr_var == var) {
              has_existing_record = MR_TRUE;
@@ -130,16 +130,16 @@
      ** have one.
      */
      if (!has_existing_record) {
-        MR_STM_record_transaction(log, var, var->MR_STM_var_value, value);
+        MR_STM_record_transaction(tlog, var, var->MR_STM_var_value, value);
      }
  }

  MR_Word
-MR_STM_read_var(MR_STM_Var *var, MR_STM_TransLog *log)
+MR_STM_read_var(MR_STM_Var *var, MR_STM_TransLog *tlog)
  {
      MR_STM_TransRecord  *current;

-    current = log->MR_STM_tl_records;
+    current = tlog->MR_STM_tl_records;
      while (current != NULL) {
          if (current->MR_STM_tr_var == var) {
              return current->MR_STM_tr_new_value;
@@ -154,14 +154,14 @@
      ** Add an entry that indicates that it has been read and then return
      ** the value that is stored in the transaction variable.
      */
-    MR_STM_record_transaction(log, var, var->MR_STM_var_value,
+    MR_STM_record_transaction(tlog, var, var->MR_STM_var_value,
          var->MR_STM_var_value);

      return var->MR_STM_var_value;
  }

  void
-MR_STM_retry_impl(MR_STM_TransLog *log)
+MR_STM_retry_impl(MR_STM_TransLog *tlog)
  {
      MR_fatal_error("Sorry, STM retry not yet implemented.");
  } 
Index: runtime/mercury_stm.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stm.h,v
retrieving revision 1.2
diff -u -r1.2 mercury_stm.h
--- runtime/mercury_stm.h	15 Sep 2007 14:25:56 -0000	1.2
+++ runtime/mercury_stm.h	16 Sep 2007 13:05:27 -0000
@@ -105,20 +105,20 @@
  /*
  ** Create a new transaction log.
  */
-#define MR_STM_create_log(log)                                          \
+#define MR_STM_create_log(tlog)                                         \
      do {                                                                \
-        (log) = MR_GC_NEW(MR_STM_TransLog);                             \
-        (log)->MR_STM_tl_records = NULL;                                \
-        (log)->MR_STM_tl_thread = MR_THIS_THREAD_ID;                    \
+        (tlog) = MR_GC_NEW(MR_STM_TransLog);                            \
+        (tlog)->MR_STM_tl_records = NULL;                               \
+        (tlog)->MR_STM_tl_thread = MR_THIS_THREAD_ID;                   \
      } while (0)

  /*
  ** Discard a transaction log.
  ** XXX we should free the memory in nogc grades.
  */
-#define MR_STM_discard_log(log)                                         \
+#define MR_STM_discard_log(tlog)                                        \
      do {                                                                \
-        (log) = NULL;                                                   \
+        (tlog) = NULL;                                                  \
      } while (0)

  /*
@@ -127,7 +127,7 @@
  ** of the transaction variable before and after the change of state.
  */
  extern void
-MR_STM_record_transaction(MR_STM_TransLog *log, MR_STM_Var *var,
+MR_STM_record_transaction(MR_STM_TransLog *tlog, MR_STM_Var *var,
      MR_Word old_value, MR_Word new_value);

  /*
@@ -135,14 +135,14 @@
  ** listed in the log.
  */
  extern void
-MR_STM_wait(MR_STM_TransLog *log);
+MR_STM_wait(MR_STM_TransLog *tlog);

  /*
  ** Detach waiters for the current thread from all of the transaction variables
  ** referenced by the given transaction log.
  */
  extern void
-MR_STM_unwait(MR_STM_TransLog *log);
+MR_STM_unwait(MR_STM_TransLog *tlog);

  /*
  ** Attach a waiter for thread tid to the transaction variable.
@@ -160,22 +160,22 @@
  MR_STM_detach_waiter(MR_STM_Var *var, MR_ThreadId tid);

  extern MR_Integer
-MR_STM_validate(MR_STM_TransLog *log);
+MR_STM_validate(MR_STM_TransLog *tlog);

  /*
  ** Irrevocably write the changes stored in a transaction log to memory.
  */
  extern void
-MR_STM_commit(MR_STM_TransLog *log);
+MR_STM_commit(MR_STM_TransLog *tlog);

  extern void
-MR_STM_write_var(MR_STM_Var *var, MR_Word value, MR_STM_TransLog *log);
+MR_STM_write_var(MR_STM_Var *var, MR_Word value, MR_STM_TransLog *tlog);

  extern MR_Word
-MR_STM_read_var(MR_STM_Var *var, MR_STM_TransLog *log);
+MR_STM_read_var(MR_STM_Var *var, MR_STM_TransLog *tlog);

  extern void
-MR_STM_retry_impl(MR_STM_TransLog *log);
+MR_STM_retry_impl(MR_STM_TransLog *tlog);

  #if defined(MR_THREAD_SAFE)
      extern MercuryLock  MR_STM_lock;

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