Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-6650

LINT_INIT emits code in non-debug builds

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.5.39, 10.0.13, 10.1.1
    • Fix Version/s: 10.1.4
    • Component/s: OTHER
    • Labels:
      None

      Description

      Leaving variables uninitialized in certain cases helps to achieve top-notch performance. Sometimes compiler thinks that variable may be used uninitialized (whereas it may not) and emits a warning.

      To silence these warnings there is LINT_INIT() macro:

      #if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
          (defined(__GNUC__) && defined(__cplusplus))
      #define LINT_INIT(var) var= 0
      #else
      #define LINT_INIT(var)
      #endif
      

      It always emits "x= 0" for C++ code compiled with gcc. In fact this is a workaround for gcc bug, which was fixed 3 years ago.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              svoj Sergey Vojtovich added a comment -

              Sergei Golubchik, please review fix for this bug.

              Show
              svoj Sergey Vojtovich added a comment - Sergei Golubchik , please review fix for this bug.

                People

                • Assignee:
                  svoj Sergey Vojtovich
                  Reporter:
                  svoj Sergey Vojtovich
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 10 minutes
                    10m