make it a strict c code (declare varaible anywhere is not strict c code)
authorGengbin Zheng <gzheng@illinois.edu>
Thu, 18 Oct 2007 05:25:27 +0000 (05:25 +0000)
committerGengbin Zheng <gzheng@illinois.edu>
Thu, 18 Oct 2007 05:25:27 +0000 (05:25 +0000)
src/conv-core/convcore.c
src/conv-core/debug-conv.c

index 0f6bad2373175925de7daca313fc7a9f92ef83c2..2da8444b6e42a22d39d6e9da7897ddf4d50bebda 100644 (file)
@@ -1776,19 +1776,21 @@ CmiReductionsInit() {
 
 void CmiSendReduce() {
   void *mergedData = CpvAccess(_reduce_data);
+  void *msg;
+  int msg_size;
   if (CpvAccess(_reduce_num_children) > 0) {
     int i, offset=0;
     if (_reduce_pupFn != NULL) {
       offset = CmiMsgHeaderSizeBytes;
-      for (i=0; i<CpvAccess(_reduce_num_children); ++i) CpvAccess(_reduce_msg_list)[i] += offset;
+      for (i=0; i<CpvAccess(_reduce_num_children); ++i) (char*)(CpvAccess(_reduce_msg_list)[i]) += offset;
     }
     mergedData = _reduce_mergeFn(CpvAccess(_reduce_data), CpvAccess(_reduce_msg_list), CpvAccess(_reduce_num_children));
-    for (i=0; i<CpvAccess(_reduce_num_children); ++i) CmiFree(CpvAccess(_reduce_msg_list)[i] - offset);
+    for (i=0; i<CpvAccess(_reduce_num_children); ++i) CmiFree((char *)(CpvAccess(_reduce_msg_list)[i]) - offset);
   }
   CpvAccess(_reduce_num_children) = 0;
   CpvAccess(_reduce_received) = 0;
-  void *msg = mergedData;
-  int msg_size = CpvAccess(_reduce_data_size);
+  msg = mergedData;
+  msg_size = CpvAccess(_reduce_data_size);
   if (CmiMyPe() != 0) {
     if (_reduce_pupFn != NULL) {
       pup_er p = pup_new_sizer();
index af19d56c49ca066c0fc50990a9f1a815cfa7e35b..475173a2a597463114a02b98b5ace0c99d6ff967 100644 (file)
@@ -32,12 +32,14 @@ CpvDeclare(int, CpdDebugCallAllocationTree_Index);
 
 static void CpdDebugReturnAllocationTree(void *tree) {
   pup_er sizer = pup_new_sizer();
+  char *buf;
+  pup_er packer;
+  int i;
   CpdDebug_pupAllocationPoint(sizer, tree);
-  char *buf = (char *)malloc(pup_size(sizer));
-  pup_er packer = pup_new_toMem(buf);
+  buf = (char *)malloc(pup_size(sizer));
+  packer = pup_new_toMem(buf);
   CpdDebug_pupAllocationPoint(packer, tree);
   /*CmiPrintf("size=%d tree:",pup_size(sizer));
-  int i;
   for (i=0;i<100;++i) CmiPrintf(" %02x",((unsigned char*)buf)[i]);
   CmiPrintf("\n");*/
   CcsSendReply(pup_size(sizer),buf);
@@ -50,12 +52,13 @@ static void CpdDebugCallAllocationTree(char *msg)
 {
   int numNodes;
   int forPE;
+  void *tree;
   sscanf(msg+CmiMsgHeaderSizeBytes, "%d", &forPE);
   if (forPE == -1 && CmiMyPe()==0) {
     CmiSetHandler(msg, CpvAccess(CpdDebugCallAllocationTree_Index));
     CmiSyncBroadcast(CmiMsgHeaderSizeBytes+sizeof(int), msg);
   }
-  void *tree = CpdDebugGetAllocationTree(&numNodes);
+  tree = CpdDebugGetAllocationTree(&numNodes);
   if (forPE == CmiMyPe()) CpdDebugReturnAllocationTree(tree);
   else if (forPE == -1) CmiReduceStruct(tree, CpdDebug_pupAllocationPoint, CpdDebug_MergeAllocationTree,
                                 CpdDebugReturnAllocationTree, CpdDebug_deleteAllocationPoint);