<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 30 Jan 2020 at 08:25, Smith, Barry F. <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
> On Jan 27, 2020, at 3:42 PM, Lisandro Dalcin <<a href="mailto:dalcinl@gmail.com" target="_blank">dalcinl@gmail.com</a>> wrote:<br>>  <br>
> +#if defined(__GNUC__) && (__GNUC__ >= 4)<br>
> +#pragma GCC system_header<br>
> +#endif<br>
> +<br>
>  #define PETSC_CXX_COMPLEX_FIX(Type) \<br>
>  static inline PetscComplex operator+(const PetscComplex& lhs, const Type& rhs) { return const_cast<PetscComplex&>(lhs) + PetscReal(rhs); } \<br>
>  static inline PetscComplex operator+(const Type& lhs, const PetscComplex& rhs) { return PetscReal(lhs) + const_cast<PetscComplex&>(rhs); } \<br>
> <br>
> Would that be an acceptable solution o we should rather implement a configure test and define PETSC_HAVE_PRAGMA_GCC_SYSTEM_HEADER ? <br>
<br>
  I'm fine with having it handled by the version check.<br>
<br></blockquote><div><br></div><div>Thanks. </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> <br>
> These are the kind of errors that show up for EVERY C++ source compile if -Wfloat-equal is passed.<br>
> <br>
> /home/devel/petsc/dev/include/petsccxxcomplexfix.h: In function ‘bool operator==(const PetscComplex&, const PetscInt&)’:<br>
> /home/devel/petsc/dev/include/petsccxxcomplexfix.h:47:134: warning: comparing floating point with == or != is unsafe [-Wfloat-equal]<br>
>    47 | static inline bool operator==(const PetscComplex& lhs, const Type& rhs) { return const_cast<PetscComplex&>(lhs).imag() == PetscReal(0) && const_cast<PetscComplex&>(lhs).real() == PetscReal(rhs); } \<br>
>       |                                                                                                                                      ^<br>
> /home/devel/petsc/dev/include/petsccxxcomplexfix.h:60:1: note: in expansion of macro ‘PETSC_CXX_COMPLEX_FIX’<br>
>    60 | PETSC_CXX_COMPLEX_FIX(PetscInt)<br>
<br>
  I don't understand the above. Are these two unrelated issues? Or does adding the first chunk of code prevent the warnings from the second chunk of code.<br>
<br></blockquote><div><br></div><div>Yes, that's it. using `#pragma GCC system_header`  suppresses all warnings in that header file, including of course `-Wfloat-equal`. </div><div><br></div></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Lisandro Dalcin<br>============<br>Research Scientist<br>Extreme Computing Research Center (ECRC)<br>King Abdullah University of Science and Technology (KAUST)<br><a href="http://ecrc.kaust.edu.sa/" target="_blank">http://ecrc.kaust.edu.sa/</a><br></div></div></div></div>