<div class="gmail_quote">On Thu, Oct 7, 2010 at 21:15, Blaise Bourdin <span dir="ltr"><<a href="mailto:bourdin@lsu.edu">bourdin@lsu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
As of changeset 16818, it looks like PetscFunctionBegin checks for consistency of PETSC_FUNCTION_NAME (which is set in $PETSC_ARCH/include/petscconf.h to __func__ ) and __FUNCT__, which is user set<br>
<br>
This is a problem when __FUNCT__ as been set purposely (or not) to not match __func__<br>
Tao, for instance does a lot of<br>
#undef __FUNCT__<br>
#define __FUNCT__ "TaoVecPetsc::Clone"<br>
int TaoVecPetsc::Clone(TaoVec**ntv){<br>
In thus, case __func__ (and hence PETSC_FUNCTION_NAME ) is Clone, and PetscCheck__FUNCT__ complains (I only checked with the intel compilers on mac OS).<br></blockquote><div><br></div><div>That's expected, and __PRETTY_FUNCTION__ (which is not standard) includes all the types, so it wouldn't match either.  A partial fix would be to just waive the check if __FUNCT__ contains "::", but then you would still see the non-namespaced version (because __func__ takes precedence if configure finds it).  I vote for just turning it off for C++ builds of PETSc.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Would it be possible to relax PetscCheck__FUNCT__ or to have PETSC_FUNCTION_NAME set to __func__ only if __FUNCT__ is not defined?<br></blockquote><div><br></div><div>__FUNCT__ is defined to "User provided function" in the headers, and it would have to be defined at any PetscFunctionBegin if the compiler did not support __func__ or similar. The problem with turning off the check completely is that inconsistency creeps in and then we see wrong stack traces.  Also, it's really nice for users to not have to write all the __FUNCT__ stuff and still get correct traces for errors and -malloc_dump.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
If petsc is using PETSC_FUNCTION_NAME everywhere, do we even need __FUNCT__?<br></blockquote><div><br></div><div>__func__ was not standardized until C99, nothing is standard in C++, and idiot Microsoft still hasn't even partially added C99 support (maybe moot, I don't know if PETSc builds with Visual Studio at the moment).</div>
<div><br></div><div>Jed</div></div>