[llvm] [NFC][llvm][support] rename INFINITY in regcomp (PR #101758)
David Tenty via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 2 15:25:28 PDT 2024
https://github.com/daltenty updated https://github.com/llvm/llvm-project/pull/101758
>From 0f5f0bacd3ec4942af000f75b02c49fc8d0a19ce Mon Sep 17 00:00:00 2001
From: David Tenty <daltenty at ibm.com>
Date: Fri, 2 Aug 2024 17:51:41 -0400
Subject: [PATCH 1/2] [NFC][llvm][support] rename INFINITY in regcomp
since C23 this macro is defined by float.h, which clang implements in it's float.h since #96659 landed.
However, regcomp.c in LLVMSupport happened to define it's own macro with that name, leading to problems when bootstrapping. This change renames the offending macro.
---
llvm/lib/Support/regcomp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/Support/regcomp.c b/llvm/lib/Support/regcomp.c
index 990aef32a396f..daa41eb4912ef 100644
--- a/llvm/lib/Support/regcomp.c
+++ b/llvm/lib/Support/regcomp.c
@@ -278,7 +278,7 @@ static char nuls[10]; /* place to point scanner in event of error */
#else
#define DUPMAX 255
#endif
-#define INFINITY (DUPMAX + 1)
+#define REGINFINITY (DUPMAX + 1)
#ifndef NDEBUG
static int never = 0; /* for use in asserts; shuts lint up */
@@ -582,7 +582,7 @@ p_ere_exp(struct parse *p)
count2 = p_count(p);
REQUIRE(count <= count2, REG_BADBR);
} else /* single number with comma */
- count2 = INFINITY;
+ count2 = REGINFINITY;
} else /* just a single number */
count2 = count;
repeat(p, pos, count, count2);
@@ -753,7 +753,7 @@ p_simp_re(struct parse *p,
count2 = p_count(p);
REQUIRE(count <= count2, REG_BADBR);
} else /* single number with comma */
- count2 = INFINITY;
+ count2 = REGINFINITY;
} else /* just a single number */
count2 = count;
repeat(p, pos, count, count2);
@@ -1115,7 +1115,7 @@ repeat(struct parse *p,
# define N 2
# define INF 3
# define REP(f, t) ((f)*8 + (t))
-# define MAP(n) (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N)
+# define MAP(n) (((n) <= 1) ? (n) : ((n) == REGINFINITY) ? INF : N)
sopno copy;
if (p->error != 0) /* head off possible runaway recursion */
>From 4c53951a5048eaebf764b39549d22da6e1f4082a Mon Sep 17 00:00:00 2001
From: David Tenty <daltenty at ibm.com>
Date: Fri, 2 Aug 2024 18:25:14 -0400
Subject: [PATCH 2/2] clang-format changes
---
llvm/lib/Support/regcomp.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/llvm/lib/Support/regcomp.c b/llvm/lib/Support/regcomp.c
index daa41eb4912ef..9a30425c4763a 100644
--- a/llvm/lib/Support/regcomp.c
+++ b/llvm/lib/Support/regcomp.c
@@ -582,8 +582,8 @@ p_ere_exp(struct parse *p)
count2 = p_count(p);
REQUIRE(count <= count2, REG_BADBR);
} else /* single number with comma */
- count2 = REGINFINITY;
- } else /* just a single number */
+ count2 = REGINFINITY;
+ } else /* just a single number */
count2 = count;
repeat(p, pos, count, count2);
if (!EAT('}')) { /* error heuristics */
@@ -753,8 +753,8 @@ p_simp_re(struct parse *p,
count2 = p_count(p);
REQUIRE(count <= count2, REG_BADBR);
} else /* single number with comma */
- count2 = REGINFINITY;
- } else /* just a single number */
+ count2 = REGINFINITY;
+ } else /* just a single number */
count2 = count;
repeat(p, pos, count, count2);
if (!EATTWO('\\', '}')) { /* error heuristics */
@@ -1115,8 +1115,8 @@ repeat(struct parse *p,
# define N 2
# define INF 3
# define REP(f, t) ((f)*8 + (t))
-# define MAP(n) (((n) <= 1) ? (n) : ((n) == REGINFINITY) ? INF : N)
- sopno copy;
+#define MAP(n) (((n) <= 1) ? (n) : ((n) == REGINFINITY) ? INF : N)
+ sopno copy;
if (p->error != 0) /* head off possible runaway recursion */
return;
More information about the llvm-commits
mailing list