Skip to content

#4775: more extensive assert statement checks (warn for side effects) - #140

Closed
laena wants to merge 1 commit into
cppcheck-opensource:masterfrom
laena:master
Closed

laena wants to merge 1 commit into
cppcheck-opensource:masterfrom
laena:master

Conversation

@laena

@laena laena commented May 3, 2013

Copy link
Copy Markdown

No description provided.

@laena

laena commented May 3, 2013

Copy link
Copy Markdown
Author

Hmz. I don't get why the build is marked as failed, exit status is 1 with everything compiling and no test failures.

@danmar

danmar commented May 4, 2013

Copy link
Copy Markdown
Collaborator

If you wonder why https://travis-ci.org/danmar/cppcheck/builds/6854731 fails.. I am not sure. Both the GCC and CLANG report says there is a segmentation fault. Can you try running this command on your computer and see what happens:
cppcheck --error-exitcode=1 -Ilib --enable=style --suppress=duplicateBranch -q cli gui lib -igui/test

Travis is not 100% reliable. It is possible that if you restart the checking it will pass.

@laena

laena commented May 4, 2013

Copy link
Copy Markdown
Author

my fault after all... I couldn't read that there was a segfault from the output though.

@danmar

danmar commented May 5, 2013

Copy link
Copy Markdown
Collaborator

When you start to feel ready with all changes.. I want that all those commits are squashed into a single commit.

I am not sure how you do it but it is possible to do it.

@laena

laena commented May 5, 2013

Copy link
Copy Markdown
Author

should be done...

@danmar

danmar commented May 5, 2013

Copy link
Copy Markdown
Collaborator

I can't apply the patch directly. You ran dmake and so did I. Sorry for the trouble. You need to merge the changes.

The patch wasn't formatted. did you run astyle again?

I get this:

Assertion failed in test/testassert.cpp at line 70
Expected:

Actual:
[test.cpp:7]: (warning) Assert statement calls a function which may have desired side effects: 'foo'.\n

Don't you get this?

@danmar

danmar commented May 5, 2013

Copy link
Copy Markdown
Collaborator

I would prefer if this:

const Token *endTok = tok ? tok->next()->link() : NULL;

Is moved to the start of the while loop.

It really shouldn't be NULL. But feel free to add a assert(endTok != NULL); after the assignment

@danmar

danmar commented May 5, 2013

Copy link
Copy Markdown
Collaborator

it seems that travis didnt run the testassert tests. the makefile in the patch doesnt build testassert.

@laena

laena commented May 6, 2013

Copy link
Copy Markdown
Author

I figured the CI would run the tests for me, they're really slow on my machine. But then again, I apparently forgot to rerun dmake. Sorry.

@thomasjfox

Copy link
Copy Markdown
Collaborator

Regarding the merge to a single commit:

Use "git rebase -i origin/master" and then you can select which commits should be merge together.
(in fact this command can do a lot more, it's a swiss army knife...)

Better play this on a fresh checkout of your local branch. In case anything goes wrong, you can just throw the branch away and try again.

@laena

laena commented May 6, 2013

Copy link
Copy Markdown
Author

will be fixing this tomorrow- sorry for the delay.

@laena

laena commented May 7, 2013

Copy link
Copy Markdown
Author

it looks like the test was executed this time, and I re-ran both the formatting and dmake, but dmake didn't change t he Makefile further. Also, I was unsure how to refactor the while loop as you proposed.
Sorry about that too and good luck with this patch...

@danmar

danmar commented May 7, 2013

Copy link
Copy Markdown
Collaborator

Also, I was unsure how to refactor the while loop as you proposed.

Nevermind.

I am not sure what happened. The only commit I see here in this pull request is the 4 days old 5594b4a.

But this looks interesting:
16a2903

@danmar

danmar commented May 7, 2013

Copy link
Copy Markdown
Collaborator

I applied your changes with:
e23038c

Thanks!

@danmar danmar closed this May 7, 2013
@danmar

danmar commented May 7, 2013

Copy link
Copy Markdown
Collaborator

Feel free to close the ticket now.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants