This is an archive of the discontinued LLVM Phabricator instance.

[Sema] expose a control flag for integer to pointer ext warning
ClosedPublic

Authored by Kader on Jan 2 2019, 8:14 PM.

Diff Detail

Event Timeline

Kader created this revision.Jan 2 2019, 8:14 PM
Kader edited the summary of this revision. (Show Details)Jan 2 2019, 8:19 PM
Kader added reviewers: david2050, twoh, trentxintong.

Looks ok in general.
Perhaps there should be a test for this flag specifically?
Also, should "pointer-integer-compare" be in some group?

Kader updated this revision to Diff 180124.Jan 3 2019, 12:29 PM

Added test case for C_lang

Kader added a comment.Jan 3 2019, 12:35 PM

@lebedev.ri Thanks for the quick review ;

Perhaps there should be a test for this flag specifically?

I am not really familiar with this part of the code base, but it seems that the warnings is already tested in both test/Sema/Compare.c and test/SemaCXX/compare.cpp. I have none the less added a new test file for c_lang.

Also, should "pointer-integer-compare" be in some group?

I modeled my change on ext_typecheck_ordered_comparison_of_function_pointers which doesn't belong to any group. Not sure if that's the right thing to do though.

Also, this flag is only valid for C_lang and not for Cpp_lang. But right now the flag will be silently ignore when compiling cpp files. Is that an acceptable behavior ?

Kader updated this revision to Diff 180125.Jan 3 2019, 12:37 PM

added missing test file

lebedev.ri added inline comments.Jan 3 2019, 12:59 PM
test/Sema/ext-typecheck-comparison-of-pointer-integer.c
1

I guess you want a run-line with no flag, this runline, and a run-line with -Wno-pointer-integer-compare

Kader updated this revision to Diff 180142.Jan 3 2019, 2:33 PM

address comments

Kader updated this revision to Diff 180143.Jan 3 2019, 2:35 PM

remove typo

Kader marked 2 inline comments as done.Jan 3 2019, 8:09 PM
Kader added inline comments.
test/Sema/ext-typecheck-comparison-of-pointer-integer.c
1

done

lebedev.ri accepted this revision.Jan 3 2019, 10:04 PM

ok, LGTM.

test/Sema/ext-typecheck-comparison-of-pointer-integer.c
1

In the future, do use that checkbox on the inline comments to mark them as done.

This revision is now accepted and ready to land.Jan 3 2019, 10:04 PM
Kader marked an inline comment as done.Jan 4 2019, 3:47 AM

@lebedev.ri Thanks.
I think do not have commit access. What should be my next step ?

Kader added a comment.Jan 14 2019, 9:19 AM

friendly ping

Going to test and land it as requested by @lebedev.ri on IRC.

lebedev.ri retitled this revision from expose a control flag for interger to pointer ext warning to [Sema] expose a control flag for integer to pointer ext warning.Jan 14 2019, 9:28 AM
This revision was automatically updated to reflect the committed changes.