Skip to content

constructor parameter parsing exception #232

Description

@sashao

cpplint fails to parse constructor like ResultException(_Pre_satisfies_(hr < 0) HRESULT hr)
error:

Traceback (most recent call last):
  File "/opt/homebrew/bin/cpplint", line 33, in <module>
    sys.exit(load_entry_point('cpplint==1.6.1', 'console_scripts', 'cpplint')())
  File "/opt/homebrew/Cellar/cpplint/1.6.1/libexec/lib/python3.10/site-packages/cpplint.py", line 6908, in main
    ProcessFile(filename, _cpplint_state.verbose_level)
  File "/opt/homebrew/Cellar/cpplint/1.6.1/libexec/lib/python3.10/site-packages/cpplint.py", line 6678, in ProcessFile
    ProcessFileData(filename, file_extension, lines, Error,
  File "/opt/homebrew/Cellar/cpplint/1.6.1/libexec/lib/python3.10/site-packages/cpplint.py", line 6506, in ProcessFileData
    ProcessLine(filename, file_extension, clean_lines, line,
  File "/opt/homebrew/Cellar/cpplint/1.6.1/libexec/lib/python3.10/site-packages/cpplint.py", line 6390, in ProcessLine
    CheckForNonStandardConstructs(filename, clean_lines, line,
  File "/opt/homebrew/Cellar/cpplint/1.6.1/libexec/lib/python3.10/site-packages/cpplint.py", line 3408, in CheckForNonStandardConstructs
    constructor_arg += ',' + constructor_args[i + 1]
IndexError: list index out of range
oomel@1111s-MacBook-Pro-4 plugins-framework % 
oomel@1111s-MacBook-Pro-4 plugins-framework % 
oomel@1111s-MacBook-Pro-4 plugins-framework % 
oomel@1111s-MacBook-Pro-4 plugins-framework % cpplint --versionCpplint fork (https://github.com/cpplint/cpplint)
cpplint 1.6.1
Python 3.10.13 (main, Aug 24 2023, 22:43:20) [Clang 14.0.0 (clang-1400.0.29.202)]

Sample file contents:

    class ResultException : public std::exception
    {
    public:
        //! Constructs a new ResultException from an existing FailureInfo.
        ResultException(const FailureInfo& failure) WI_NOEXCEPT :
            m_failure(failure)
        {
        }

        //! Constructs a new exception type from a given HRESULT (use only for constructing custom exception types).
        ResultException(_Pre_satisfies_(hr < 0) HRESULT hr) WI_NOEXCEPT :
            m_failure(CustomExceptionFailureInfo(hr))
        {
        }
    }:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions