Fix #includes

- Where std::nullptr_t is used (in namespace std), #include <cstddef>,
   even if it appears alongside <stddef.h> because types like intptr_t
   are used (in the root namespace).
 - Where math library functions are used, #include <cmath> to get and
   use the versions of functions in namespace std which are overloaded
   by argument type, such as std::isinf and std::isnan.

third_party is excluded.

Change-Id: Ic9c143f407e5a9c5cff4098cf566ba5caf4bf6d8
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/6021439
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Mark Mentovai 2024-11-14 11:06:22 -05:00 committed by Crashpad LUCI CQ
parent 65a45013d0
commit 3b0a429371
3 changed files with 5 additions and 4 deletions

View File

@ -16,11 +16,11 @@
#define CRASHPAD_SNAPSHOT_LINUX_SNAPSHOT_SIGNAL_CONTEXT_H_ #define CRASHPAD_SNAPSHOT_LINUX_SNAPSHOT_SIGNAL_CONTEXT_H_
#include <signal.h> #include <signal.h>
#include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/ucontext.h> #include <sys/ucontext.h>
#include <cstddef>
#include <type_traits> #include <type_traits>
#include "build/build_config.h" #include "build/build_config.h"

View File

@ -15,6 +15,7 @@
#ifndef CRASHPAD_UTIL_MISC_FROM_POINTER_CAST_H_ #ifndef CRASHPAD_UTIL_MISC_FROM_POINTER_CAST_H_
#define CRASHPAD_UTIL_MISC_FROM_POINTER_CAST_H_ #define CRASHPAD_UTIL_MISC_FROM_POINTER_CAST_H_
#include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <cstddef> #include <cstddef>

View File

@ -15,10 +15,10 @@
#include "util/synchronization/semaphore.h" #include "util/synchronization/semaphore.h"
#include <errno.h> #include <errno.h>
#include <math.h>
#include <time.h> #include <time.h>
#include <chrono> #include <chrono>
#include <cmath>
#include "base/check_op.h" #include "base/check_op.h"
#include "base/logging.h" #include "base/logging.h"
@ -43,7 +43,7 @@ void Semaphore::Wait() {
bool Semaphore::TimedWait(double seconds) { bool Semaphore::TimedWait(double seconds) {
DCHECK_GE(seconds, 0.0); DCHECK_GE(seconds, 0.0);
if (isinf(seconds)) { if (std::isinf(seconds)) {
Wait(); Wait();
return true; return true;
} }
@ -81,7 +81,7 @@ void Semaphore::Wait() {
bool Semaphore::TimedWait(double seconds) { bool Semaphore::TimedWait(double seconds) {
DCHECK_GE(seconds, 0.0); DCHECK_GE(seconds, 0.0);
if (isinf(seconds)) { if (std::isinf(seconds)) {
Wait(); Wait();
return true; return true;
} }