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 632 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.
  • GuerrianG Offline
    GuerrianG Offline
    Guerrian
    wrote on 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

    kshegunovK 1 Reply Last reply
    0
    • GuerrianG Guerrian

      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.

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on 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
      • GuerrianG Offline
        GuerrianG Offline
        Guerrian
        wrote on 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

        kshegunovK JKSHJ 2 Replies Last reply
        0
        • GuerrianG Guerrian

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

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on 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
          • GuerrianG Guerrian

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

            JKSHJ Offline
            JKSHJ Offline
            JKSH
            Moderators
            wrote on 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

            • Login

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