While building openJDK11u, it seems that some of the code in the native core libraries make liberal use of integer to pointer comparisons. We currently have no flag to disabled this warning. This add such a flag.
Details
Diff Detail
- Repository
- rC Clang
- Build Status
Buildable 26345 Build 26344: arc lint + arc unit
Event Timeline
Looks ok in general.
Perhaps there should be a test for this flag specifically?
Also, should "pointer-integer-compare" be in some group?
@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 ?
test/Sema/ext-typecheck-comparison-of-pointer-integer.c | ||
---|---|---|
1 ↗ | (On Diff #180125) | I guess you want a run-line with no flag, this runline, and a run-line with -Wno-pointer-integer-compare |
test/Sema/ext-typecheck-comparison-of-pointer-integer.c | ||
---|---|---|
1 ↗ | (On Diff #180125) | done |
ok, LGTM.
test/Sema/ext-typecheck-comparison-of-pointer-integer.c | ||
---|---|---|
1 ↗ | (On Diff #180125) | In the future, do use that checkbox on the inline comments to mark them as done. |