On Wed, Apr 8, 2015 at 9:08 AM, Jed Brown <[email protected]> wrote: > PETSc checkBuilds <[email protected]> writes: > > warnings attributed to commit ac76247 Point-to-point PetscSF: bcast and > reduce, still need fetch-and-op, ref #9 > > > > src/vec/is/sf/impls/basic/sfbasic.c:816 > > [ > http://ftp.mcs.anl.gov/pub/petsc/nightlylogs/archive/2015/04/08/build_next_arch-opensolaris-cmplx-pkgs-dbg_n-gage.log > ] > > > "/export/home/petsc/petsc.clone-3/src/vec/is/sf/impls/basic/sfbasic.c", > line 816: warning: loop not entered at top > > How do we fix this? If I remove the final (unreached) > PetscFunctionReturn(0) then the code is invalid when not > PETSC_USE_ERRORCHECKING (no return statement in function returning > non-void). But as long as error checking is on, we don't reach that > statement. Can we tune the warning flags to avoid this noise? > > static PetscErrorCode PetscSFBasicGetPackInUse(PetscSF sf,MPI_Datatype > unit,const void *key,PetscCopyMode cmode,PetscSFBasicPack *mylink) > { > PetscSF_Basic *bas = (PetscSF_Basic*)sf->data; > PetscErrorCode ierr; > PetscSFBasicPack link,*p; > > PetscFunctionBegin; > /* Look for types in cache */ > for (p=&bas->inuse; (link=*p); p=&link->next) { > PetscBool match; > ierr = MPIPetsc_Type_compare(unit,link->unit,&match);CHKERRQ(ierr); > if (match && (key == link->key)) { > switch (cmode) { > case PETSC_OWN_POINTER: *p = link->next; break; /* Remove from inuse > list */ > case PETSC_USE_POINTER: break; > default: SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"invalid > cmode"); > } > *mylink = link; > PetscFunctionReturn(0); > } > } > SETERRQ(PetscObjectComm((PetscObject)sf),PETSC_ERR_ARG_WRONGSTATE,"Could > not find pack"); > PetscFunctionReturn(0); > } >
I think you need an if () to make the compiler quit whining. Matt -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener
