about summary refs log tree commit diff
path: root/third_party/nix/src/libmain/stack.cc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-20T03·33+0100
committerVincent Ambo <tazjin@google.com>2020-05-20T03·33+0100
commitd331d3a0b5c497a46e2636f308234be66566c04c (patch)
tree92526b2f99456c09c5cc81233ed5a4311abe3d2b /third_party/nix/src/libmain/stack.cc
parentfed31b2c9b364fc1ed0b724c21b068cdedf46ee7 (diff)
refactor(3p/nix): Apply clang-tidy's modernize-* fixes r/787
This applies the modernization fixes listed here:

https://clang.llvm.org/extra/clang-tidy/checks/list.html

The 'modernize-use-trailing-return-type' fix was excluded due to my
personal preference (more specifically, I think the 'auto' keyword is
misleading in that position).
Diffstat (limited to 'third_party/nix/src/libmain/stack.cc')
-rw-r--r--third_party/nix/src/libmain/stack.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/third_party/nix/src/libmain/stack.cc b/third_party/nix/src/libmain/stack.cc
index 27c16f5d1f..87018b975c 100644
--- a/third_party/nix/src/libmain/stack.cc
+++ b/third_party/nix/src/libmain/stack.cc
@@ -1,8 +1,8 @@
+#include <csignal>
 #include <cstddef>
 #include <cstdlib>
 #include <cstring>
 
-#include <signal.h>
 #include <unistd.h>
 
 #include "types.hh"
@@ -14,7 +14,7 @@ static void sigsegvHandler(int signo, siginfo_t* info, void* ctx) {
      the stack pointer.  Unfortunately, getting the stack pointer is
      not portable. */
   bool haveSP = true;
-  char* sp = 0;
+  char* sp = nullptr;
 #if defined(__x86_64__) && defined(REG_RSP)
   sp = (char*)((ucontext_t*)ctx)->uc_mcontext.gregs[REG_RSP];
 #elif defined(REG_ESP)
@@ -40,7 +40,7 @@ static void sigsegvHandler(int signo, siginfo_t* info, void* ctx) {
   sigfillset(&act.sa_mask);
   act.sa_handler = SIG_DFL;
   act.sa_flags = 0;
-  if (sigaction(SIGSEGV, &act, 0)) {
+  if (sigaction(SIGSEGV, &act, nullptr)) {
     abort();
   }
 }
@@ -58,7 +58,7 @@ void detectStackOverflow() {
     throw Error("cannot allocate alternative stack");
   }
   stack.ss_flags = 0;
-  if (sigaltstack(&stack, 0) == -1) {
+  if (sigaltstack(&stack, nullptr) == -1) {
     throw SysError("cannot set alternative stack");
   }
 
@@ -66,7 +66,7 @@ void detectStackOverflow() {
   sigfillset(&act.sa_mask);
   act.sa_sigaction = sigsegvHandler;
   act.sa_flags = SA_SIGINFO | SA_ONSTACK;
-  if (sigaction(SIGSEGV, &act, 0)) {
+  if (sigaction(SIGSEGV, &act, nullptr)) {
     throw SysError("resetting SIGSEGV");
   }
 #endif