Skip to content

test: cast values in proper type to suppress warnings - #9823

Merged
poettering merged 1 commit into
systemd:masterfrom
yuwata:follow-up-9789
Aug 7, 2018
Merged

poettering merged 1 commit into
systemd:masterfrom
yuwata:follow-up-9789

Conversation

@yuwata

@yuwata yuwata commented Aug 7, 2018

Copy link
Copy Markdown
Member

Follow-up for #9789.

@yuwata yuwata added the tests label Aug 7, 2018
@yuwata yuwata mentioned this pull request Aug 7, 2018
Comment thread src/test/test-util.c
assert_se(CMP(UINT64_MAX, 0L) == 1);
assert_se(CMP(0L, UINT64_MAX) == -1);
assert_se(CMP(UINT64_MAX, (uint64_t) 0) == 1);
assert_se(CMP((uint64_t) 0, UINT64_MAX) == -1);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0U sounds shorter and nicer?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be. But I am not sure...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think 0UL would be correct (unsigned long, right?) though the unsignedness is the important part... Actually I think that's what I had in mind at first... Not sure why I didn't have the warnings myself, need to double check that. The cast is totally fine too, it's what I've done in cases tha broke for me. Thanks for fixing @yuwata and thanks for catching and reporting @evverx !

@poettering
poettering merged commit ef6e83f into systemd:master Aug 7, 2018
@yuwata
yuwata deleted the follow-up-9789 branch August 7, 2018 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants