KWStyle icon indicating copy to clipboard operation
KWStyle copied to clipboard

Forward declaration of function masks errors in class

Open msmolens opened this issue 8 years ago • 4 comments

With KWStyle.xml:

<?xml version="1.0" encoding="iso-8859-1"?>
<Description>
<InternalVariables>m_[A-Z],0,1</InternalVariables>
</Description>

and Test.h:

#ifndef Test_h
#define Test_h

// Forward declaration
bool runTest();

class Test
{
public:
    Test() {}

protected:
    bool result;
};

#endif

KWStyle fails to show the error in the name of the member variable.

Without the forward declaration the error is detected correctly:

$ KWStyle -xml KWStyle.xml -v Test.h -gcc
Test.h:0: error: Internal variable (result) doesn't match regular expression (m_[A-Z])

The forward declaration shouldn't mask errors in the class below.

Tested with https://github.com/Kitware/KWStyle/commit/e03980ff514d5248a9f95ea355dcd9eff78c62d3.

msmolens avatar May 18 '17 14:05 msmolens

dude the variable naming inside the class should be as member variable i.e. m_bool .. something like that .. m_ as prefix for variables.

wasim6691 avatar Feb 21 '20 13:02 wasim6691

Good catch! Forward declaration of classes hide errors in those classes.

S


Sent via phone.

On Thu, May 18, 2017, 10:42 AM Max Smolens [email protected] wrote:

With KWStyle.xml:

m_[A-Z],0,1

and Test.h:

#ifndef Test_h #define Test_h

// Forward declaration bool runTest();

class Test { public: Test() {}

protected: bool result; };

#endif

KWStyle fails to show the error in the name of the member variable.

Without the forward declaration the error is detected correctly:

$ KWStyle -xml KWStyle.xml -v Test.h -gcc Test.h:0: error: Internal variable (result) doesn't match regular expression (m_[A-Z])

The forward declaration shouldn't mask errors in the class below.

Tested with e03980f https://github.com/Kitware/KWStyle/commit/e03980ff514d5248a9f95ea355dcd9eff78c62d3 .

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Kitware/KWStyle/issues/68, or mute the thread https://github.com/notifications/unsubscribe-auth/AAREr5ZYXmYASibBXjFjvhxof7CG7BJ0ks5r7FjygaJpZM4NfVr0 .

aylward avatar Feb 21 '20 13:02 aylward

please close the issue if possible. many thnaks

wasim6691 avatar Feb 24 '20 07:02 wasim6691

Has this bug been fixed? If so, what is the pull request # and merge?

s

On Mon, Feb 24, 2020 at 2:47 AM Muhammad Wasim Akhtar Khan < [email protected]> wrote:

please close the issue if possible. many thnaks

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Kitware/KWStyle/issues/68?email_source=notifications&email_token=AACEJL43T4N746RZQ6B4HF3REN3STA5CNFSM4DL5LL2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMW33EA#issuecomment-590200208, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACEJL4GXWD3R3TG3OMQK33REN3STANCNFSM4DL5LL2A .

-- Stephen R. Aylward, Ph.D. Senior Director of Strategic Initiatives

Kitware: Advancing the frontiers of understanding by developing innovative open-source software platforms and integrating them into research, processes, and products.

aylward avatar Feb 24 '20 12:02 aylward