[PATCH] D23423: [Clang-tidy] Comparison Function Address

Eugene Zelenko via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 11 13:56:42 PDT 2016


Eugene.Zelenko added a comment.

Please mention this check in docs/ReleaseNotes.rst (in alphabetical order).

If I'm not mistaken, GCC or Clang has warning that result of comparison is always true for such situations.


================
Comment at: clang-tidy/misc/ComparisonFunctionAddressCheck.h:19
@@ +18,3 @@
+
+/// This Checker gives a warning if address of a function is compared.
+/// For example: the programmer wants to write getc()==0 but writes getc==0.
----------------
Please lowercase Checker. Add add spaces across == below.

================
Comment at: docs/clang-tidy/checks/misc-comparison-function-address.rst:6
@@ +5,3 @@
+
+This Checker gives a warning if address of a function is compared.
+For example: the programmer wants to write ``getc()==0`` but writes ``getc==0``
----------------
Please lowercase Checker.

================
Comment at: docs/clang-tidy/checks/misc-comparison-function-address.rst:7
@@ +6,3 @@
+This Checker gives a warning if address of a function is compared.
+For example: the programmer wants to write ``getc()==0`` but writes ``getc==0``
+
----------------
Please add space across ==. Please also run Clang-format over examples code.

================
Comment at: docs/clang-tidy/checks/misc-comparison-function-address.rst:18
@@ +17,3 @@
+
+as a general rule, function pointers can be compared to other function pointers, function, 0, nullptr
+functions can be compared only against function pointers
----------------
Please highlight nullptr with ``.

================
Comment at: test/clang-tidy/misc-comparison-function-address.cpp:16
@@ +15,3 @@
+
+
+void test_function_warning() {
----------------
Unnecessary empty line.

================
Comment at: test/clang-tidy/misc-comparison-function-address.cpp:30
@@ +29,3 @@
+}
+
+
----------------
Unnecessary empty line.


Repository:
  rL LLVM

https://reviews.llvm.org/D23423





More information about the cfe-commits mailing list