git: 47ceb65f3c21 - main - Fix capsicum-test build with GCC
Alex Richardson
arichardson at FreeBSD.org
Wed Mar 3 13:54:05 UTC 2021
The branch main has been updated by arichardson:
URL: https://cgit.FreeBSD.org/src/commit/?id=47ceb65f3c213904642f4859a53a3139e9cb287d
commit 47ceb65f3c213904642f4859a53a3139e9cb287d
Author: Alex Richardson <arichardson at FreeBSD.org>
AuthorDate: 2021-03-03 13:53:30 +0000
Commit: Alex Richardson <arichardson at FreeBSD.org>
CommitDate: 2021-03-03 13:53:45 +0000
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
---
contrib/capsicum-test/capsicum-test.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/capsicum-test/capsicum-test.cc b/contrib/capsicum-test/capsicum-test.cc
index dedad464a4d9..ba7936c788fc 100644
--- a/contrib/capsicum-test/capsicum-test.cc
+++ b/contrib/capsicum-test/capsicum-test.cc
@@ -72,7 +72,7 @@ char ProcessState(int pid) {
}
unsigned int count = 0;
struct procstat *prstat = procstat_open_sysctl();
- EXPECT_NE(NULL, prstat) << "procstat_open_sysctl failed.";
+ EXPECT_NE(nullptr, prstat) << "procstat_open_sysctl failed.";
errno = 0;
struct kinfo_proc *p = procstat_getprocs(prstat, KERN_PROC_PID, pid, &count);
if (p == NULL || count == 0) {
More information about the dev-commits-src-all
mailing list