evanw / skew

A web-first, cross-platform programming language with an optimizing compiler
https://evanw.github.io/skew-lang.org/
MIT License
411 stars 16 forks source link

c++ build fails on some linux distros #27

Closed spliskin closed 3 years ago

spliskin commented 3 years ago

Running build.py on artix, or archlinux distributions generates a slew of these errors. Easy enough to fix by adding #include <cmath> in skew.h:90

3 warnings generated
c++ out/test.debug.cpp -o out/test.debug -std=c++11 -Wall -Wextra -Wno-switch -Wno-unused-parameter -Wno-unused-variable -include src/cpp/skew.h -include src/cpp/support.h src/cpp/skew.cpp src/cpp/support.cpp
In file included from ./src/cpp/skew.h:84,
                 from <command-line>:
out/test.debug.cpp: In function ‘Skew::string Skew::doubleToStringWithDot(double)’:
out/test.debug.cpp:11581:15: error: ‘isfinite’ is not a member of ‘std’
11581 |   assert(std::isfinite(value));
      |               ^~~~~~~~
out/test.debug.cpp: In member function ‘void Skew::TypeScriptEmitter::_emitContent(Skew::Content*)’:
out/test.debug.cpp:13518:24: error: ‘isnan’ is not a member of ‘std’
13518 |       this->_emit(std::isnan(value) ? "NaN"_s : value == 1.0 / 0.0 ? "Infinity"_s : value == -(1.0 / 0.0) ? "-Infinity"_s : __doubleToString(value));
      |                        ^~~~~
out/test.debug.cpp: In member function ‘void Skew::TypeScriptEmitter::_emitExpression(Skew::Node*, Skew::Precedence)’:
out/test.debug.cpp:13662:120: error: ‘isfinite’ is not a member of ‘std’
13662 |       bool wrap = precedence == Skew::Precedence::MEMBER && node->isNumberLessThanZero() && (!node->isDouble() || std::isfinite(node->asDouble()));
evanw commented 3 years ago

Closing because #28 has landed.