Uploaded image for project: 'XalanC'
  1. XalanC
  2. XALANC-570

Removal of compiler warnings from STLHelper.hpp

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.9
    • CurrentCVS
    • XalanC
    • None
    • g++ (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-52), Intel

    Description

      When programs using Xalan (or Xalan itself) are compiled, the following compiler warning is generated from 3 points in STLHelper.cpp (lines 127, 245 and 284):

      /home/singleto/Xalan_prob/xml-xalan/c/src/xalanc/Include/STLHelper.hpp: In
      member function `std::unary_function<const _Tp*, void>::result_type
      xalanc_1_9::DeleteFunctor<Type>::operator()(std::unary_function<const _Tp*,
      void>::argument_type) const':
      /home/singleto/Xalan_prob/xml-xalan/c/src/xalanc/Include/STLHelper.hpp:127: warning: no
      return statement in function returning non-void
      /home/singleto/Xalan_prob/xml-xalan/c/src/xalanc/Include/STLHelper.hpp: In
      member function `std::unary_function<_Tp, void>::result_type
      xalanc_1_9::ClearFunctor<Type>::operator()(std::unary_function<_Tp,
      void>::argument_type&) const':
      /home/singleto/Xalan_prob/xml-xalan/c/src/xalanc/Include/STLHelper.hpp:245: warning: no
      return statement in function returning non-void
      /home/singleto/Xalan_prob/xml-xalan/c/src/xalanc/Include/STLHelper.hpp: In
      member function `std::unary_function<T::value_type&, void>::result_type
      xalanc_1_9::MapValueDeleteFunctor<T>::operator()(std::unary_function<T::value_type&,
      void>::argument_type) const':
      /home/singleto/Xalan_prob/xml-xalan/c/src/xalanc/Include/STLHelper.hpp:284: warning: no
      return statement in function returning non-void

      An inspection of the code ( see below) shows that in all three cases no value is returned.

      Line 127
      result_type
      operator()(argument_type thePointer) const

      { makeXalanDestroyFunctor(thePointer)(thePointer, m_memoryManager); }

      Line 245
      result_type
      operator()(argument_type& theArg) const

      { theArg.clear(); }

      Line 284
      result_type
      operator()(argument_type thePair) const

      { makeXalanDestroyFunctor(thePair.second)(thePair.second, m_memoryManager); }

      The easiest way to solve the problem (or at least to get the compiler warnings to go away) ist to add a return, as shown below:

      Line 127
      result_type
      operator()(argument_type thePointer) const

      { return makeXalanDestroyFunctor(thePointer)(thePointer, m_memoryManager); }

      Line 245
      result_type
      operator()(argument_type& theArg) const

      { return theArg.clear(); }

      Line 284
      result_type
      operator()(argument_type thePair) const

      { return makeXalanDestroyFunctor(thePair.second)(thePair.second, m_memoryManager); }

      Perhaps I have overlooked something here, but I offer my correction in any case. I will send the amended code by email

      Attachments

        1. STLHelper.hpp
          17 kB
          Steven J. Hathaway
        2. STLHelper.hpp.diff
          0.9 kB
          Steven J. Hathaway
        3. STLHelper.hpp
          17 kB
          Steven J. Hathaway

        Activity

          People

            dbertoni David N Bertoni
            davidsingleton David Singleton
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: