Skip to content

Commit

Permalink
Rename INFINITY in regcomp
Browse files Browse the repository at this point in the history
Summary:
LLVM 19 started to introduce defining some of the [math macros](https://github.com/llvm/llvm-project/blob/eb2929d323c0c44f2037cf8a345ca6984ec228eb/clang/lib/Headers/float.h#L170-L179) in the compiler leading to warnings-turned-errors macro redefinitions.

 ---
> 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.

Original commit: llvm/llvm-project@899f648

Reviewed By: smeenai

Differential Revision: D62278490

fbshipit-source-id: 2ec4f025876a0294bb749b4224baf52de9c28158
  • Loading branch information
thevinster authored and facebook-github-bot committed Sep 6, 2024
1 parent 5b13f2a commit b9b6eb9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions external/llvh/lib/Support/regcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,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 */
Expand Down Expand Up @@ -591,7 +591,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);
Expand Down Expand Up @@ -762,7 +762,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);
Expand Down Expand Up @@ -1126,7 +1126,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 */
Expand Down

0 comments on commit b9b6eb9

Please sign in to comment.