[PATCH] D146251: [test-suite] Fix FreeBSD and OpenBSD builds

Dimitry Andric via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 16 11:40:06 PDT 2023


dim created this revision.
dim added reviewers: brad, emaste, tstellar.
Herald added subscribers: mstorsjo, krytarowski, arichardson.
Herald added a project: All.
dim requested review of this revision.

With clang 16, SingleSource/Benchmarks/Misc/mandel.c fails to compile on
FreeBSD, complaining that `hypot()` is not declared:

  SingleSource/Benchmarks/Misc/mandel.c:38:13: error: call to undeclared library function 'hypot' with type 'double (double, double)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
          if (hypot(__real__ z, __imag__ z) >= ESCAPE)
              ^

The `hypot()` function is declared in `<math.h>`, not `<complex.h>`, so
use the former. This also applies to at least OpenBSD.


Repository:
  rT test-suite

https://reviews.llvm.org/D146251

Files:
  SingleSource/Benchmarks/Misc/mandel.c


Index: SingleSource/Benchmarks/Misc/mandel.c
===================================================================
--- SingleSource/Benchmarks/Misc/mandel.c
+++ SingleSource/Benchmarks/Misc/mandel.c
@@ -11,9 +11,9 @@
 
 #define I 1.0iF
 
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__MINGW32__)
+#if defined(__MINGW32__)
 #include <complex.h>
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__)
 #include <math.h>
 #else
 #include <tgmath.h>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146251.505891.patch
Type: text/x-patch
Size: 505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230316/6f8bdc44/attachment.bin>


More information about the llvm-commits mailing list