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

#4775: more extensive assert statement checks (warn for side effects)#140
laena wants to merge 1 commit into
cppcheck-opensource:masterfrom
laena:master

Conversation

@laena
Copy link
Copy Markdown

@laena laena commented May 3, 2013

No description provided.

@laena
Copy link
Copy Markdown
Author

laena commented May 3, 2013

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

@danmar
Copy link
Copy Markdown
Collaborator

danmar commented May 4, 2013

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
Copy link
Copy Markdown
Author

laena commented May 4, 2013

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

@danmar
Copy link
Copy Markdown
Collaborator

danmar commented May 5, 2013

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
Copy link
Copy Markdown
Author

laena commented May 5, 2013

should be done...

@danmar
Copy link
Copy Markdown
Collaborator

danmar commented May 5, 2013

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
Copy link
Copy Markdown
Collaborator

danmar commented May 5, 2013

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
Copy link
Copy Markdown
Collaborator

danmar commented May 5, 2013

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

@laena
Copy link
Copy Markdown
Author

laena commented May 6, 2013

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
Copy link
Copy Markdown
Author

laena commented May 6, 2013

will be fixing this tomorrow- sorry for the delay.

@laena
Copy link
Copy Markdown
Author

laena commented May 7, 2013

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
Copy link
Copy Markdown
Collaborator

danmar commented May 7, 2013

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
Copy link
Copy Markdown
Collaborator

danmar commented May 7, 2013

I applied your changes with:
e23038c

Thanks!

@danmar danmar closed this May 7, 2013
@danmar
Copy link
Copy Markdown
Collaborator

danmar commented May 7, 2013

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