svn commit: r345213 - projects/capsicum-test/contrib/capsicum-test
Enji Cooper
ngie at FreeBSD.org
Fri Mar 15 23:55:42 UTC 2019
Author: ngie
Date: Fri Mar 15 23:55:41 2019
New Revision: 345213
URL: https://svnweb.freebsd.org/changeset/base/345213
Log:
Fix -Wshadow issues with `EXPECT_OPEN_OK(..)` macro
* Wrap in do-while(0) block to avoid variable shadowing issue with multiple
calls in the same function.
* Prefix block local variables with `_` to try and avoid variable name clashes
with values local to test methods.
Modified:
projects/capsicum-test/contrib/capsicum-test/openat.cc
Modified: projects/capsicum-test/contrib/capsicum-test/openat.cc
==============================================================================
--- projects/capsicum-test/contrib/capsicum-test/openat.cc Fri Mar 15 23:52:37 2019 (r345212)
+++ projects/capsicum-test/contrib/capsicum-test/openat.cc Fri Mar 15 23:55:41 2019 (r345213)
@@ -11,9 +11,9 @@
// Check an open call works and close the resulting fd.
#define EXPECT_OPEN_OK(f) do { \
- int fd = f; \
- EXPECT_OK(fd); \
- close(fd); \
+ int _fd = f; \
+ EXPECT_OK(_fd); \
+ close(_fd); \
} while (0)
static void CreateFile(const char *filename, const char *contents) {
More information about the svn-src-projects
mailing list