Re: [petsc-dev] Forward declarations of types?
Boy they added some silly little tiny things in C11 On Feb 15, 2013, at 3:38 PM, Jed Brown <[email protected]> wrote:
On Fri, Feb 15, 2013 at 12:38 PM, Barry Smith <[email protected]> wrote: How does one prevent this problem?
[ 15%] Building C object CMakeFiles/petsc.dir/src/ksp/pc/impls/is/nn/nn.c.o In file included from /Users/barrysmith/Src/petsc-dev/src/ksp/pc/impls/bjacobi/bjacobi.c:184: /Users/barrysmith/Src/petsc-dev/include/petscdraw.h:283: error: redefinition of typedef ‘PetscDrawLG’ /Users/barrysmith/Src/petsc-dev/include/petscksp.h:598: error: previous declaration of ‘PetscDrawLG’ was here
Heh, I thought I remembered that duplicate typedefs were invalid in C, but gcc happily compiled it without a warning. In fact, they _are_ allowed in C11, but not in our old, crusty version of C.
I guess the reliable way to do this would be to have petsc-private/${pkg}types.h that were included internally by those headers that depend on the types, like petscksp.h. It wouldn't be user-visible, but I'm not sure it's worthwhile.
participants (1)
-
Barry Smith