mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
Small code cleanup.
- Wraps some LDC specific code in 'IN_LLVM' section - Adds some MSVC specific code to 'IN_LLVM' section - Removes an unused include file Net result is much less errors with MSVC.
This commit is contained in:
@@ -22,6 +22,10 @@
|
||||
#include "arraytypes.h"
|
||||
|
||||
#if IN_LLVM
|
||||
#if defined(_MSC_VER)
|
||||
#undef min
|
||||
#undef max
|
||||
#endif
|
||||
#include "../ir/irdsymbol.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2507,10 +2507,15 @@ done:
|
||||
real_t::parse((char *)stringbuffer.data, real_t::Float);
|
||||
#else
|
||||
strtofres = strtof((char *)stringbuffer.data, NULL);
|
||||
#ifdef IN_LLVM
|
||||
#ifdef _MSC_VER
|
||||
#define HUGE_VALF HUGE_VAL
|
||||
#endif
|
||||
// LDC change: don't error on gradual underflow
|
||||
if (errno == ERANGE &&
|
||||
strtofres != 0 && strtofres != HUGE_VALF && strtofres != -HUGE_VALF)
|
||||
errno = 0;
|
||||
#endif
|
||||
#endif
|
||||
result = TOKfloat32v;
|
||||
p++;
|
||||
@@ -2521,10 +2526,12 @@ done:
|
||||
real_t::parse((char *)stringbuffer.data, real_t::Double);
|
||||
#else
|
||||
strtodres = strtod((char *)stringbuffer.data, NULL);
|
||||
#if IN_LLVM
|
||||
// LDC change: don't error on gradual underflow
|
||||
if (errno == ERANGE &&
|
||||
strtodres != 0 && strtodres != HUGE_VAL && strtodres != -HUGE_VAL)
|
||||
errno = 0;
|
||||
#endif
|
||||
#endif
|
||||
result = TOKfloat64v;
|
||||
break;
|
||||
|
||||
@@ -69,10 +69,6 @@ the target object file format:
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#ifndef __STDC_FORMAT_MACROS
|
||||
#define __STDC_FORMAT_MACROS 1
|
||||
#endif
|
||||
#include <inttypes.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef __DMC__
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
#include "arraytypes.h"
|
||||
|
||||
#if IN_LLVM
|
||||
#if defined(_MSC_VER)
|
||||
#undef min
|
||||
#undef max
|
||||
#endif
|
||||
#include "../ir/irdsymbol.h"
|
||||
#endif
|
||||
|
||||
|
||||
27
dmd2/lexer.c
27
dmd2/lexer.c
@@ -2502,11 +2502,16 @@ done:
|
||||
#ifdef IN_GCC
|
||||
real_t::parse((char *)stringbuffer.data, real_t::Float);
|
||||
#else
|
||||
strtofres = strtof((char *)stringbuffer.data, NULL);
|
||||
// LDC change: don't error on gradual underflow
|
||||
if (errno == ERANGE &&
|
||||
strtofres != 0 && strtofres != HUGE_VALF && strtofres != -HUGE_VALF)
|
||||
errno = 0;
|
||||
strtofres = strtof((char *)stringbuffer.data, NULL);
|
||||
#ifdef IN_LLVM
|
||||
#ifdef _MSC_VER
|
||||
#define HUGE_VALF HUGE_VAL
|
||||
#endif
|
||||
// LDC change: don't error on gradual underflow
|
||||
if (errno == ERANGE &&
|
||||
strtofres != 0 && strtofres != HUGE_VALF && strtofres != -HUGE_VALF)
|
||||
errno = 0;
|
||||
#endif
|
||||
#endif
|
||||
result = TOKfloat32v;
|
||||
p++;
|
||||
@@ -2516,11 +2521,13 @@ done:
|
||||
#ifdef IN_GCC
|
||||
real_t::parse((char *)stringbuffer.data, real_t::Double);
|
||||
#else
|
||||
strtodres = strtod((char *)stringbuffer.data, NULL);
|
||||
// LDC change: don't error on gradual underflow
|
||||
if (errno == ERANGE &&
|
||||
strtodres != 0 && strtodres != HUGE_VAL && strtodres != -HUGE_VAL)
|
||||
errno = 0;
|
||||
strtodres = strtod((char *)stringbuffer.data, NULL);
|
||||
#ifdef IN_LLVM
|
||||
// LDC change: don't error on gradual underflow
|
||||
if (errno == ERANGE &&
|
||||
strtodres != 0 && strtodres != HUGE_VAL && strtodres != -HUGE_VAL)
|
||||
errno = 0;
|
||||
#endif
|
||||
#endif
|
||||
result = TOKfloat64v;
|
||||
break;
|
||||
|
||||
@@ -69,10 +69,6 @@ the target object file format:
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#ifndef __STDC_FORMAT_MACROS
|
||||
#define __STDC_FORMAT_MACROS 1
|
||||
#endif
|
||||
#include <inttypes.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef __DMC__
|
||||
|
||||
Reference in New Issue
Block a user