Uploaded image for project: 'SonarCFamily'
  1. SonarCFamily
  2. CPP-1407

Reduce noise generated by rules S121 and S134 for BOOST_FOREACH

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.8
    • Fix Version/s: 3.12
    • Component/s: Rules
    • Labels:
      None

      Description

      Simple example from http://www.boost.org/doc/libs/1_60_0/doc/html/foreach.html#foreach.introduction.hello__world_ :

      #include <string>
      #include <iostream>
      #include <boost/foreach.hpp>
      
      int main() {
          std::string hello( "Hello, world!" );
          BOOST_FOREACH( char ch, hello )
          {
              std::cout << ch;
          }
          return 0;
      }
      

      behaviour of this macro looks like

      for (...; ...; ...) if (...) { } else /* S121 */ for (...; ...; ...) // expansion
      // user code
      

      Another example (SUPPORT-2601) :

      #define DEBUG if (condition) print
      DEBUG("msg");
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              alban.auzeill Alban Auzeill
              Reporter:
              evgeny.mandrikov Evgeny Mandrikov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: