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

Jed Brown jedbrown at mcs.anl.gov
Mon Mar 19 10:23:44 CDT 2012


On Mon, Mar 19, 2012 at 09:59, Matthew Knepley <knepley at gmail.com> wrote:

> ctetgen.c:10050:20: warning: cast to pointer from integer of different
>> size [-Wint-to-pointer-cast]
>> ctetgen.c:10070:21: warning: cast to pointer from integer of different
>> size [-Wint-to-pointer-cast]
>>
>
> I can't change this, since this is what the package does. I guess they get
> away with it now.
>

It's a normal int, not a PetscInt, so at least it will always fit in that
pointer variable.

You can silence the warning by changing the line from

    leftarray[0] = (point) i; // The array length.

to

    leftarray[0] = (point) (PETSC_UINTPTR_T)i; // The array length.


Note that every // comment needs to be fixed. There are still a number of
Wunused-but-set-variable

/home/jed/petsc/src/dm/impls/complex/ctetgen.c: In function
‘TetGenMeshBTreeSort’:
/home/jed/petsc/src/dm/impls/complex/ctetgen.c:10050:20: warning: cast to
pointer from integer of different size [-Wint-to-pointer-cast]
/home/jed/petsc/src/dm/impls/complex/ctetgen.c:10070:21: warning: cast to
pointer from integer of different size [-Wint-to-pointer-cast]
/home/jed/petsc/src/dm/impls/complex/ctetgen.c: In function
‘TetGenMeshFindDirection2’:
/home/jed/petsc/src/dm/impls/complex/ctetgen.c:13153:49: warning: variable
‘cop’ set but not used [-Wunused-but-set-variable]
/home/jed/petsc/src/dm/impls/complex/ctetgen.c: In function
‘TetGenMeshConstrainedFacets’:
/home/jed/petsc/src/dm/impls/complex/ctetgen.c:15042:22: warning: variable
‘delaunayflag’ set but not used [-Wunused-but-set-variable]
/home/jed/petsc/src/dm/impls/complex/ctetgen.c: In function
‘TetGenMeshConstrainedFacets2’:
/home/jed/petsc/src/dm/impls/complex/ctetgen.c:15340:22: warning: variable
‘delaunayflag’ set but not used [-Wunused-but-set-variable]
/home/jed/petsc/src/dm/impls/complex/ctetgen.c: In function
‘TetGenMeshRepairEncSubs’:
/home/jed/petsc/src/dm/impls/complex/ctetgen.c:18617:8: warning: variable
‘oldptnum’ set but not used [-Wunused-but-set-variable]
/home/jed/petsc/src/dm/impls/complex/ctetgen.c: In function
‘TetGenMeshOptimize’:
/home/jed/petsc/src/dm/impls/complex/ctetgen.c:19734:18: warning: variable
‘maxdihed’ set but not used [-Wunused-but-set-variable]
/home/jed/petsc/src/dm/impls/complex/ctetgen.c: At top level:
/home/jed/petsc/src/dm/impls/complex/ctetgen.c:2026:23: warning:
‘ListHasItem’ defined but not used [-Wunused-function]


And the complex/int64 build is broken:

/home/jed/petsc/src/dm/impls/complex/complex.c:4047:36: error: assigning to
'PetscReal' (aka 'double') from incompatible type 'PetscScalar' (aka
'complex<double>');
        in->pointlist[idx*dim + d] = array[off+d];
                                   ^ ~~~~~~~~~~~~
/home/jed/petsc/src/dm/impls/complex/complex.c:4049:14: error: no matching
function for call to 'DMComplexGetLabelValue'
      ierr = DMComplexGetLabelValue(boundary, "marker", v,
&in->pointmarkerlist[idx]);CHKERRQ(ierr);
             ^~~~~~~~~~~~~~~~~~~~~~
/home/jed/petsc/src/dm/impls/complex/complex.c:1821:16: note: candidate
function not viable: no known conversion from 'int *' to 'PetscInt *' (aka
'long long *') for 4th argument;
PetscErrorCode DMComplexGetLabelValue(DM dm, const char name[], PetscInt
point, PetscInt *value)
               ^
/home/jed/petsc/src/dm/impls/complex/complex.c:4082:14: error: no matching
function for call to 'DMComplexGetLabelValue'
      ierr = DMComplexGetLabelValue(boundary, "marker", f,
&in->facetmarkerlist[idx]);CHKERRQ(ierr);
             ^~~~~~~~~~~~~~~~~~~~~~
/home/jed/petsc/src/dm/impls/complex/complex.c:1821:16: note: candidate
function not viable: no known conversion from 'int *' to 'PetscInt *' (aka
'long long *') for 4th argument;
PetscErrorCode DMComplexGetLabelValue(DM dm, const char name[], PetscInt
point, PetscInt *value)
               ^
/home/jed/petsc/src/dm/impls/complex/complex.c:4300:36: error: assigning to
'PetscReal' (aka 'double') from incompatible type 'PetscScalar' (aka
'complex<double>');
        in->pointlist[idx*dim + d] = array[off+d];
                                   ^ ~~~~~~~~~~~~
/home/jed/petsc/src/dm/impls/complex/complex.c:4302:14: error: no matching
function for call to 'DMComplexGetLabelValue'
      ierr = DMComplexGetLabelValue(dm, "marker", v,
&in->pointmarkerlist[idx]);CHKERRQ(ierr);
             ^~~~~~~~~~~~~~~~~~~~~~
/home/jed/petsc/src/dm/impls/complex/complex.c:1821:16: note: candidate
function not viable: no known conversion from 'int *' to 'PetscInt *' (aka
'long long *') for 4th argument;
PetscErrorCode DMComplexGetLabelValue(DM dm, const char name[], PetscInt
point, PetscInt *value)
               ^
5 errors generated.
make[2]: *** [CMakeFiles/petsc.dir/src/dm/impls/complex/complex.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/home/jed/petsc/src/dm/impls/complex/ctetgen.c:14202:26: warning: if
statement has empty body [-Wempty-body]
      if (!crossface.tet); {SETERRQ(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Not
handled yet");}
                         ^
/home/jed/petsc/src/dm/impls/complex/ctetgen.c:2026:23: warning: unused
function 'ListHasItem' [-Wunused-function]
static PetscErrorCode ListHasItem(List *l, void *checkitem, int *idx)
                      ^
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120319/cbb83089/attachment.html>


More information about the petsc-dev mailing list