geodynamics / aspect

A parallel, extensible finite element code to simulate convection in both 2D and 3D models.
https://aspect.geodynamics.org/
Other
227 stars 237 forks source link

Use of mismatched enum types. #6101

Closed bangerth closed 1 month ago

bangerth commented 1 month ago

I see lots of warnings of the following kind:

/home/bangerth/p/deal.II/1/projects/aspect/source/particle/manager.cc:473:34: warning: bitwise operation between different enumeration types ‘dealii::EvaluationFlags::EvaluationFlags’ and ‘dealii::UpdateFlags’ is deprecated [-Wdeprecated-enum-enum-conversion]
  473 |       if (evaluation_flags_union & (update_values | update_gradients))
      |           ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/bangerth/p/deal.II/1/projects/aspect/source/particle/manager.cc:483:34: warning: bitwise operation between different enumeration types ‘dealii::EvaluationFlags::EvaluationFlags’ and ‘dealii::UpdateFlags’ is deprecated [-Wdeprecated-enum-enum-conversion]
  483 |       if (evaluation_flags_union & update_values)
      |           ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/home/bangerth/p/deal.II/1/projects/aspect/source/particle/manager.cc:486:34: warning: bitwise operation between different enumeration types ‘dealii::EvaluationFlags::EvaluationFlags’ and ‘dealii::UpdateFlags’ is deprecated [-Wdeprecated-enum-enum-conversion]
  486 |       if (evaluation_flags_union & update_gradients)
      |           ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/home/bangerth/p/deal.II/1/projects/aspect/source/particle/manager.cc:492:38: warning: bitwise operation between different enumeration types ‘dealii::EvaluationFlags::EvaluationFlags’ and ‘dealii::UpdateFlags’ is deprecated [-Wdeprecated-enum-enum-conversion]
  492 |           if (evaluation_flags_union & update_values)
      |               ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/home/bangerth/p/deal.II/1/projects/aspect/source/particle/manager.cc:496:38: warning: bitwise operation between different enumeration types ‘dealii::EvaluationFlags::EvaluationFlags’ and ‘dealii::UpdateFlags’ is deprecated [-Wdeprecated-enum-enum-conversion]
  496 |           if (evaluation_flags_union & update_gradients)
      |               ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~

We should probably address this before the release.

bangerth commented 1 month ago

I've got a patch. It is really a miracle that this works at all, made possible by the fact that EvaluationFlags and UpdateFlags use the same numeric values for values and gradients.

bangerth commented 1 month ago

I'm confused why this was not caught by the CI :-(

bangerth commented 1 month ago

For the record, this was introduced in be888f3f3c642d4f78085f7d461c165d6ccd72a0 as part of #6051.

tjhei commented 1 month ago

Oh, that is indeed annoying that CI did not find it.

bangerth commented 1 month ago

I wonder if we could finagle it in such a way that we compile with -Werror. I think we're not doing that because we inherit compile flags from deal.II?