Skip to content

Commit 08dbb2b

Browse files
committed
Never include <complex.h>. Include <openlibm_complex.h> instead.
If we ship with a separate copy of <complex.h>, we should also use this one instead of the one provided by the system.
1 parent beb387c commit 08dbb2b

74 files changed

Lines changed: 147 additions & 127 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/k_exp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
#include "cdefs-compat.h"
2828
//__FBSDID("$FreeBSD: src/lib/msun/src/k_exp.c,v 1.1 2011/10/21 06:27:56 das Exp $");
2929

30-
#include <complex.h>
30+
#include <openlibm.h>
31+
#include <openlibm_complex.h>
3132

32-
#include "openlibm.h"
3333
#include "math_private.h"
3434

3535
static const u_int32_t k = 1799; /* constant for reduction */

src/k_expf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
#include "cdefs-compat.h"
2828
//__FBSDID("$FreeBSD: src/lib/msun/src/k_expf.c,v 1.1 2011/10/21 06:27:56 das Exp $");
2929

30-
#include <complex.h>
30+
#include <openlibm.h>
31+
#include <openlibm_complex.h>
3132

32-
#include "openlibm.h"
3333
#include "math_private.h"
3434

3535
static const u_int32_t k = 235; /* constant for reduction */

src/math_private.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
#ifndef _MATH_PRIVATE_H_
1818
#define _MATH_PRIVATE_H_
1919

20+
#include <openlibm_complex.h>
21+
2022
#include "cdefs-compat.h"
2123
#include "types-compat.h"
2224
#include "fpmath.h"
23-
#include <complex.h>
2425
#include <stdint.h>
2526
#include "math_private_openbsd.h"
2627

src/openlibm.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
* $FreeBSD: src/lib/msun/src/openlibm.h,v 1.82 2011/11/12 19:55:48 theraven Exp $
1515
*/
1616

17-
#ifndef _MATH_H_
18-
#define _MATH_H_
17+
#ifndef OPENLIBM_H
18+
#define OPENLIBM_H
1919

20-
#include <complex.h>
20+
#include <openlibm_complex.h>
2121

2222
#if (defined(_WIN32) || defined (_MSC_VER)) && !defined(__WIN32__)
2323
#define __WIN32__
@@ -581,9 +581,7 @@ long double truncl(long double);
581581
long double lgammal_r(long double, int *);
582582
#endif /* __BSD_VISIBLE */
583583

584-
#include "openlibm_complex.h"
585-
586584
#if defined(__cplusplus)
587585
}
588586
#endif
589-
#endif /* !_MATH_H_ */
587+
#endif /* !OPENLIBM_H */

src/openlibm_complex.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@
1515
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1616
*/
1717

18-
#ifndef _OPENLIBM_COMPLEX_H_
19-
#define _OPENLIBM_COMPLEX_H_
18+
#ifndef OPENLIBM_COMPLEX_H
19+
#define OPENLIBM_COMPLEX_H
2020

21-
#include <sys/cdefs.h>
21+
#define complex _Complex
22+
23+
#define _Complex_I 1.0fi
24+
#define I _Complex_I
2225

2326
/*
2427
* Double versions of C99 functions
@@ -99,4 +102,4 @@ long double complex conjl(long double complex);
99102
long double complex cprojl(long double complex);
100103
long double creall(long double complex);
101104

102-
#endif /* !_OPENLIBM_COMPLEX_H_ */
105+
#endif /* !OPENLIBM_COMPLEX_H */

src/s_cabs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1616
*/
1717

18-
#include <complex.h>
1918
#include <float.h>
20-
#include "openlibm.h"
19+
#include <openlibm.h>
20+
#include <openlibm_complex.h>
2121

2222
double
2323
cabs(double complex z)

src/s_cabsf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1616
*/
1717

18-
#include <complex.h>
19-
#include "openlibm.h"
18+
#include <openlibm.h>
19+
#include <openlibm_complex.h>
2020

2121
float
2222
cabsf(float complex z)

src/s_cabsl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1717
*/
1818

19-
#include <complex.h>
20-
#include "openlibm.h"
19+
#include <openlibm.h>
20+
#include <openlibm_complex.h>
2121

2222
long double
2323
cabsl(long double complex z)

src/s_cacos.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
* IEEE -10,+10 30000 1.8e-14 2.2e-15
4747
*/
4848

49-
#include <complex.h>
5049
#include <float.h>
51-
#include "openlibm.h"
50+
#include <openlibm.h>
51+
#include <openlibm_complex.h>
5252

5353
double complex
5454
cacos(double complex z)

src/s_cacosf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
*
4747
*/
4848

49-
#include <complex.h>
50-
#include "openlibm.h"
49+
#include <openlibm.h>
50+
#include <openlibm_complex.h>
5151

5252
float complex
5353
cacosf(float complex z)

0 commit comments

Comments
 (0)