[petsc-dev] source code and configure don't know what each other is doing?

Barry Smith bsmith at mcs.anl.gov
Mon Nov 18 11:30:37 CST 2013

On Nov 18, 2013, at 9:16 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> Barry Smith <bsmith at mcs.anl.gov> writes:
>>  I think you missed my point. The source code uses _Complex but the
>>  configure test uses complex (nothing to do with complex.h). 
> It includes the C99 header <complex.h>, which the standard says contains
> #define complex _Complex
> and a few other things.
>>  Shouldn’t the configure test use _Complex?
> It could, but the warning only comes up due to -std=c89 -pedantic and,
> even then only due to compiler voodoo before the preprocessor.  That is,
> * if I include complex.h and use _Complex directly, I get the warning

   Yup and that is why the configure test needs to be the same as the actual source code. Which it currently is not and that should be fixed.  This is my entire point, despite “standards” and how things “are suppose to work” there is often voodoo lying around so one cannot rely on “standards” or “how things are suppose to be” one needs to test exactly the configuration used in the code, not some other supposedly “equivalent” code.

> * if I include complex.h and use "complex", no warning
> * if I include complex.h and use "complex", and preprocess the source
>  (-E), the result contains plain _Complex and if I try to compiler
>  that, I get a warning.
>> http://ftp.mcs.anl.gov/pub/petsc/nightlylogs/archive/2013/11/17/build_master_arch-linux-c89_thrash.log
>>         CC arch-linux-c89/obj/src/sys/objects/pinit.o
>> In file included from /sandbox/petsc/petsc.clone-2/include/petscsys.h:326:0,
>>                 from /sandbox/petsc/petsc.clone-2/include/petsc-private/petscimpl.h:8,
>>                 from src/sys/objects/pinit.c:6:
>> /sandbox/petsc/petsc.clone-2/include/petscmath.h:119:16: warning: ISO C90 does not support complex types [-Wpedantic]
>> typedef double _Complex PetscComplex;
> BuildSystem currently ignores all compiler warnings so just changing the
> test would not be enough.  (We should fix that.)


> Note that all of this discussion is moot if the user elides -pedantic
> when using -std=c89, and that we already pass -Wno-long-long to get
> around one piece missing from C89 that we really need.

More information about the petsc-dev mailing list