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. Reducing the number of warning in Qt Creator when editing plain C code
QtWS25 Last Chance

Reducing the number of warning in Qt Creator when editing plain C code

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
10 Posts 4 Posters 2.2k Views
  • 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.
  • R Offline
    R Offline
    rrossi
    wrote on last edited by
    #1

    Sometime I need to use the Qt Creator as IDE to edit plain C code.
    Using QT Creator 4.7.1 the number of warnings / errors shown editing the code is confusing.
    Here is an example:
    0_1540299516714_testmain.png

    Is it possible to reduce the number of false positives or, on the worst case to disable everything on a project basis ?

    JonBJ 1 Reply Last reply
    0
    • R rrossi

      Sometime I need to use the Qt Creator as IDE to edit plain C code.
      Using QT Creator 4.7.1 the number of warnings / errors shown editing the code is confusing.
      Here is an example:
      0_1540299516714_testmain.png

      Is it possible to reduce the number of false positives or, on the worst case to disable everything on a project basis ?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @rrossi
      This is purely a hazarded guess....

      I used Qt Creator a while ago for pure C and did not have any such problems. All 3 of your warnings would come from failing to find/process your #includes correctly. Are you sure it is finding them (some kind of "INCLUDE" path) and pre-processing them with correct defines?

      R aha_1980A 2 Replies Last reply
      1
      • JonBJ JonB

        @rrossi
        This is purely a hazarded guess....

        I used Qt Creator a while ago for pure C and did not have any such problems. All 3 of your warnings would come from failing to find/process your #includes correctly. Are you sure it is finding them (some kind of "INCLUDE" path) and pre-processing them with correct defines?

        R Offline
        R Offline
        rrossi
        wrote on last edited by
        #3

        @JonB Qt Creator itself recognizes the includes. Typing F2 over a symbol (like fprintf) go to the definition in stdio.h. It seems that the clang-model or some of the other new syntax tools is not able to analyse the includes, or analyses them with wrong parameters.

        aha_1980A 1 Reply Last reply
        1
        • R rrossi

          @JonB Qt Creator itself recognizes the includes. Typing F2 over a symbol (like fprintf) go to the definition in stdio.h. It seems that the clang-model or some of the other new syntax tools is not able to analyse the includes, or analyses them with wrong parameters.

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @rrossi

          you are fully right, some headers drive Clang crazy and lead to situations like yours or QTCREATORBUG-20039.

          I sometimes manage to fix my includes so the errors disappear, but with system includes thats hardly manageable.

          but if you have minimal examplesthat trigger this, then you can create bugreports so we hopefully get this fixed.

          Qt has to stay free or it will die.

          R 1 Reply Last reply
          1
          • JonBJ JonB

            @rrossi
            This is purely a hazarded guess....

            I used Qt Creator a while ago for pure C and did not have any such problems. All 3 of your warnings would come from failing to find/process your #includes correctly. Are you sure it is finding them (some kind of "INCLUDE" path) and pre-processing them with correct defines?

            aha_1980A Offline
            aha_1980A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @JonB Thats correct, but Clang is very picky and gets to error states even you did all right.

            the old code model was more relaxed in that regard.

            Qt has to stay free or it will die.

            1 Reply Last reply
            0
            • aha_1980A aha_1980

              @rrossi

              you are fully right, some headers drive Clang crazy and lead to situations like yours or QTCREATORBUG-20039.

              I sometimes manage to fix my includes so the errors disappear, but with system includes thats hardly manageable.

              but if you have minimal examplesthat trigger this, then you can create bugreports so we hopefully get this fixed.

              R Offline
              R Offline
              rrossi
              wrote on last edited by
              #6

              @aha_1980 I will try to file a bugreport on Sunday... It takes a lot of work to do it.
              In the meantime I switched to an older version of Qt Creator.
              Doing that one have to remember to use the -settingspath option to avoid to damage the configuration of the current version.

              aha_1980A R 2 Replies Last reply
              0
              • R rrossi

                @aha_1980 I will try to file a bugreport on Sunday... It takes a lot of work to do it.
                In the meantime I switched to an older version of Qt Creator.
                Doing that one have to remember to use the -settingspath option to avoid to damage the configuration of the current version.

                aha_1980A Offline
                aha_1980A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @rrossi

                If you are really unhappy, it might be enough to disable Clang Code Model in newer Creator: Help > About Plugins > Clang Code Model.

                I'll try to update QTCREATORBUG-20039 soon also, but as you said, that's quite some work to produce good examples. I think if this bug is fixed, most of your problems should disappear also.

                Regards

                Qt has to stay free or it will die.

                R 1 Reply Last reply
                0
                • aha_1980A aha_1980

                  @rrossi

                  If you are really unhappy, it might be enough to disable Clang Code Model in newer Creator: Help > About Plugins > Clang Code Model.

                  I'll try to update QTCREATORBUG-20039 soon also, but as you said, that's quite some work to produce good examples. I think if this bug is fixed, most of your problems should disappear also.

                  Regards

                  R Offline
                  R Offline
                  rrossi
                  wrote on last edited by
                  #8

                  @aha_1980 I think me too it is all related. My impression is that Clang get confused on the __BEGIN_DECLS instruction in the include, but we cannot cheat defining correctly the instruction because it has some "a priori" knowledge.

                  Yes, disabling Clang Code Model may be an option, but it is a global option. and working in C++ the Clang Code Model makes a good service, even if I still wasn't able to turn off a single warning on a specific line...

                  1 Reply Last reply
                  0
                  • R rrossi

                    @aha_1980 I will try to file a bugreport on Sunday... It takes a lot of work to do it.
                    In the meantime I switched to an older version of Qt Creator.
                    Doing that one have to remember to use the -settingspath option to avoid to damage the configuration of the current version.

                    R Offline
                    R Offline
                    rrossi
                    wrote on last edited by
                    #9

                    @rrossi it seems that version 4.7.2 of Qt Creator solved the problem

                    1 Reply Last reply
                    1
                    • D Offline
                      D Offline
                      dnzcntrk
                      wrote on last edited by
                      #10

                      I know it's been a while over this topic but as a reference to newer searchers:

                      You can just disable those warnings and errors in coding time. And only at compile time you can receive them. For this :
                      Tools -> Analyzer -> Clang Tools and uncheck "Analyze open files" option button. After that you will have a clear coding screen : )

                      Regards

                      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