General

I suggest you ...

You've used all your votes and won't be able to post a new idea, but you can still search and comment on existing ideas.

There are two ways to get more votes:

  • When an admin closes an idea you've voted on, you'll get your votes back from that idea.
  • You can remove your votes from an open idea you support.
  • To see ideas you have already voted on, select the "My feedback" filter and select "My open ideas".
(thinking…)

Enter your idea and we'll search to see if someone has already suggested it.

If a similar idea already exists, you can support and comment on it.

If it doesn't exist, you can post your idea so others can support it.

Enter your idea and we'll search to see if someone has already suggested it.

  1. Find message inhibitions inside files that have no effect

    Sometimes the following happens:
    Code is created with a deliberate violation of a lint message.
    The message in inhibited with a comment in the code.
    However, it often happens comments are not updated with code.
    So the reason for the inhibition may be removed and the inhibition stays.

    It would be nice to find such "broken" inhibitions, (that have no effect on the resulting messages even when all other inhibitions are disabled).
    Maybe this search can be a result of executing pc-lint with a special flag.

    This way the code can be cleaned of old inhibitions.

    36 votes
    Vote
    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      You have left! (?) (thinking…)
    • Having multiple initializer functions in a constructor

      Lint checks, if all of the members are initialized in the constructor. Optionally this check could be redirected to an initializer-function introduced with the -sem Command. But then the initialization has to be done completely in the initializer-function.

      In our embedded software it is quite common to have more than one function doing the initialization task, e.g.:

      class A
      {
      public:
      A()
      {
      member_a = 0;
      initFunction1();
      initFunction2();
      }
      private:
      void initFunction1()
      {
      member_b = 0;
      }

      void initFunction2()
      {
      member_c = 0;
      }

      int member_a;
      int member_b;
      int member_c;
      };

      It would be very helpful, that lint supports this…

      19 votes
      Vote
      Sign in
      Check!
      (thinking…)
      Reset
      or sign in with
      • facebook
      • google
        Password icon
        I agree to the terms of service
        Signed in as (Sign out)
        You have left! (?) (thinking…)
      • Expected Warning 438: Last value assigned to variable not used

        Hi,

        For the following code I really expected lint
        warning 438. However, lint isn't complaining about
        that. Not even when I use -w4 (it complains about
        using ++ inside a function call, but not about
        438, which is more serious in my opinion)

        extern int f(void);
        extern void g(int x);

        void bla(void)
        {
        int x = f();
        g(x++);
        }

        Am I misunderstanding something, or is Lint really
        lacking here?

        Note: If I change the code to do

        g(x)
        x++;

        Which I would think is 'the same', I do get the
        438 lint warning of course.

        Best regards,

        Arnaud Gouder de…

        18 votes
        Vote
        Sign in
        Check!
        (thinking…)
        Reset
        or sign in with
        • facebook
        • google
          Password icon
          I agree to the terms of service
          Signed in as (Sign out)
          You have left! (?) (thinking…)
        • Allow Lint to see that constructor takes ownership of memory.

          Lint sees that ownership of allocated memory is taken by a constructor if the owning object isn't "new'd". But if the owning object is "new'd", then Lint does not understand this. See the example below, which works in the online demo.

          This was discussed in this thread, as well as several others:
          http://www.gimpel.com/Discussion.cfm?ThreadID=808

          //lint -e438, -e529, -e1502, -e1712, -e1788, -e714
          #include <memory>

          struct A { A(char *){}; };
          void g( )
          {
          // This results in a 429 warning.
          char * ptr1 = (char *) malloc(10);
          A *a1 = new A(ptr1);

          // This does not result in a 429 warning. …

          16 votes
          Vote
          Sign in
          Check!
          (thinking…)
          Reset
          or sign in with
          • facebook
          • google
            Password icon
            I agree to the terms of service
            Signed in as (Sign out)
            You have left! (?) (thinking…)
            planned  ·  0 comments  ·  Admin →
          • Detect -e Options and -save without -restore

            -e Options without surrounding -save/-restore in the same file shall be warned.
            Also a -save without -restore in the same file or same block level shall be warned.

            14 votes
            Vote
            Sign in
            Check!
            (thinking…)
            Reset
            or sign in with
            • facebook
            • google
              Password icon
              I agree to the terms of service
              Signed in as (Sign out)
              You have left! (?) (thinking…)
            • C99: bool assignment error

              //lint -A(C99)
              typedef unsigned char uint8;
              typedef _Bool bool;

              const uint8 a = 100;
              const uint8 b = 200;
              int main(void)
              {
              bool test;
              test = (a==b);
              }
              Report error 1564 or 921 (cast from int to bool)

              Lint should know that the assignment of
              test = (a==b) is save on C99.
              Additionally, in our case it could not be deactivated by -estring(921,"cast from int to bool")

              11 votes
              Vote
              Sign in
              Check!
              (thinking…)
              Reset
              or sign in with
              • facebook
              • google
                Password icon
                I agree to the terms of service
                Signed in as (Sign out)
                You have left! (?) (thinking…)
                1 comment  ·  Admin →
              • Add support for pthread_mutex_trylock() semantics

                As described in http://www.gimpel.com/Discussion.cfm?ThreadID=3793 this functionality is needed.

                For example, this function results in lint warning 455 (A thread mutex that had not been locked is being unlocked):

                bool IsLocked()
                {
                int retStat = pthread_mutex_trylock(&m_pthreadMutex);
                if (retStat == 0)
                {
                // Mutex was not locked, but is now.
                pthread_mutex_unlock(&m_pthreadMutex);
                return (false);
                }
                else if (retStat == EBUSY)
                {
                // Mutex is already locked.
                return (true);
                }
                return (false);
                }

                11 votes
                Vote
                Sign in
                Check!
                (thinking…)
                Reset
                or sign in with
                • facebook
                • google
                  Password icon
                  I agree to the terms of service
                  Signed in as (Sign out)
                  You have left! (?) (thinking…)
                • Add option to show messages found in header file only once

                  Consider this: a.h contains 10 problems and is included in 10 modules.
                  That leaves you with 100 lint messages in the log, when in reality there are only 10 problems to fix.
                  So, having an option that shows messages in header files only the first time it is included would be really cool (and more honest in terms of MISRA violations).

                  10 votes
                  Vote
                  Sign in
                  Check!
                  (thinking…)
                  Reset
                  or sign in with
                  • facebook
                  • google
                    Password icon
                    I agree to the terms of service
                    Signed in as (Sign out)
                    You have left! (?) (thinking…)
                  • Report differences between formal parameter names in header file prototypes and formal parameter namers in function definitions

                    Formal parameter names in function prototypes are optional, but are often used, ideally with names that convey something about the value that should be passed. In C and C++, those names have prototype scope, go away after the prototype is parsed and processed, and are irrelevant to code generation--but a discrepancy between the name of the formal in the prototype and the corresponding name in the function definition can mislead a programmer seeing only the prototype and cause him or her to pass the wrong value. It would therefore be worthwhile for a lint program to remember the prototype formal…

                    9 votes
                    Vote
                    Sign in
                    Check!
                    (thinking…)
                    Reset
                    or sign in with
                    • facebook
                    • google
                      Password icon
                      I agree to the terms of service
                      Signed in as (Sign out)
                      You have left! (?) (thinking…)
                    • Missing data overrun detection

                      We had a construction like;
                      len = strlen(value);
                      p = malloc(len)
                      strcpy(p, value)

                      since we allocate 1 byte too little the strcpy will always cause a buffer overrun. But lint 9.00k did not detect it. Since this was only called with data read from files, it was detected when I added a call where value was a string literal

                      It seems like lint is good in arithmetic and less good in algebra
                      When it have a string literal of a known length it correct calculates the overrun, but if value is of unknown length it can't deduct that the overrun…

                      8 votes
                      Vote
                      Sign in
                      Check!
                      (thinking…)
                      Reset
                      or sign in with
                      • facebook
                      • google
                        Password icon
                        I agree to the terms of service
                        Signed in as (Sign out)
                        You have left! (?) (thinking…)
                      • Add an option to identify undefined behavior

                        The C99 standard (Appendix J) identifies almost 200 forms of undefined behavior (UB). For many, many reasons, UB is basically the most egregious form of coding error. It is totally preventable, and the effects can be most devastating.

                        Even though not all kinds of UB can be detected by a static analysis tool, many are, and other tools do this pretty well.

                        Piggy-backing onto this -- would also be nice to identify implementation-defined behaviors (e.g. bit position of bit-fields) and unspecified behaviors.

                        As these are all part of the standard, it doesn't seem too hard to do intellectually, it's just…

                        8 votes
                        Vote
                        Sign in
                        Check!
                        (thinking…)
                        Reset
                        or sign in with
                        • facebook
                        • google
                          Password icon
                          I agree to the terms of service
                          Signed in as (Sign out)
                          You have left! (?) (thinking…)
                        • Stop reporting 948 for expressions in C++11 static_assert()'s

                          Since C++11, static_assert can be used to express conditions which have to be met at compile time and PC-lint claims to support this since version 9.00k.

                          But even with 9.00L with co-msc110, env-vc10 and au-misra-cpp, the following code will trigger a 948:

                          static const size_t SOME_SIZE = 42U;
                          static_assert( SOME_SIZE < 100U, "..." ); // Triggers Note 948: Operator '<' always evaluates to True

                          This should not be reported, as this is exactly the point of static_assert to always evaluate to true!

                          8 votes
                          Vote
                          Sign in
                          Check!
                          (thinking…)
                          Reset
                          or sign in with
                          • facebook
                          • google
                            Password icon
                            I agree to the terms of service
                            Signed in as (Sign out)
                            You have left! (?) (thinking…)
                          • Don't lock files during linting (windows, parallel builds)

                            Lint open files on windows with file locking. This is the default method on windows. I suppose that lint uses fopen instead of OpenFile.
                            This breaks the possibility to use parallel builds for speed up reasons on code that share some code base.
                            Suggestion: Use OpenFile with OF_SHARE_DENY_NONE to allow other lint instances and other programms to access that file. If you are worried about file deletion, use at least OF_SHARE_DENY_WRITE.

                            7 votes
                            Vote
                            Sign in
                            Check!
                            (thinking…)
                            Reset
                            or sign in with
                            • facebook
                            • google
                              Password icon
                              I agree to the terms of service
                              Signed in as (Sign out)
                              You have left! (?) (thinking…)
                            • Consider adding reporting capabilities to PC-LINT Plus

                              Most competing tools can generate MISRA compliance reports at the push of a button.
                              With PC-LINT 9.0L it is a rather tedious procedure, e.g. running with ++efreeze, parsing text output and generating a result.
                              Not up to date in 2017.

                              6 votes
                              Vote
                              Sign in
                              Check!
                              (thinking…)
                              Reset
                              or sign in with
                              • facebook
                              • google
                                Password icon
                                I agree to the terms of service
                                Signed in as (Sign out)
                                You have left! (?) (thinking…)
                              • Correct a possible oversight in the Warning 529 and/or 438 behavior

                                If a character array is set to a value (using a function), which is never subsequently used or returned the WARNING 529 or WARNING 438 should be generated.

                                Given the following file, main.c
                                1 #include <string.h>
                                2
                                3 int main ( void )
                                4 {
                                5 int un1 = 0;
                                6 char un2[10] = {0};
                                7 char un3[10] = {0};
                                8
                                9
                                10 strcpy(un2,"Hello");
                                11
                                12 return 0;
                                13 }

                                flexelint does not see the variable as unused below. Notice that Line 5 and Line 7 generate the 529, but line 6 is ignored. A 438 might work as well.

                                5 votes
                                Vote
                                Sign in
                                Check!
                                (thinking…)
                                Reset
                                or sign in with
                                • facebook
                                • google
                                  Password icon
                                  I agree to the terms of service
                                  Signed in as (Sign out)
                                  You have left! (?) (thinking…)
                                • Be able to suppress for derived classes

                                  Sometimes it would be nice to suppress a message for all derived classes.

                                  For example:

                                  class X
                                  {
                                  virtual void f() = 0;
                                  };

                                  class Y : public X
                                  {
                                  void f() {}
                                  };

                                  class Z : public X
                                  {
                                  int i;
                                  void f(){++i;}
                                  };

                                  I would like to be able to put the following comment with the declaration of X:
                                  //lint -esym(1961,[X]::f) //1961 - virtual member function 'Symbol' could be made const

                                  Where I use [X] as syntax to define X and all classes derived from it.
                                  So when a sub class dos not use the function f to…

                                  5 votes
                                  Vote
                                  Sign in
                                  Check!
                                  (thinking…)
                                  Reset
                                  or sign in with
                                  • facebook
                                  • google
                                    Password icon
                                    I agree to the terms of service
                                    Signed in as (Sign out)
                                    You have left! (?) (thinking…)
                                  • Preprocessor output for a specific code section

                                    The "-p run just the Preprocessor" option is very handy, but for me it often generates too much information to pour though when I'm trying to diagnose a specific macro issue.

                                    It would be great if the preprocessor output could be enabled for a section of code, and send the output to a file and/or standard out.

                                    e.g.:
                                    //lint -p+
                                    SOME_COMPLEX_MACRO(a,b,c,d,e);
                                    //lint -p-

                                    4 votes
                                    Vote
                                    Sign in
                                    Check!
                                    (thinking…)
                                    Reset
                                    or sign in with
                                    • facebook
                                    • google
                                      Password icon
                                      I agree to the terms of service
                                      Signed in as (Sign out)
                                      You have left! (?) (thinking…)
                                      1 comment  ·  Admin →
                                    • Use a fixed release cycle

                                      Customers could plan better, if they knew you have 2 or 4 releases per year.
                                      Right now it´s totally unpredictable.

                                      4 votes
                                      Vote
                                      Sign in
                                      Check!
                                      (thinking…)
                                      Reset
                                      or sign in with
                                      • facebook
                                      • google
                                        Password icon
                                        I agree to the terms of service
                                        Signed in as (Sign out)
                                        You have left! (?) (thinking…)
                                        planned  ·  0 comments  ·  Admin →
                                      • Ability to change message categories

                                        Support an option that allows the user to change the message category of a message from, for example, Warning to Error.

                                        4 votes
                                        Vote
                                        Sign in
                                        Check!
                                        (thinking…)
                                        Reset
                                        or sign in with
                                        • facebook
                                        • google
                                          Password icon
                                          I agree to the terms of service
                                          Signed in as (Sign out)
                                          You have left! (?) (thinking…)
                                        • Display all options currently in effect (What Options am I using here)

                                          Although "-vo" and "lint usual arguments ?" are useful, they produce a lot of information, including information that sometimes could be considered 'what was noise' such as temporary error suppressions "-save, -e123, -restore"

                                          It would be great if you could add a feature where I could display all options, suppressions, flags, etc. in effect at a specific point in a source file that have been:
                                          a) changed from the defaults, or
                                          b) changed since the last "-save"
                                          c) changed in this file

                                          for example:
                                          //lint -save
                                          //lint -e123
                                          //lint -esym(456, FooBar)
                                          ...
                                          /*lint -save -e789 */ MACRO /*lint -restore */ …

                                          4 votes
                                          Vote
                                          Sign in
                                          Check!
                                          (thinking…)
                                          Reset
                                          or sign in with
                                          • facebook
                                          • google
                                            Password icon
                                            I agree to the terms of service
                                            Signed in as (Sign out)
                                            You have left! (?) (thinking…)
                                          ← Previous 1
                                          • Don't see your idea?

                                          General

                                          Feedback and Knowledge Base