Commits

BarryFSmith committed c17d477 Merge

Merge branch 'barry/protect-logging' into next

  • Participants
  • Parent commits 9dd9f45, 4097062
  • Branches jed/next-seaice, knepley/fix-quadrature-order 2
    1. madams/sr1
    2. next-oct-2014

Comments (0)

Files changed (2)

File src/sys/objects/inherit.c

 #include <petsc-private/petscimpl.h>  /*I   "petscsys.h"    I*/
 #include <petscviewer.h>
 
+#if defined(PETSC_USE_LOG)
 PetscObject *PetscObjects      = 0;
 PetscInt    PetscObjectsCounts = 0, PetscObjectsMaxCounts = 0;
+#endif
 
 extern PetscErrorCode PetscObjectGetComm_Petsc(PetscObject,MPI_Comm*);
 extern PetscErrorCode PetscObjectCompose_Petsc(PetscObject,const char[],PetscObject);
 {
   static PetscInt idcnt = 1;
   PetscErrorCode  ierr;
+#if defined(PETSC_USE_LOG)
   PetscObject     *newPetscObjects;
   PetscInt         newPetscObjectsMaxCounts,i;
+#endif
 
   PetscFunctionBegin;
   h->classid               = classid;
 
   ierr = PetscCommDuplicate(comm,&h->comm,&h->tag);CHKERRQ(ierr);
 
+#if defined(PETSC_USE_LOG)
   /* Keep a record of object created */
   PetscObjectsCounts++;
   for (i=0; i<PetscObjectsMaxCounts; i++) {
   PetscObjects                        = newPetscObjects;
   PetscObjects[PetscObjectsMaxCounts] = h;
   PetscObjectsMaxCounts               = newPetscObjectsMaxCounts;
+#endif
   PetscFunctionReturn(0);
 }
 
 PetscErrorCode  PetscHeaderDestroy_Private(PetscObject h)
 {
   PetscErrorCode ierr;
-  PetscInt       i;
 
   PetscFunctionBegin;
   PetscValidHeader(h,1);
   ierr = PetscFree(h->fortrancallback[PETSC_FORTRAN_CALLBACK_CLASS]);CHKERRQ(ierr);
   ierr = PetscFree(h->fortrancallback[PETSC_FORTRAN_CALLBACK_SUBTYPE]);CHKERRQ(ierr);
 
+#if defined(PETSC_USE_LOG)
+  {
+  PetscInt i;
   /* Record object removal from list of all objects */
   for (i=0; i<PetscObjectsMaxCounts; i++) {
     if (PetscObjects[i] == h) {
     ierr = PetscFree(PetscObjects);CHKERRQ(ierr);
     PetscObjectsMaxCounts = 0;
   }
+  }
+#endif
   PetscFunctionReturn(0);
 }
 
   PetscFunctionReturn(0);
 }
 
+#if defined(PETSC_USE_LOG)
 #undef __FUNCT__
 #define __FUNCT__ "PetscObjectsDump"
 /*@C
   }
   PetscFunctionReturn(0);
 }
+#endif
 
+#if defined(PETSC_USE_LOG)
 
 #undef __FUNCT__
 #define __FUNCT__ "PetscObjectsView"
   }
   PetscFunctionReturn(0);
 }
+#endif
 
 #undef __FUNCT__
 #define __FUNCT__ "PetscObjectAddOptionsHandler"

File src/sys/objects/pinit.c

   PetscFunctionReturn(0);
 }
 
+#if defined(PETSC_USE_LOG)
 extern PetscObject *PetscObjects;
 extern PetscInt    PetscObjectsCounts, PetscObjectsMaxCounts;
+#endif
 
 #undef __FUNCT__
 #define __FUNCT__ "PetscFinalize"
     ierr = PetscThreadCommDestroy(&tcomm_world);CHKERRQ(ierr);
   }
 
+#if defined(PETSC_USE_LOG)
   /*
        List all objects the user may have forgot to free
   */
     ierr = PetscSequentialPhaseEnd_Private(local_comm,1);CHKERRQ(ierr);
     ierr = MPI_Comm_free(&local_comm);CHKERRQ(ierr);
   }
+#endif
+
+#if defined(PETSC_USE_LOG)
   PetscObjectsCounts    = 0;
   PetscObjectsMaxCounts = 0;
-
   ierr = PetscFree(PetscObjects);CHKERRQ(ierr);
+#endif
 
 #if defined(PETSC_USE_LOG)
   ierr = PetscLogDestroy();CHKERRQ(ierr);