[llvm] Fix NDEBUG Wundef warning; NFC (PR #159539)

Sven van Haastregt via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 18 02:49:49 PDT 2025


https://github.com/svenvh created https://github.com/llvm/llvm-project/pull/159539

The `NDEBUG` macro is tested for defined-ness everywhere else.  The instance here triggers a warning when compiling with `-Wundef`.

>From 1aec94f92c8f42e50dd4325ee42eede1e5ca60a0 Mon Sep 17 00:00:00 2001
From: Sven van Haastregt <sven.vanhaastregt at arm.com>
Date: Wed, 17 Sep 2025 10:58:12 +0100
Subject: [PATCH] Fix NDEBUG Wundef warning; NFC

The `NDEBUG` macro is tested for defined-ness everywhere else.  The
instance here triggers a warning when compiling with `-Wundef`.
---
 llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp b/llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp
index d741695d4e53c..0a358d45b92ca 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp
@@ -98,7 +98,7 @@ std::pair<uint32_t, uint32_t> getNumCountersAndCallsites(const Function &F) {
                "same total nr of callsites parameter");
         NumCallsites = V;
       }
-#if NDEBUG
+#ifdef NDEBUG
       if (NumCounters && NumCallsites)
         return std::make_pair(NumCounters, NumCallsites);
 #endif



More information about the llvm-commits mailing list