Skip to content

Commit

Permalink
Merge pull request #44 from lemire/dlemire/patch_solaris
Browse files Browse the repository at this point in the history
Extending the fallback.
  • Loading branch information
lemire authored Nov 10, 2020
2 parents 94faf8d + eb16768 commit ace6064
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/rhub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: rhub

'on':
- push
- pull_request
jobs:
ubuntu-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: start docker
run: |
docker run -w /src -dit --name rhub -v $PWD:/src rhub/rocker-gcc-san
echo 'docker exec rhub "$@";' > ./rhub.sh
chmod +x ./rhub.sh
- name: build
run: |
./rhub.sh c++ tests/unit.cpp -I include
- name: test
run: |
./rhub.sh ./a.out
18 changes: 13 additions & 5 deletions include/fast_double_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,20 @@
#include <cstring>
#include <locale.h>

#if (defined(sun) || defined(__sun))
#define FAST_DOUBLE_PARSER_SOLARIS
#endif

#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
#define FAST_DOUBLE_PARSER_CYGWIN
#endif

/**
* Determining whether we should import xlocale.h or not is
* a bit of a nightmare.
*/
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
// Anything at all that is related to cygwin, msys and so forth will
#if defined(FAST_DOUBLE_PARSER_SOLARIS) || defined(FAST_DOUBLE_PARSER_CYGWIN)
// Anything at all that is related to cygwin, msys, solaris and so forth will
// always use this fallback because we cannot rely on it behaving as normal
// gcc.
#include <locale>
Expand Down Expand Up @@ -55,7 +63,7 @@ static inline double cygwin_strtod_l(const char* start, char** end) {
#endif // __has_include


#endif // defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
#endif // defined(FAST_DOUBLE_PARSER_SOLARIS) || defined(FAST_DOUBLE_PARSER_CYGWIN)



Expand Down Expand Up @@ -1086,8 +1094,8 @@ really_inline double compute_float_64(int64_t power, uint64_t i, bool negative,
// Return the null pointer on error
static const char * parse_float_strtod(const char *ptr, double *outDouble) {
char *endptr;
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
// workround for cygwin
#if defined(FAST_DOUBLE_PARSER_SOLARIS) || defined(FAST_DOUBLE_PARSER_CYGWIN)
// workround for cygwin, solaris
*outDouble = cygwin_strtod_l(ptr, &endptr);
#elif defined(_WIN32)
static _locale_t c_locale = _create_locale(LC_ALL, "C");
Expand Down

0 comments on commit ace6064

Please sign in to comment.