[petsc-dev] Reminder: *every* symbol with extern linkage *must* be namespaced

Barry Smith bsmith at mcs.anl.gov
Sun Apr 15 12:17:16 CDT 2012


On Apr 15, 2012, at 10:34 AM, Jed Brown wrote:

> On Sat, Mar 17, 2012 at 13:16, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> I have fixed the logging variables and a few others. The following incantation will show you a list of the symbols that are not currently in a "claimed" namespace (either directly or through bundling). These are arguably already too promiscuous, but the symbols that this does not filter out should probably be fixed.
> 
> $ nm --print-file-name mpich-static/lib/libpetsc.a |sort -k 3 | grep ' \(B\|D\|C\|T\) ' | grep -i -v ' \(XXT\|XYT\|Xi\|TetGen\|Vec\|Mat\|Petsc\|KSP\|PC\|SNES\|DM\|TS\|PF\|IS\|AO\|Characteristic\|ClassPerf\|EventPerfLog\|EventRegLog\|spbas_\|f90array\|mpifcmb\|SPARSEPACK\|MPIU_\|MINPACK\|admf_\)'
> 
> Why does PETSc use the MPIU_ prefix? MPICH2 uses it internally for "utility" routines. Should that stuff become PetscMPI_ or similar?
> 
> http://wiki.mcs.anl.gov/mpich2/index.php/Function_Name_Prefix_Convention

   We use MPIU_XXX as a replacement for missing/broken/...    MPI_XXX  

   The reason they start with MPI is to indicate their very close relationship with their "true" MPI cousins.

    I think the natural replacement is PETSC_MPI_XXX, if we make this change then the "obvious" connection to MPI_XXX is weaker. But proper naming spacing does dictate we make this change.

> 
> 
> Also, perhaps we should set up a board like this to highlight global naming violations.

   How about just catching the bad name in the repository after someone pushes an objectionable name and installing a virus onto their machine that taunts them for it?

> 
> http://www.mcs.anl.gov/research/projects/mpich2/todo/globsyms.htm




More information about the petsc-dev mailing list