[petsc-dev] Hijacked MPI calls...

Satish Balay balay at mcs.anl.gov
Mon Sep 12 23:19:55 CDT 2016


The attached patch gets rid of most of the warnings [esp MPI usage
from PETSc code - with the logging wrappers].

[also added to balay/clang-Wcomma]

Satish

On Mon, 12 Sep 2016, Satish Balay wrote:

> ok - so you are using CFLAGS=-Wcomma on your build..
> 
> I see warnings now. Attaching make.log
> 
> Satish
> 
> On Mon, 12 Sep 2016, Eric Chamberland wrote:
> 
> > 
> > 
> > Le 2016-09-12 à 17:32, Satish Balay a écrit :
> > > Do you get these warnings with PETSc library build aswell?
> > I can't tell since I didn't tried to build PETSc with clang...
> > >
> > > The logging code tries to log all messages in library and in
> > > application - and prints a summary with -info.
> > >
> > > You can disable logging in your build with configure option: --with-log=0
> > >
> > > Or you can define the PETSC_HAVE_BROKEN_RECURSIVE_MACRO in your
> > > code/compile - and the wrappers will be skipped..
> > ok, so these may be good workaround for me to keep -Wcomma activated on our
> > "push server" that filters incoming commits...
> > 
> > Thanks!!!
> > 
> > Eric
> > 
> > 
> > 
> 
-------------- next part --------------
diff --git a/include/petscbt.h b/include/petscbt.h
index 6d08fd5..9904f03 100644
--- a/include/petscbt.h
+++ b/include/petscbt.h
@@ -49,10 +49,10 @@ PETSC_STATIC_INLINE char PetscBTLookup(PetscBT array,PetscInt index)
   char      BT_mask,BT_c;
   PetscInt  BT_idx;
 
- return  (BT_idx        = index/PETSC_BITS_PER_BYTE,
-          BT_c          = array[BT_idx],
-          BT_mask       = (char)(1 << index%PETSC_BITS_PER_BYTE),
-          (char)(BT_c & BT_mask));
+  BT_idx        = index/PETSC_BITS_PER_BYTE;
+  BT_c          = array[BT_idx];
+  BT_mask       = (char)(1 << index%PETSC_BITS_PER_BYTE);
+  return (char)(BT_c & BT_mask);
 }
 
 PETSC_STATIC_INLINE PetscErrorCode PetscBTView(PetscInt m,const PetscBT bt,PetscViewer viewer)
@@ -80,11 +80,11 @@ PETSC_STATIC_INLINE char PetscBTLookupSet(PetscBT array,PetscInt index)
   char      BT_mask,BT_c;
   PetscInt  BT_idx;
 
-  return (BT_idx        = index/PETSC_BITS_PER_BYTE,
-          BT_c          = array[BT_idx],
-          BT_mask       = (char)(1 << index%PETSC_BITS_PER_BYTE),
-          array[BT_idx] = (char)(BT_c | BT_mask),
-          (char)(BT_c & BT_mask));
+  BT_idx        = index/PETSC_BITS_PER_BYTE;
+  BT_c          = array[BT_idx];
+  BT_mask       = (char)(1 << index%PETSC_BITS_PER_BYTE);
+  array[BT_idx] = (char)(BT_c | BT_mask);
+  return        (char)(BT_c & BT_mask);
 }
 
 PETSC_STATIC_INLINE PetscErrorCode PetscBTSet(PetscBT array,PetscInt index)
@@ -113,11 +113,11 @@ PETSC_STATIC_INLINE char PetscBTLookupClear(PetscBT array,PetscInt index)
   char      BT_mask,BT_c;
   PetscInt  BT_idx;
 
-  return (BT_idx        = index/PETSC_BITS_PER_BYTE,
-          BT_c          = array[BT_idx],
-          BT_mask       = (char)(1 << index%PETSC_BITS_PER_BYTE),
-          array[BT_idx] = (char)(BT_c & ~BT_mask),
-          (char)(BT_c & BT_mask));
+  BT_idx        = index/PETSC_BITS_PER_BYTE;
+  BT_c          = array[BT_idx];
+  BT_mask       = (char)(1 << index%PETSC_BITS_PER_BYTE);
+  array[BT_idx] = (char)(BT_c & ~BT_mask);
+  return (char)(BT_c & BT_mask);
 }
 
 PETSC_STATIC_INLINE PetscErrorCode PetscBTClear(PetscBT array,PetscInt index)
diff --git a/include/petsclog.h b/include/petsclog.h
index 76c7332..2a8658d 100644
--- a/include/petsclog.h
+++ b/include/petsclog.h
@@ -314,9 +314,12 @@ PETSC_EXTERN PetscErrorCode PetscLogEventZeroFlops(PetscLogEvent);
 */
 PETSC_STATIC_INLINE PetscErrorCode PetscMPITypeSize(PetscLogDouble *buff,PetscMPIInt count,MPI_Datatype type)
 {
-  PetscMPIInt mysize; 
+  PetscMPIInt mysize;
+  PetscErrorCode _myierr;
   if (type == MPI_DATATYPE_NULL) return 0;
-  else return  (MPI_Type_size(type,&mysize) || ((*buff += (PetscLogDouble) (count*mysize)),0));
+  _myierr = MPI_Type_size(type,&mysize);CHKERRQ(_myierr);
+  *buff += (PetscLogDouble) (count*mysize);
+  return 0;
 }
 
 PETSC_STATIC_INLINE PetscErrorCode PetscMPITypeSizeComm(MPI_Comm comm, PetscLogDouble *buff,PetscMPIInt *counts,MPI_Datatype type)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: make.log
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20160912/eeb5fff7/attachment.ksh>


More information about the petsc-dev mailing list