diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b1854a3a..eccb5185b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -308,6 +308,36 @@ jobs: build\run-test262.exe -c tests.conf build\function_source.exe + windows-sdk: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + arch: [x64, Win32] + buildType: [Debug, Release] + steps: + - uses: actions/checkout@v4 + - name: Install windows sdk + uses: ChristopheLav/windows-sdk-install@v1 + with: + version-sdk: 26100 + features: 'OptionId.DesktopCPPx86,OptionId.DesktopCPPx64' + - name: build + run: | + cmake -B build -DBUILD_EXAMPLES=ON -DCMAKE_SYSTEM_VERSION="10.0.26100.0" -A ${{matrix.arch}} + cmake --build build --config ${{matrix.buildType}} + - name: stats + run: | + build\${{matrix.buildType}}\qjs.exe -qd + - name: test + run: | + cp build\${{matrix.buildType}}\fib.dll examples\ + cp build\${{matrix.buildType}}\point.dll examples\ + build\${{matrix.buildType}}\qjs.exe examples\test_fib.js + build\${{matrix.buildType}}\qjs.exe examples\test_point.js + build\${{matrix.buildType}}\run-test262.exe -c tests.conf + build\${{matrix.buildType}}\function_source.exe + windows-mingw: runs-on: windows-latest strategy: diff --git a/quickjs.c b/quickjs.c index 675abb0b7..d6d0aa320 100644 --- a/quickjs.c +++ b/quickjs.c @@ -41116,7 +41116,7 @@ static const JSCFunctionListEntry js_number_funcs[] = { JS_CFUNC_DEF("isSafeInteger", 1, js_number_isSafeInteger ), JS_PROP_DOUBLE_DEF("MAX_VALUE", 1.7976931348623157e+308, 0 ), JS_PROP_DOUBLE_DEF("MIN_VALUE", 5e-324, 0 ), - JS_PROP_DOUBLE_DEF("NaN", NAN, 0 ), + JS_PROP_DOUBLE_DEF("NaN", JS_FLOAT64_NAN, 0 ), JS_PROP_DOUBLE_DEF("NEGATIVE_INFINITY", -INFINITY, 0 ), JS_PROP_DOUBLE_DEF("POSITIVE_INFINITY", INFINITY, 0 ), JS_PROP_DOUBLE_DEF("EPSILON", 2.220446049250313e-16, 0 ), /* ES6 */ @@ -50197,7 +50197,7 @@ static const JSCFunctionListEntry js_global_funcs[] = { JS_CFUNC_DEF("escape", 1, js_global_escape ), JS_CFUNC_DEF("unescape", 1, js_global_unescape ), JS_PROP_DOUBLE_DEF("Infinity", 1.0 / 0.0, 0 ), - JS_PROP_DOUBLE_DEF("NaN", NAN, 0 ), + JS_PROP_DOUBLE_DEF("NaN", JS_FLOAT64_NAN, 0 ), JS_PROP_UNDEFINED_DEF("undefined", 0 ), JS_PROP_STRING_DEF("[Symbol.toStringTag]", "global", JS_PROP_CONFIGURABLE ), }; @@ -50337,7 +50337,7 @@ static double time_clip(double t) { if (t >= -8.64e15 && t <= 8.64e15) return trunc(t) + 0.0; /* convert -0 to +0 */ else - return NAN; + return JS_FLOAT64_NAN; } /* The spec mandates the use of 'double' and it specifies the order @@ -50357,7 +50357,7 @@ static double set_date_fields(double fields[minimum_length(7)], int is_local) { if (mn < 0) mn += 12; if (ym < -271821 || ym > 275760) - return NAN; + return JS_FLOAT64_NAN; yi = ym; mi = mn; @@ -50389,7 +50389,7 @@ static double set_date_fields(double fields[minimum_length(7)], int is_local) { /* emulate 21.4.1.16 MakeDate ( day, time ) */ tv = (temp = day * 86400000) + time; /* prevent generation of FMA */ if (!isfinite(tv)) - return NAN; + return JS_FLOAT64_NAN; /* adjust for local time and clip */ if (is_local) { @@ -50428,7 +50428,7 @@ static JSValue set_date_field(JSContext *ctx, JSValue this_val, int res, first_field, end_field, is_local, i, n; double d, a; - d = NAN; + d = JS_FLOAT64_NAN; first_field = (magic >> 8) & 0x0F; end_field = (magic >> 4) & 0x0F; is_local = magic & 0x0F; @@ -50628,7 +50628,7 @@ static JSValue js_date_constructor(JSContext *ctx, JSValue new_target, if (i == 0 && fields[0] >= 0 && fields[0] < 100) fields[0] += 1900; } - val = (i == n) ? set_date_fields(fields, 1) : NAN; + val = (i == n) ? set_date_fields(fields, 1) : JS_FLOAT64_NAN; } has_val: rv = js_create_from_ctor(ctx, new_target, JS_CLASS_DATE); diff --git a/quickjs.h b/quickjs.h index 6f0fe4590..36139a95c 100644 --- a/quickjs.h +++ b/quickjs.h @@ -27,6 +27,12 @@ #ifndef QUICKJS_H #define QUICKJS_H +/* In Windows SDK >= 26100 NAN is not a constant expression. + * See: https://github.com/quickjs-ng/quickjs/issues/622 */ +#if defined(_MSC_VER) +#define _UCRT_NOISY_NAN +#endif + #include #include #include