Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Warnings not showing in "Issues" or "Compile Output"
Forum Updated to NodeBB v4.3 + New Features

Warnings not showing in "Issues" or "Compile Output"

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 631 Views 3 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.
  • G Offline
    G Offline
    Guerrian
    wrote on 28 Oct 2018, 21:25 last edited by Guerrian
    #1

    In Qt Creator I am trying to find dead code in my app by using the following in my "pro" file:

    QMAKE_CXXFLAGS += -std=c++11\
        -O3\
        -Wunused\
        -Wunreachable-code
    

    As a test, just to make sure there is some dead code, I added this function to my code:

    int none()
    {
        return -1;
    }
    

    But no such message shows up in the "Issues" or "Compile Output" window.

    Linux Mint 18.3
    Qt 5.14.1
    Qt Creator 4.11.1

    K 1 Reply Last reply 28 Oct 2018, 21:40
    0
    • G Guerrian
      28 Oct 2018, 21:25

      In Qt Creator I am trying to find dead code in my app by using the following in my "pro" file:

      QMAKE_CXXFLAGS += -std=c++11\
          -O3\
          -Wunused\
          -Wunreachable-code
      

      As a test, just to make sure there is some dead code, I added this function to my code:

      int none()
      {
          return -1;
      }
      

      But no such message shows up in the "Issues" or "Compile Output" window.

      K Offline
      K Offline
      kshegunov
      Moderators
      wrote on 28 Oct 2018, 21:40 last edited by
      #2

      @Guerrian said in Warnings not showing in "Issues" or "Compile Output":

      But no such message shows up in the "Issues" or "Compile Output" window.

      Try:

      int none()
      {
          return -1;
      
          int z = 0;
      }
      

      and tell us if that changes.

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      2
      • G Offline
        G Offline
        Guerrian
        wrote on 28 Oct 2018, 21:46 last edited by
        #3

        Ah yes, that did change. I was expecting it to tell me about unused functions.

        Linux Mint 18.3
        Qt 5.14.1
        Qt Creator 4.11.1

        K J 2 Replies Last reply 28 Oct 2018, 21:59
        0
        • G Guerrian
          28 Oct 2018, 21:46

          Ah yes, that did change. I was expecting it to tell me about unused functions.

          K Offline
          K Offline
          kshegunov
          Moderators
          wrote on 28 Oct 2018, 21:59 last edited by
          #4

          @Guerrian said in Warnings not showing in "Issues" or "Compile Output":

          I was expecting it to tell me about unused functions.

          Nope. Unused functions are not "unreachable code".
          You can still call them. ;)

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          2
          • G Guerrian
            28 Oct 2018, 21:46

            Ah yes, that did change. I was expecting it to tell me about unused functions.

            J Offline
            J Offline
            JKSH
            Moderators
            wrote on 29 Oct 2018, 04:59 last edited by JKSH
            #5

            @Guerrian said in Warnings not showing in "Issues" or "Compile Output":

            -Wunused
            

            This finds unused variables.

            -Wunreachable-code
            

            This finds things like @kshegunov's example.

            @Guerrian said in Warnings not showing in "Issues" or "Compile Output":

            I was expecting it to tell me about unused functions.

            You need a static code analyzer.

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            1 Reply Last reply
            4

            1/5

            28 Oct 2018, 21:25

            • Login

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