Skip to content

Commit

Permalink
dtoa/utils.h doesn't parse after recent SDK changes
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=259789
rdar://113341253

Reviewed by Wenson Hsieh.

* Source/WTF/wtf/dtoa/utils.h:
Recent SDK changes resulted in CoreUtils headers getting imported into
translation units (OutputContext.mm) that also import `dtoa/utils.h`.

The aforementioned CoreUtils headers have long had macros Min() and Max(),
which conflict with our template functions' definitions, and make utils.h
fail to parse.

As a quick workaround, undefine the rogue macros before our Min() and Max().

Canonical link: https://commits.webkit.org/266550@main
  • Loading branch information
hortont424 committed Aug 3, 2023
1 parent ac42336 commit 9bd05bd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Source/WTF/wtf/dtoa/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ inline void abort_noreturn() { abort(); }
#endif
#endif


// Double operations detection based on target architecture.
// Linux uses a 80bit wide floating point stack on x86. This induces double
// rounding, which in turn leads to wrong results.
Expand Down Expand Up @@ -164,6 +163,15 @@ typedef uint16_t uc16;
DC_DISALLOW_COPY_AND_ASSIGN(TypeName)
#endif

// On Cocoa platforms, CoreUtils.h has Min() and Max() macros that sometimes get included above here.
#ifdef Min
#undef Min
#endif

#ifdef Max
#undef Max
#endif

namespace WTF {
namespace double_conversion {

Expand Down

0 comments on commit 9bd05bd

Please sign in to comment.