]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix capsicum-test build with GCC
authorAlex Richardson <arichardson@FreeBSD.org>
Wed, 3 Mar 2021 13:53:30 +0000 (13:53 +0000)
committerAlex Richardson <arichardson@FreeBSD.org>
Wed, 17 Mar 2021 22:22:49 +0000 (22:22 +0000)
commit4159566e56a8521143c22b611e28157e958d1299
tree5d042f1ca68862c2411f59dbce3eebefa09d1cf2
parentcad3bfa094e6135b939a948f45c4dee2df9d64f3
Fix capsicum-test build with GCC

Apparently GCC defines NULL to 0 in C++11 mode (instead of nullptr), so
this causes the following error:
```
In file included from capsicum-test.h:15,
                 from capsicum-test.cc:1:
gtest-1.10.0/include/gtest/gtest.h: In instantiation of 'testing::AssertionResult testing::internal::CmpHelperNE(const char*, const char*, const T1&, const T2&) [with T1 = long int; T2 = procstat*]':
capsicum-test.cc:75:3:   required from here
gtest-1.10.0/include/gtest/gtest.h:1621:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
 1609 |   if (val1 op val2) {\
      |       ~~~~~~~~~~~~
......
 1621 | GTEST_IMPL_CMP_HELPER_(NE, !=);
gtest-1.10.0/include/gtest/gtest.h:1609:12: note: in definition of macro 'GTEST_IMPL_CMP_HELPER_'
 1609 |   if (val1 op val2) {\
      |            ^~
```

Fix this by using nullptr directly.

Submitted upstream as https://github.com/google/capsicum-test/pull/56

Reported by: Jenkins CI

(cherry picked from commit 47ceb65f3c213904642f4859a53a3139e9cb287d)
contrib/capsicum-test/capsicum-test.cc