Skip to content

Commit

Permalink
move D_PNAN/D_PINF/etc constants into static defines
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Dec 25, 2014
1 parent 9d2c004 commit 4e65472
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 38 deletions.
6 changes: 0 additions & 6 deletions src/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@
#include <fcntl.h>
#if defined(_OS_WINDOWS_)
#include <malloc.h>
#if defined(_COMPILER_INTEL_)
#include <mathimf.h>
#else
#include <math.h>
#endif
#else
#include <unistd.h>
#include <math.h>
#endif
#include <ctype.h>
#include "julia.h"
Expand Down
14 changes: 0 additions & 14 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
#include "platform.h"
/*
* We include <mathimf.h> here, because somewhere below <math.h> is included also.
* As a result, Intel C++ Composer generates an error. To prevent this error, we
* include <mathimf.h> as soon as possible. <mathimf.h> defines several macros
* (like _INC_MATH, __MATH_H_INCLUDED, __COMPLEX_H_INCLUDED) that prevent
* including <math.h> (or rather its content).
*/
#if defined(_OS_WINDOWS_)
#if defined(_COMPILER_INTEL_)
#include <mathimf.h>
#else
#include <math.h>
#endif
#endif

#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS
Expand Down
21 changes: 13 additions & 8 deletions src/support/dtypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
#include <stddef.h>
#include <stddef.h> // double include of stddef.h fixes #3421
#include <stdint.h>
#if defined(_COMPILER_INTEL_)
#include <mathimf.h>
#else
#include <math.h>
#endif

#include "platform.h"

Expand Down Expand Up @@ -173,14 +178,14 @@ typedef uptrint_t u_ptrint_t;
#define S32_MIN (-S32_MAX - 1L)
#define BIT31 0x80000000

extern double D_PNAN;
extern double D_NNAN;
extern double D_PINF;
extern double D_NINF;
extern float F_PNAN;
extern float F_NNAN;
extern float F_PINF;
extern float F_NINF;
#define D_PNAN ((double)+NAN)
#define D_NNAN ((double)-NAN)
#define D_PINF ((double)+INFINITY)
#define D_NINF ((double)-INFINITY)
#define F_PNAN ((float)+NAN)
#define F_NNAN ((float)-NAN)
#define F_PINF ((float)+INFINITY)
#define F_NINF ((float)-INFINITY)

typedef enum { T_INT8, T_UINT8, T_INT16, T_UINT16, T_INT32, T_UINT32,
T_INT64, T_UINT64, T_FLOAT, T_DOUBLE } numerictype_t;
Expand Down
10 changes: 0 additions & 10 deletions src/support/libsupportinit.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
#include <locale.h>
#include <math.h>
#include "libsupport.h"

#ifdef __cplusplus
extern "C" {
#endif

double D_PNAN;
double D_NNAN;
double D_PINF;
double D_NINF;

static int isInitialized = 0;

void libsupport_init(void)
Expand All @@ -24,10 +18,6 @@ void libsupport_init(void)

ios_init_stdstreams();

D_PNAN = +NAN;
D_NNAN = -NAN;
D_PINF = +INFINITY;
D_NINF = -INFINITY;
isInitialized=1;
}
}
Expand Down

3 comments on commit 4e65472

@svaksha
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit breaks julia when I run make:

LINK src/flisp/flisp

/home/mom/julia/src/flisp/flisp.o: In function isnumtok_base': /home/mom/julia/src/flisp/read.c:78: undefined reference toD_PINF'
/home/mom/julia/src/flisp/read.c:74: undefined reference to D_PNAN' /home/mom/julia/src/flisp/read.c:88: undefined reference toD_NINF'
/home/mom/julia/src/flisp/read.c:84: undefined reference to D_NNAN' /home/mom/julia/src/flisp/read.c:78: undefined reference toD_PINF'
/home/mom/julia/src/flisp/read.c:74: undefined reference to D_PNAN' /home/mom/julia/src/flisp/read.c:88: undefined reference toD_NINF'
/home/mom/julia/src/flisp/read.c:84: undefined reference to `D_NNAN'
collect2: error: ld returned 1 exit status
make[3]: *** [/home/mom/julia/src/flisp/flisp] Error 1
make[2]: *** [flisp/libflisp.a] Error 2
make[1]: *** [julia-release] Error 2
make: *** [release] Error 2

OS: Ubuntu-LTS-14.04
$ julia
bash: /home/mom/julia/julia: No such file or directory

@vtjnash
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it appears you need to do make -C src cleanall

@svaksha
Copy link

@svaksha svaksha commented on 4e65472 Dec 25, 2014 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.