Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QTCreator add -Weffc++ to build

QTCreator add -Weffc++ to build

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
8 Posts 2 Posters 857 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sandro4912
    wrote on last edited by
    #1

    I want to add -Weffc++ as a flag for gcc so i can find some more bad practices on compilation.

    When I do this in the .pro file of my project:

    QMAKE_CXXFLAGS += -Weffc++
    

    It also throws me a million errors with the qt files. how can I tell the compiler to only look into my files?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      I don't think that is possible since for the compiler there are
      no theirs or mine files. its all just files in the project.

      So you have to process the output to exclude warnings for files you are not interested in.

      1 Reply Last reply
      1
      • S Offline
        S Offline
        sandro4912
        wrote on last edited by
        #3

        @mrjj said in QTCreator add -Weffc++ to build:

        process the output

        what do you mean with process the output?

        mrjjM 1 Reply Last reply
        0
        • S sandro4912

          @mrjj said in QTCreator add -Weffc++ to build:

          process the output

          what do you mean with process the output?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @sandro4912
          find a way to filter it using other app or similar to extract the
          lines you want to see.
          Its not possible directly in creator.

          Can you show one of the unwanted warnings ?

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sandro4912
            wrote on last edited by
            #5

            well it starts like this:

            In file included from /home/sandro/Qt/5.13.0/gcc_64/include/QtCore/qglobal.h:105:0,
                             from /home/sandro/Qt/5.13.0/gcc_64/include/QtGui/qtguiglobal.h:43,
                             from /home/sandro/Qt/5.13.0/gcc_64/include/QtGui/qimage.h:43,
                             from /home/sandro/Qt/5.13.0/gcc_64/include/QtGui/QImage:1,
                             from ../../minefield/src/converttograyscale.h:24,
                             from ../../minefield/src/converttograyscale.cpp:20:
            /home/sandro/Qt/5.13.0/gcc_64/include/QtCore/qcompilerdetection.h:1129:26: warning: prefix ‘T QBasicAtomicInteger<T>::operator++()’ should return ‘QBasicAtomicInteger<T>&’ [-Weffc++]
             # define Q_DECL_NOEXCEPT noexcept
                                      ^
            /home/sandro/Qt/5.13.0/gcc_64/include/QtCore/qcompilerdetection.h:1139:25: note: in expansion of macro ‘Q_DECL_NOEXCEPT’
             # define Q_DECL_NOTHROW Q_DECL_NOEXCEPT
                                     ^~~~~~~~~~~~~~~
            /home/sandro/Qt/5.13.0/gcc_64/include/QtCore/qbasicatomic.h:198:20: note: in expansion of macro ‘Q_DECL_NOTHROW’
                 T operator++() Q_DECL_NOTHROW
                                ^~~~~~~~~~~~~~
            /home/sandro/Qt/5.13.0/gcc_64/include/QtCore/qcompilerdetection.h:1129:26: warning: postfix ‘T QBasicAtomicInteger<T>::operator++(int)’ should return ‘QBasicAtomicInteger<T>’ [-Weffc++]
             # define Q_DECL_NOEXCEPT noexcept
                                      ^
            /home/sandro/Qt/5.13.0/gcc_64/include/QtCore/qcompilerdetection.h:1139:25: note: in expansion of macro ‘Q_DECL_NOEXCEPT’
             # define Q_DECL_NOTHROW Q_DECL_NOEXCEPT
                                     ^~~~~~~~~~~~~~~
            /home/sandro/Qt/5.13.0/gcc_64/include/QtCore/qbasicatomic.h:200:23: note: in expansion of macro ‘Q_DECL_NOTHROW’
                 T operator++(int) Q_DECL_NOTHROW
            
            mrjjM 1 Reply Last reply
            0
            • S sandro4912

              well it starts like this:

              In file included from /home/sandro/Qt/5.13.0/gcc_64/include/QtCore/qglobal.h:105:0,
                               from /home/sandro/Qt/5.13.0/gcc_64/include/QtGui/qtguiglobal.h:43,
                               from /home/sandro/Qt/5.13.0/gcc_64/include/QtGui/qimage.h:43,
                               from /home/sandro/Qt/5.13.0/gcc_64/include/QtGui/QImage:1,
                               from ../../minefield/src/converttograyscale.h:24,
                               from ../../minefield/src/converttograyscale.cpp:20:
              /home/sandro/Qt/5.13.0/gcc_64/include/QtCore/qcompilerdetection.h:1129:26: warning: prefix ‘T QBasicAtomicInteger<T>::operator++()’ should return ‘QBasicAtomicInteger<T>&’ [-Weffc++]
               # define Q_DECL_NOEXCEPT noexcept
                                        ^
              /home/sandro/Qt/5.13.0/gcc_64/include/QtCore/qcompilerdetection.h:1139:25: note: in expansion of macro ‘Q_DECL_NOEXCEPT’
               # define Q_DECL_NOTHROW Q_DECL_NOEXCEPT
                                       ^~~~~~~~~~~~~~~
              /home/sandro/Qt/5.13.0/gcc_64/include/QtCore/qbasicatomic.h:198:20: note: in expansion of macro ‘Q_DECL_NOTHROW’
                   T operator++() Q_DECL_NOTHROW
                                  ^~~~~~~~~~~~~~
              /home/sandro/Qt/5.13.0/gcc_64/include/QtCore/qcompilerdetection.h:1129:26: warning: postfix ‘T QBasicAtomicInteger<T>::operator++(int)’ should return ‘QBasicAtomicInteger<T>’ [-Weffc++]
               # define Q_DECL_NOEXCEPT noexcept
                                        ^
              /home/sandro/Qt/5.13.0/gcc_64/include/QtCore/qcompilerdetection.h:1139:25: note: in expansion of macro ‘Q_DECL_NOEXCEPT’
               # define Q_DECL_NOTHROW Q_DECL_NOEXCEPT
                                       ^~~~~~~~~~~~~~~
              /home/sandro/Qt/5.13.0/gcc_64/include/QtCore/qbasicatomic.h:200:23: note: in expansion of macro ‘Q_DECL_NOTHROW’
                   T operator++(int) Q_DECL_NOTHROW
              
              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              So
              maybe you could scan for
              /home/sandro/Qt/5.13.0/gcc_64/include/

              and remove that line and next line if it follows the same pattern ?

              1 Reply Last reply
              2
              • S Offline
                S Offline
                sandro4912
                wrote on last edited by
                #7

                @mrjj said in QTCreator add -Weffc++ to build:

                /home/sandro/Qt/5.13.0/gcc_64/include/

                can i do that in creator automatically?

                mrjjM 1 Reply Last reply
                0
                • S sandro4912

                  @mrjj said in QTCreator add -Weffc++ to build:

                  /home/sandro/Qt/5.13.0/gcc_64/include/

                  can i do that in creator automatically?

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @sandro4912
                  nope. write small qt program to do it.
                  Should be pretty simple if thats the patthern the warnings has.

                  1 Reply Last reply
                  1

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved