Get much of src/ to build.

Use build.clang.sh or build.gcc.sh for the time being.
This commit is contained in:
Viral B. Shah 2011-12-16 11:00:31 +05:30
parent b0b27a0ff4
commit 3c7b5cc6f7
46 changed files with 71 additions and 57 deletions

1
src/build.clang.sh Executable file
View file

@ -0,0 +1 @@
for i in *.c; do clang -D__BSD_VISIBLE -c -O0 -I. -I../include -I../ld128 $i; done 2>err

1
src/build.gcc.sh Executable file
View file

@ -0,0 +1 @@
for i in *.c; do gcc -D__BSD_VISIBLE -c -O0 -I. -I../include -I../ld128 $i; done 2>err

View file

@ -16,7 +16,7 @@
#include <float.h> #include <float.h>
#include <stdint.h> #include <stdint.h>
#include "fpopenlibm.h" #include "fpmath.h"
#include "openlibm.h" #include "openlibm.h"
#include "math_private.h" #include "math_private.h"
@ -25,13 +25,13 @@
#if LDBL_MANL_SIZE > 32 #if LDBL_MANL_SIZE > 32
typedef uint64_t manl_t; typedef uint64_t manl_t;
#else #else
typedef uint32_t manl_t; typedef u_int32_t manl_t;
#endif #endif
#if LDBL_MANH_SIZE > 32 #if LDBL_MANH_SIZE > 32
typedef uint64_t manh_t; typedef uint64_t manh_t;
#else #else
typedef uint32_t manh_t; typedef u_int32_t manh_t;
#endif #endif
/* /*

View file

@ -17,7 +17,7 @@
#include <float.h> #include <float.h>
#include "fpopenlibm.h" #include "fpmath.h"
#include "openlibm.h" #include "openlibm.h"
#include "math_private.h" #include "math_private.h"
@ -42,7 +42,7 @@
#if LDBL_MANL_SIZE > 32 #if LDBL_MANL_SIZE > 32
typedef uint64_t man_t; typedef uint64_t man_t;
#else #else
typedef uint32_t man_t; typedef u_int32_t man_t;
#endif #endif
long double long double

View file

@ -20,6 +20,9 @@
#include "math_private.h" #include "math_private.h"
#include "k_logf.h" #include "k_logf.h"
// VBS
#define float_t float
static const float static const float
two25 = 3.3554432000e+07, /* 0x4c000000 */ two25 = 3.3554432000e+07, /* 0x4c000000 */
ivln10hi = 4.3432617188e-01, /* 0x3ede6000 */ ivln10hi = 4.3432617188e-01, /* 0x3ede6000 */

View file

@ -20,6 +20,9 @@
#include "math_private.h" #include "math_private.h"
#include "k_logf.h" #include "k_logf.h"
// VBS
#define float_t float
static const float static const float
two25 = 3.3554432000e+07, /* 0x4c000000 */ two25 = 3.3554432000e+07, /* 0x4c000000 */
ivln2hi = 1.4428710938e+00, /* 0x3fb8b000 */ ivln2hi = 1.4428710938e+00, /* 0x3fb8b000 */

View file

@ -30,7 +30,7 @@
#include <fenv.h> #include <fenv.h>
#include <float.h> #include <float.h>
#include "fpopenlibm.h" #include "fpmath.h"
#include "openlibm.h" #include "openlibm.h"
/* Return (x + ulp) for normal positive x. Assumes no overflow. */ /* Return (x + ulp) for normal positive x. Assumes no overflow. */

View file

@ -32,7 +32,7 @@
#include "openlibm.h" #include "openlibm.h"
#include "math_private.h" #include "math_private.h"
static const uint32_t k = 1799; /* constant for reduction */ static const u_int32_t k = 1799; /* constant for reduction */
static const double kln2 = 1246.97177782734161156; /* k * ln2 */ static const double kln2 = 1246.97177782734161156; /* k * ln2 */
/* /*
@ -46,7 +46,7 @@ static double
__frexp_exp(double x, int *expt) __frexp_exp(double x, int *expt)
{ {
double exp_x; double exp_x;
uint32_t hx; u_int32_t hx;
/* /*
* We use exp(x) = exp(x - kln2) * 2**k, carefully chosen to * We use exp(x) = exp(x - kln2) * 2**k, carefully chosen to

View file

@ -32,7 +32,7 @@
#include "openlibm.h" #include "openlibm.h"
#include "math_private.h" #include "math_private.h"
static const uint32_t k = 235; /* constant for reduction */ static const u_int32_t k = 235; /* constant for reduction */
static const float kln2 = 162.88958740F; /* k * ln2 */ static const float kln2 = 162.88958740F; /* k * ln2 */
/* /*
@ -45,7 +45,7 @@ static float
__frexp_expf(float x, int *expt) __frexp_expf(float x, int *expt)
{ {
double exp_x; double exp_x;
uint32_t hx; u_int32_t hx;
exp_x = expf(x - kln2); exp_x = expf(x - kln2);
GET_FLOAT_WORD(hx, exp_x); GET_FLOAT_WORD(hx, exp_x);

View file

@ -230,7 +230,7 @@ do { \
/* /*
* Common routine to process the arguments to nan(), nanf(), and nanl(). * Common routine to process the arguments to nan(), nanf(), and nanl().
*/ */
void _scan_nan(uint32_t *__words, int __num_words, const char *__s); void _scan_nan(u_int32_t *__words, int __num_words, const char *__s);
#ifdef _COMPLEX_H #ifdef _COMPLEX_H

View file

@ -34,6 +34,7 @@ extern const union __nan_un {
float __uf; float __uf;
} __nan; } __nan;
/* VBS
#if __GNUC_PREREQ__(3, 3) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800) #if __GNUC_PREREQ__(3, 3) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
#define __MATH_BUILTIN_CONSTANTS #define __MATH_BUILTIN_CONSTANTS
#endif #endif
@ -41,6 +42,10 @@ extern const union __nan_un {
#if __GNUC_PREREQ__(3, 0) && !defined(__INTEL_COMPILER) #if __GNUC_PREREQ__(3, 0) && !defined(__INTEL_COMPILER)
#define __MATH_BUILTIN_RELOPS #define __MATH_BUILTIN_RELOPS
#endif #endif
*/
#define __MATH_BUILTIN_CONSTANTS
#define __MATH_BUILTIN_RELOPS
#ifdef __MATH_BUILTIN_CONSTANTS #ifdef __MATH_BUILTIN_CONSTANTS
#define HUGE_VAL __builtin_huge_val() #define HUGE_VAL __builtin_huge_val()

View file

@ -18,9 +18,10 @@
//__FBSDID("$FreeBSD: src/lib/msun/src/s_cbrtl.c,v 1.1 2011/03/12 19:37:35 kargl Exp $"); //__FBSDID("$FreeBSD: src/lib/msun/src/s_cbrtl.c,v 1.1 2011/03/12 19:37:35 kargl Exp $");
#include <float.h> #include <float.h>
#include <ieeefp.h> // VBS
//#include <ieeefp.h>
#include "fpopenlibm.h" #include "fpmath.h"
#include "openlibm.h" #include "openlibm.h"
#include "math_private.h" #include "math_private.h"
@ -36,7 +37,7 @@ cbrtl(long double x)
long double r, s, t, w; long double r, s, t, w;
double dr, dt, dx; double dr, dt, dx;
float ft, fx; float ft, fx;
uint32_t hx; u_int32_t hx;
uint16_t expsign; uint16_t expsign;
int k; int k;

View file

@ -27,7 +27,7 @@
#include <openlibm.h> #include <openlibm.h>
#include <stdint.h> #include <stdint.h>
#include "fpopenlibm.h" #include "fpmath.h"
#ifdef LDBL_IMPLICIT_NBIT #ifdef LDBL_IMPLICIT_NBIT
#define MANH_SIZE (LDBL_MANH_SIZE + 1) #define MANH_SIZE (LDBL_MANH_SIZE + 1)

View file

@ -32,7 +32,7 @@
#include "math_private.h" #include "math_private.h"
static const uint32_t static const u_int32_t
exp_ovfl = 0x40862e42, /* high bits of MAX_EXP * ln2 ~= 710 */ exp_ovfl = 0x40862e42, /* high bits of MAX_EXP * ln2 ~= 710 */
cexp_ovfl = 0x4096b8e4; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */ cexp_ovfl = 0x4096b8e4; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */
@ -40,7 +40,7 @@ double complex
cexp(double complex z) cexp(double complex z)
{ {
double x, y, exp_x; double x, y, exp_x;
uint32_t hx, hy, lx, ly; u_int32_t hx, hy, lx, ly;
x = creal(z); x = creal(z);
y = cimag(z); y = cimag(z);

View file

@ -32,7 +32,7 @@
#include "math_private.h" #include "math_private.h"
static const uint32_t static const u_int32_t
exp_ovfl = 0x42b17218, /* MAX_EXP * ln2 ~= 88.722839355 */ exp_ovfl = 0x42b17218, /* MAX_EXP * ln2 ~= 88.722839355 */
cexp_ovfl = 0x43400074; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */ cexp_ovfl = 0x43400074; /* (MAX_EXP - MIN_DENORM_EXP) * ln2 */
@ -40,7 +40,7 @@ float complex
cexpf(float complex z) cexpf(float complex z)
{ {
float x, y, exp_x; float x, y, exp_x;
uint32_t hx, hy; u_int32_t hx, hy;
x = crealf(z); x = crealf(z);
y = cimagf(z); y = cimagf(z);

View file

@ -28,7 +28,7 @@
#include <openlibm.h> #include <openlibm.h>
#include "fpopenlibm.h" #include "fpmath.h"
long double long double
copysignl(long double x, long double y) copysignl(long double x, long double y)

View file

@ -76,7 +76,7 @@ ctanh(double complex z)
{ {
double x, y; double x, y;
double t, beta, s, rho, denom; double t, beta, s, rho, denom;
uint32_t hx, ix, lx; u_int32_t hx, ix, lx;
x = creal(z); x = creal(z);
y = cimag(z); y = cimag(z);

View file

@ -41,7 +41,7 @@ ctanhf(float complex z)
{ {
float x, y; float x, y;
float t, beta, s, rho, denom; float t, beta, s, rho, denom;
uint32_t hx, ix; u_int32_t hx, ix;
x = crealf(z); x = crealf(z);
y = cimagf(z); y = cimagf(z);

View file

@ -341,7 +341,7 @@ double
exp2(double x) exp2(double x)
{ {
double r, t, twopk, twopkp1000, z; double r, t, twopk, twopkp1000, z;
uint32_t hx, ix, lx, i0; u_int32_t hx, ix, lx, i0;
int k; int k;
/* Filter out exceptional cases. */ /* Filter out exceptional cases. */

View file

@ -95,7 +95,7 @@ exp2f(float x)
{ {
double tv, twopk, u, z; double tv, twopk, u, z;
float t; float t;
uint32_t hx, ix, i0; u_int32_t hx, ix, i0;
int32_t k; int32_t k;
/* Filter out exceptional cases. */ /* Filter out exceptional cases. */

View file

@ -30,7 +30,7 @@
#include <openlibm.h> #include <openlibm.h>
#include "fpopenlibm.h" #include "fpmath.h"
long double long double
fabsl(long double x) fabsl(long double x)

View file

@ -27,7 +27,7 @@
#include <openlibm.h> #include <openlibm.h>
#include <stdint.h> #include <stdint.h>
#include "fpopenlibm.h" #include "fpmath.h"
#ifdef LDBL_IMPLICIT_NBIT #ifdef LDBL_IMPLICIT_NBIT
#define MANH_SIZE (LDBL_MANH_SIZE + 1) #define MANH_SIZE (LDBL_MANH_SIZE + 1)

View file

@ -43,7 +43,7 @@ float
fmaf(float x, float y, float z) fmaf(float x, float y, float z)
{ {
double xy, result; double xy, result;
uint32_t hr, lr; u_int32_t hr, lr;
xy = (double)x * y; xy = (double)x * y;
result = xy + z; result = xy + z;

View file

@ -31,7 +31,7 @@
#include <float.h> #include <float.h>
#include <openlibm.h> #include <openlibm.h>
#include "fpopenlibm.h" #include "fpmath.h"
/* /*
* A struct dd represents a floating-point number with twice the precision * A struct dd represents a floating-point number with twice the precision

View file

@ -29,7 +29,7 @@
#include <openlibm.h> #include <openlibm.h>
#include "fpopenlibm.h" #include "fpmath.h"
double double
fmax(double x, double y) fmax(double x, double y)

View file

@ -29,7 +29,7 @@
#include <openlibm.h> #include <openlibm.h>
#include "fpopenlibm.h" #include "fpmath.h"
float float
fmaxf(float x, float y) fmaxf(float x, float y)

View file

@ -29,7 +29,7 @@
#include <openlibm.h> #include <openlibm.h>
#include "fpopenlibm.h" #include "fpmath.h"
long double long double
fmaxl(long double x, long double y) fmaxl(long double x, long double y)

View file

@ -29,7 +29,7 @@
#include <openlibm.h> #include <openlibm.h>
#include "fpopenlibm.h" #include "fpmath.h"
double double
fmin(double x, double y) fmin(double x, double y)

View file

@ -29,7 +29,7 @@
#include <openlibm.h> #include <openlibm.h>
#include "fpopenlibm.h" #include "fpmath.h"
float float
fminf(float x, float y) fminf(float x, float y)

View file

@ -29,7 +29,7 @@
#include <openlibm.h> #include <openlibm.h>
#include "fpopenlibm.h" #include "fpmath.h"
long double long double
fminl(long double x, long double y) fminl(long double x, long double y)

View file

@ -29,7 +29,7 @@
#include <float.h> #include <float.h>
#include <openlibm.h> #include <openlibm.h>
#include "fpopenlibm.h" #include "fpmath.h"
#if LDBL_MAX_EXP != 0x4000 #if LDBL_MAX_EXP != 0x4000
#error "Unsupported long double format" #error "Unsupported long double format"

View file

@ -17,7 +17,7 @@
#include <limits.h> #include <limits.h>
#include <openlibm.h> #include <openlibm.h>
#include "fpopenlibm.h" #include "fpmath.h"
int int
ilogbl(long double x) ilogbl(long double x)

View file

@ -28,7 +28,7 @@
#include <openlibm.h> #include <openlibm.h>
#include "fpopenlibm.h" #include "fpmath.h"
int int
__isfinite(double d) __isfinite(double d)

View file

@ -28,7 +28,7 @@
#include <openlibm.h> #include <openlibm.h>
#include "fpopenlibm.h" #include "fpmath.h"
/* Provided by libc */ /* Provided by libc */
#if 0 #if 0

View file

@ -28,7 +28,7 @@
#include <openlibm.h> #include <openlibm.h>
#include "fpopenlibm.h" #include "fpmath.h"
int int
__isnormal(double d) __isnormal(double d)

View file

@ -18,7 +18,7 @@ static char rcsid[] = "$FreeBSD: src/lib/msun/src/s_logbl.c,v 1.1 2007/12/17 03:
#include <limits.h> #include <limits.h>
#include <openlibm.h> #include <openlibm.h>
#include "fpopenlibm.h" #include "fpmath.h"
long double long double
logbl(long double x) logbl(long double x)

View file

@ -40,12 +40,12 @@
#include <openlibm.h> #include <openlibm.h>
#include <sys/types.h> #include <sys/types.h>
#include "fpopenlibm.h" #include "fpmath.h"
#if LDBL_MANL_SIZE > 32 #if LDBL_MANL_SIZE > 32
#define MASK ((uint64_t)-1) #define MASK ((uint64_t)-1)
#else #else
#define MASK ((uint32_t)-1) #define MASK ((u_int32_t)-1)
#endif #endif
/* Return the last n bits of a word, representing the fractional part. */ /* Return the last n bits of a word, representing the fractional part. */
#define GETFRAC(bits, n) ((bits) & ~(MASK << (n))) #define GETFRAC(bits, n) ((bits) & ~(MASK << (n)))

View file

@ -48,12 +48,12 @@
* impossible to use nan(3) portably anyway, so this seems good enough. * impossible to use nan(3) portably anyway, so this seems good enough.
*/ */
void void
_scan_nan(uint32_t *words, int num_words, const char *s) _scan_nan(u_int32_t *words, int num_words, const char *s)
{ {
int si; /* index into s */ int si; /* index into s */
int bitpos; /* index into words (in bits) */ int bitpos; /* index into words (in bits) */
bzero(words, num_words * sizeof(uint32_t)); bzero(words, num_words * sizeof(u_int32_t));
/* Allow a leading '0x'. (It's expected, but redundant.) */ /* Allow a leading '0x'. (It's expected, but redundant.) */
if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) if (s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
@ -80,7 +80,7 @@ nan(const char *s)
{ {
union { union {
double d; double d;
uint32_t bits[2]; u_int32_t bits[2];
} u; } u;
_scan_nan(u.bits, 2, s); _scan_nan(u.bits, 2, s);
@ -97,7 +97,7 @@ nanf(const char *s)
{ {
union { union {
float f; float f;
uint32_t bits[1]; u_int32_t bits[1];
} u; } u;
_scan_nan(u.bits, 1, s); _scan_nan(u.bits, 1, s);

View file

@ -22,7 +22,7 @@
#include <float.h> #include <float.h>
#include "fpopenlibm.h" #include "fpmath.h"
#include "openlibm.h" #include "openlibm.h"
#include "math_private.h" #include "math_private.h"

View file

@ -21,7 +21,7 @@
#include <float.h> #include <float.h>
#include "fpopenlibm.h" #include "fpmath.h"
#include "openlibm.h" #include "openlibm.h"
#include "math_private.h" #include "math_private.h"

View file

@ -14,7 +14,7 @@
#include <float.h> #include <float.h>
#include "fpopenlibm.h" #include "fpmath.h"
#include "openlibm.h" #include "openlibm.h"
#include "math_private.h" #include "math_private.h"

View file

@ -16,7 +16,7 @@
#include <float.h> #include <float.h>
#include <stdint.h> #include <stdint.h>
#include "fpopenlibm.h" #include "fpmath.h"
#include "openlibm.h" #include "openlibm.h"
#include "math_private.h" #include "math_private.h"
@ -25,13 +25,13 @@
#if LDBL_MANL_SIZE > 32 #if LDBL_MANL_SIZE > 32
typedef uint64_t manl_t; typedef uint64_t manl_t;
#else #else
typedef uint32_t manl_t; typedef u_int32_t manl_t;
#endif #endif
#if LDBL_MANH_SIZE > 32 #if LDBL_MANH_SIZE > 32
typedef uint64_t manh_t; typedef uint64_t manh_t;
#else #else
typedef uint32_t manh_t; typedef u_int32_t manh_t;
#endif #endif
/* /*

View file

@ -30,7 +30,7 @@
#include <float.h> #include <float.h>
#include <openlibm.h> #include <openlibm.h>
#include "fpopenlibm.h" #include "fpmath.h"
#if LDBL_MAX_EXP != 0x4000 #if LDBL_MAX_EXP != 0x4000
/* We also require the usual bias, min exp and expsign packing. */ /* We also require the usual bias, min exp and expsign packing. */
@ -55,7 +55,7 @@ long double
rintl(long double x) rintl(long double x)
{ {
union IEEEl2bits u; union IEEEl2bits u;
uint32_t expsign; u_int32_t expsign;
int ex, sign; int ex, sign;
u.e = x; u.e = x;

View file

@ -31,7 +31,7 @@ static char rcsid[] = "$FreeBSD: src/lib/msun/src/s_scalbnl.c,v 1.1 2005/03/07 0
#include <float.h> #include <float.h>
#include <openlibm.h> #include <openlibm.h>
#include "fpopenlibm.h" #include "fpmath.h"
#if LDBL_MAX_EXP != 0x4000 #if LDBL_MAX_EXP != 0x4000
#error "Unsupported long double format" #error "Unsupported long double format"

View file

@ -28,7 +28,7 @@
#include <openlibm.h> #include <openlibm.h>
#include "fpopenlibm.h" #include "fpmath.h"
int int
__signbit(double d) __signbit(double d)

View file

@ -27,7 +27,7 @@
#include <openlibm.h> #include <openlibm.h>
#include <stdint.h> #include <stdint.h>
#include "fpopenlibm.h" #include "fpmath.h"
#ifdef LDBL_IMPLICIT_NBIT #ifdef LDBL_IMPLICIT_NBIT
#define MANH_SIZE (LDBL_MANH_SIZE + 1) #define MANH_SIZE (LDBL_MANH_SIZE + 1)