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. 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…)
    • 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…)
      • 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…)

          In the upcoming PC-lint Plus, full or partial initializations that takes place in functions called by a constructor are automatically recognized without the need for an initializer semantic. In the example provided, no message would be issued. The initializer semantic can still be used if the definition of an initializing member function is not available but otherwise isn’t necessary.

        • C99 struct initialization

          Error is generated with the foolowing code, which is valide C99:
          typedef union
          {
          struct
          {
          unsigned int a : 4;
          unsigned int b : 4;
          unsigned int c : 4;
          unsigned int d : 4;
          } bits;
          unsigned short value;
          } My_Value;

          int main(void)
          {
          My_Value test[] =
          {
          {
          .bits.a = 2,
          .bits.b = 3,
          .bits.c = 2,
          .bits.d = 3,
          },
          {
          .bits.a = 1,
          .bits.b = 1,
          .bits.c = 1,
          .bits.d = 0,
          },
          };
          return 0;
          }

          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 →
          • Please add an _optional_ (not on by default) warning to find use of catch (...)

            I'd like you to consider adding a optional warning for the "catch all uncaught exceptions" clause, catch with a 3 dot ellipsis:

            catch (...)

            This can be a dangerous construct certainly on some of the Microsoft compilers with interactions with Structured Exception Handling, and is warned against by a number of key figures, including John Robbins.

            1 vote
            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…)
            • Error 305: Unable to open module 'Files'

              Minor irritation, unclear error message: Using separate directories for exe and lint files creates the following problem unless the path variable is also set to the exe location. Not clear exactly which files lint requires, so have to copy all over (don't want path modified).
              c:\"Program Files (x86)\pc-lint 9.0"\lint-nt -v
              PC-lint for C/C++ (NT) Vers. 9.00L, Copyright Gimpel Software 1985-2014
              Error 305: Unable to open module 'Files'

              1 vote
              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…)
              • Have restore at end reset the internal counter of -esym

                Right now, this works correctly only for -e#, but very often, programmers make mistakes using -esym as well.
                Would be nice to not have to debug those using -voif.
                Example:

                @module foo.cpp
                namespace test
                {
                extern bool bar(void);
                extern bool flag;

                bool foo(void)
                {
                //the next line is a programmer mistake which is carried on into bar.cpp despite using -restore_at_end
                //lint -esym(1960,5-14-1)
                return flag && bar();
                }
                }

                @module bar.cpp
                namespace test
                {
                extern bool foo(void);
                extern bool flag;

                bool bar(void)
                {
                // Violates 5-14-1 but is not reported due to error in previous module
                return flag && foo();
                } …

                1 vote
                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…)
                • Extend value tracking for member variables/functions

                  #include <string.h>
                  //lint -passes(2)
                  class X
                  {
                  int *p;
                  public:
                  X(){ p = NULL; }
                  bool IsValid()const{return p != NULL;}
                  void Foo()
                  {
                  if(IsValid())
                  *p = 0; // Warning 613: Possible use of null pointer (wrong)
                  }
                  void Bar()
                  {
                  if(p != NULL)
                  *p = 0; // no 613 here (ok)
                  }
                  };

                  // Value tracking works for global variables (ok)
                  int *pg = NULL;
                  bool IsValid(const int* px)
                  {
                  return px != NULL;
                  }
                  void Bar()
                  {
                  if(IsValid(pg))
                  *pg = 0;// no 613 here (ok)
                  }

                  1 vote
                  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…)
                  • Support for labels as values (GNU extension)

                    GNU C / Clang support an extension where the address of a label can be taken as a value and assigned to a variable, and then jumped to using goto.
                    https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html

                    For example, this small test program:

                    int main(void)
                    {
                    int r;
                    foo:
                    r = 4;

                    void *f = &&foo;

                    goto *f;

                    return 0;
                    }

                    causes the following errors from FlexeLint:

                    --- Module: main.c (C)
                    _
                    void *f = &&foo;
                    main.c 8 Error 24: Expected an expression, found '&&'
                    main.c 8 Error 40: Undeclared identifier 'foo'
                    _
                    goto *f;
                    main.c 11 Error 10: Expecting identifier

                    Is there some combination of…

                    3 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 reporting1746 within extern "C" code as its wrong!

                      In c++ code which is defining a C interface we get lots of 1746 errors. This is lint telling us to use const reference, how is that gonna work in C! These functions are in extern "C" scope so cannot use references. This seems like a bu/omission as of lint 9.0K.

                      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 →
                      • enhancement for error 1762 "Member function could be made const"

                        The message:
                        Pages.cpp(206): error 1762: (Info -- Member function 'xxx:yyy(void)' could be made const)

                        could be enhanced to make it easier to type in "const" in both the source and header files:
                        1. The line number reference should the first line the function and not the function's closing brace
                        2. add a "error 830: (Info -- Location cited in prior message)" line that references the function's declaration in the header file

                        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…)

                          The first part of this request (more useful location for the diagnostic) has been implemented for the upcoming PC-lint Plus. We are declining to implement the second part of the request (adding a supplemental message containing the location of the declaration) but may reconsider if the this is made into a separate suggestion.

                        • Make wildcards work in -sem statements

                          Would allow single -sem statement for group of similarly named methods. Example:

                          //lint -sem(CTest::Pre*Post, pure)

                          class CTest
                          {
                          public:
                          int PreOnePost() const;
                          int PreTwoPost() const;
                          int PreThreePost() const;
                          };

                          Would cover all 3 methods in CTest.

                          12 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…)
                          • Implement structure value tracking

                            Provide basic structure value tracking. Especially for null pointers. Consider the following:

                            xres->lif=NULL;
                            foo(xres->lif->stuff);

                            Should flag deference of xres->lif as "known null access"

                            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…)
                            • -efile2 for inhibition within a file

                              -efile only inhibits messages about a file. This causes requests in the forum/to support from time to time. Mostly the questioner will be explained that -efile works only for messages about the file. The answer is correct, but leaves the questioner unsatisfied, as he/she is looking for something like -efile2.

                              It should not be too difficult to implement it and would help many people.

                              23 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…)
                              • make use of multiple cores on modern CPU/OS

                                Similar to what GNU makes offers with it´s -j switch, large projects would benefit greatly, if LINT was able to scan multiple files simultaneously (e.g. four on a quad core CPU).

                                33 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…)
                                • Wrong suggestion on how to export environment variables on Linux

                                  This article explains how to create environment variables on Linux. It wrongly suggests:

                                  export INCLUDE=/usr/local/include;/usr/include

                                  but the correct way is as followed (replace ';' by ':' between paths):

                                  export INCLUDE=/usr/local/include:/usr/include

                                  Best regards

                                  Martin Ettl

                                  1 vote
                                  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…)
                                  • 9xxx messages for MISRA C++

                                    PC-lint 9.00k introduced support for MISRA C 2012 via a set of 9000-series messages which is a significant improvement over previous versions which lumped the messages together under a couple of messages. This is a request to extend the 9000 messages to cover MISRA C++.

                                    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…)
                                    • Prevent a user to suppress a specific message

                                      For example I wouldn't want anybody to turn off message '527 Unreachable'. I got some good help on your forum, please see this thread: http://www.gimpel.com/Discussion.cfm?ThreadID=4512. But I think it would be very good if you could add a more intuitive interface for doing this than what's suggested in the thread. Maybe something like this
                                      +e527
                                      +efreeze{527}

                                      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…)
                                        1 comment  ·  Admin →
                                      • Don't see your idea?

                                      General

                                      Feedback and Knowledge Base