Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-21525

Compiler warning about catching polymorphic exceptions by value

    XMLWordPrintable

Details

    • Improvement
    • Status: Done
    • Resolution: Done
    • None
    • afw, cpputils, daf_base
    • None

    Description

      Starting with devtoolset-8, gcc-8 warns about catching polymorphic exceptions by value. As far as I understand, this is a bad coding practice in general.

       

      The occurrence I've checked regarding ip_diffim build in afw/math/Statistics.h:115 is harmless, and I'll change it as part of DM-21422.

       

      A list of places to check are grepped and attached.

       

      http://ptgmedia.pearsoncmg.com/images/0321113586/items/sutter_item73.pdf

       

      In file included from /software/lsstsw/stack_20191001/stack/miniconda3-4.5.12-1172c30/Linux64/afw/18.1.0-17-gd2166b6e4/include/lsst/afw/math/Background.h:34,
       from /software/lsstsw/stack_20191001/stack/miniconda3-4.5.12-1172c30/Linux64/afw/18.1.0-17-gd2166b6e4/include/lsst/afw/math.h:33,
       from examples/maskedKernel.cc:2:
       /software/lsstsw/stack_20191001/stack/miniconda3-4.5.12-1172c30/Linux64/afw/18.1.0-17-gd2166b6e4/include/lsst/afw/math/Statistics.h: In constructor 'lsst::afw::math::StatisticsControl::StatisticsControl(double, int, lsst::afw::image::MaskPixel, bool, lsst::afw::math::StatisticsControl::WeightsBoolean)':
       /software/lsstsw/stack_20191001/stack/miniconda3-4.5.12-1172c30/Linux64/afw/18.1.0-17-gd2166b6e4/include/lsst/afw/math/Statistics.h:115:41: warning: catching polymorphic type 'class lsst::pex::exceptions::InvalidParameterError' by value [-Wcatch-value=]
       } catch (lsst::pex::exceptions::InvalidParameterError) \{
       ^~~~~~~~~~~~~~~~~~~~~
      

      Attachments

        Issue Links

          Activity

            People

              wittgen Matthias Wittgen
              gkovacs Gabor Kovacs [X] (Inactive)
              Jim Bosch, Matthias Wittgen, Tim Jenness
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Jenkins

                  No builds found.