[libc-commits] [libc] [libc] Add the missing math_extras.h include (PR #74259)

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Sun Dec 3 14:46:09 PST 2023


https://github.com/petrhosek created https://github.com/llvm/llvm-project/pull/74259

math_extras.h is used in integer_utils.h when building for 32-bit platforms but the include is missing.

>From 13653cb77a6ff40b9ea6147d6de277eae6379ee8 Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek at google.com>
Date: Sun, 3 Dec 2023 22:43:51 +0000
Subject: [PATCH] [libc] Add the missing math_extras.h include

math_extras.h is used in integer_utils.h when building for 32-bit
platforms but the include is missing.
---
 libc/src/__support/CMakeLists.txt  | 1 +
 libc/src/__support/integer_utils.h | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/libc/src/__support/CMakeLists.txt b/libc/src/__support/CMakeLists.txt
index ba80965b5aaaf..d6dbad661cb73 100644
--- a/libc/src/__support/CMakeLists.txt
+++ b/libc/src/__support/CMakeLists.txt
@@ -189,6 +189,7 @@ add_header_library(
     integer_utils.h
   DEPENDS
     .bit
+    .math_extras
     .number_pair
     libc.src.__support.common
     libc.src.__support.CPP.type_traits
diff --git a/libc/src/__support/integer_utils.h b/libc/src/__support/integer_utils.h
index 433e99227bcfd..619e13f51c411 100644
--- a/libc/src/__support/integer_utils.h
+++ b/libc/src/__support/integer_utils.h
@@ -15,6 +15,10 @@
 #include "bit.h"
 #include "number_pair.h"
 
+#ifndef __SIZEOF_INT128__
+#include "math_extras.h"
+#endif
+
 #include <stdint.h>
 
 namespace LIBC_NAMESPACE {



More information about the libc-commits mailing list