aboutsummaryrefslogtreecommitdiff
pure_function_calls: {
    options = {
        annotations: true,
        booleans: true,
        comparisons: true,
        conditionals: true,
        evaluate: true,
        if_return: true,
        join_vars: true,
        negate_iife: true,
        side_effects: true,
        unused: true,
    }
    input: {
        // pure top-level IIFE will be dropped
        // @__PURE__ - comment
        (function() {
            console.log("iife0");
        })();

        // pure top-level IIFE assigned to unreferenced var will not be dropped
        var iife1 = /*@__PURE__*/(function() {
            console.log("iife1");
            function iife1() {}
            return iife1;
        })();

        (function(){
            // pure IIFE in function scope assigned to unreferenced var will be dropped
            var iife2 = /*#__PURE__*/(function() {
                console.log("iife2");
                function iife2() {}
                return iife2;
            })();
        })();

        // comment #__PURE__ comment
        bar(), baz(), quux();
        a.b(), /* @__PURE__ */ c.d.e(), f.g();
    }
    expect: {
        var iife1 = function() {
            console.log("iife1");
            function iife1() {}
            return iife1;
        }();

        baz(), quux();
        a.b(), f.g();
    }
    expect_warnings: [
        "WARN: Dropping __PURE__ call [test/compress/issue-1261.js:3,8]",
        "WARN: Dropping side-effect-free statement [test/compress/issue-1261.js:3,8]",
        "WARN: Dropping __PURE__ call [test/compress/issue-1261.js:16,37]",
        "WARN: Dropping unused variable iife2 [test/compress/issue-1261.js:16,16]",
        "WARN: Dropping side-effect-free statement [test/compress/issue-1261.js:14,8]",
        "WARN: Dropping __PURE__ call [test/compress/issue-1261.js:24,8]",
        "WARN: Dropping __PURE__ call [test/compress/issue-1261.js:25,31]",
    ]
}

pure_function_calls_toplevel: {
    options = {
        annotations: true,
        booleans: true,
        comparisons: true,
        conditionals: true,
        evaluate: true,
        if_return: true,
        join_vars: true,
        negate_iife: true,
        side_effects: true,
        toplevel: true,
        unused: true,
    }
    input: {
        // pure top-level IIFE will be dropped
        // @__PURE__ - comment
        (function() {
            console.log("iife0");
        })();

        // pure top-level IIFE assigned to unreferenced var will be dropped
        var iife1 = /*@__PURE__*/(function() {
            console.log("iife1");
            function iife1() {}
            return iife1;
        })();

        (function(){
            // pure IIFE in function scope assigned to unreferenced var will be dropped
            var iife2 = /*#__PURE__*/(function() {
                console.log("iife2");
                function iife2() {}
                return iife2;
            })();
        })();

        // pure top-level calls will be dropped regardless of the leading comments position
        var MyClass = /*#__PURE__*//*@class*/(function(){
            function MyClass() {}
            MyClass.prototype.method = function() {};
            return MyClass;
        })();

        // comment #__PURE__ comment
        bar(), baz(), quux();
        a.b(), /* @__PURE__ */ c.d.e(), f.g();
    }
    expect: {
        baz(), quux();
        a.b(), f.g();
    }
    expect_warnings: [
        "WARN: Dropping __PURE__ call [test/compress/issue-1261.js:3,8]",
        "WARN: Dropping side-effect-free statement [test/compress/issue-1261.js:3,8]",
        "WARN: Dropping __PURE__ call [test/compress/issue-1261.js:16,37]",
        "WARN: Dropping unused variable iife2 [test/compress/issue-1261.js:16,16]",
        "WARN: Dropping side-effect-free statement [test/compress/issue-1261.js:14,8]",
        "WARN: Dropping __PURE__ call [test/compress/issue-1261.js:31,8]",
        "WARN: Dropping __PURE__ call [test/compress/issue-1261.js:32,31]",
        "WARN: Dropping __PURE__ call [test/compress/issue-1261.js:8,33]",
        "WARN: Dropping unused variable iife1 [test/compress/issue-1261.js:8,12]",
        "WARN: Dropping __PURE__ call [test/compress/issue-1261.js:24,45]",
        "WARN: Dropping unused variable MyClass [test/compress/issue-1261.js:24,12]",
    ]
}

should_warn: {
    options = {
        annotations: true,
        booleans: true,
        conditionals: true,
        evaluate: true,
        side_effects: true,
    }
    input: {
        /* @__PURE__ */(function(){x})(), void/* @__PURE__ */(function(){y})();
        /* @__PURE__ */(function(){x})() || true ? foo() : bar();
        true || /* @__PURE__ */(function(){y})() ? foo() : bar();
        /* @__PURE__ */(function(){x})() && false ? foo() : bar();
        false && /* @__PURE__ */(function(){y})() ? foo() : bar();
        /* @__PURE__ */(function(){x})() + "foo" ? bar() : baz();
        "foo" + /* @__PURE__ */(function(){y})() ? bar() : baz();
        /* @__PURE__ */(function(){x})() ? foo() : foo();
        [/* @__PURE__ */(function(){x})()] ? foo() : bar();
        !{ foo: /* @__PURE__ */(function(){x})() } ? bar() : baz();
    }
    expect: {
        foo();
        foo();
        bar();
        bar();
        bar();
        bar();
        foo();
        foo();
        baz();
    }
    expect_warnings: [
        "WARN: Dropping __PURE__ call [test/compress/issue-1261.js:1,61]",
        "WARN: Dropping __PURE__ call [test/compress/issue-1261.js:1,23]",
        "WARN: Dropping side-effect-free statement [test/compress/issue-1261.js:1,23]",
        "WARN: Boolean || always true [test/compress/issue-1261.js:2,23]",
        "WARN: Dropping __PURE__ call [test/compress/issue-1261.js:2,23]",
        "WARN: Condition always true [test/compress/issue-1261.js:2,23]",
        "WARN: Condition left of || always true [test/compress/issue-1261.js:3,8]",
        "WARN: Condition always true [test/compress/issue-1261.js:3,8]",
        "WARN: Boolean && always false [test/compress/issue-1261.js:4,23]",
        "WARN: Dropping __PURE__ call [test/compress/issue-1261.js:4,23]",
        "WARN: Condition always false [test/compress/issue-1261.js:4,23]",
        "WARN: Condition left of && always false [test/compress/issue-1261.js:5,8]",
        "WARN: Condition always false [test/compress/issue-1261.js:5,8]",
        "WARN: + in boolean context always true [test/compress/issue-1261.js:6,23]",
        "WARN: Dropping __PURE__ call [test/compress/issue-1261.js:6,23]",
        "WARN: Condition always true [test/compress/issue-1261.js:6,23]",
        "WARN: + in boolean context always true [test/compress/issue-1261.js:7,8]",
        "WARN: Dropping __PURE__ call [test/compress/issue-1261.js:7,31]",
        "WARN: Condition always true [test/compress/issue-1261.js:7,8]",
        "WARN: Dropping __PURE__ call [test/compress/issue-1261.js:8,23]",
        "WARN: Condition always true [test/compress/issue-1261.js:9,8]",
        "WARN: Dropping __PURE__ call [test/compress/issue-1261.js:9,24]",
        "WARN: Dropping __PURE__ call [test/compress/issue-1261.js:10,31]",
        "WARN: Condition always false [test/compress/issue-1261.js:10,8]",
    ]
}
RTC accessible....* gnu/system/images/novena.scm (novena-barebones-os)[initrd-modules]: Add i2c-dev. Danny Milosavljevic 2020-12-03images: novena: Replace agetty-service by term-auto....* gnu/system/images/novena.scm (novena-barebones-os)[kernel-arguments]: New field. [services]: Remove field. Danny Milosavljevic 2020-12-03images: Add novena-image-type, novena-barebones-raw-image, novena-barebones-os....* gnu/system/images/novena.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. Danny Milosavljevic 2020-11-20image: Add pinebook-pro support....* gnu/system/images/pinebook-pro.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/ci.scm (%guix-system-images): Add pinebook-pro-barebones-raw-image. Mathieu Othacehe 2020-10-06images: Add pine64-barebones-raw-image....* gnu/system/images/pine64.scm (pine64-barebones-raw-image): New variable. * gnu/ci.scm (%guix-system-images): Add it. Mathieu Othacehe 2020-10-05images: Add pine64 support....* gnu/system/images/pine64.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/system/image.scm (arm64-disk-image, arm64-image-type): New variables. Mathieu Othacehe 2020-09-30system: image: Add image-type support....* gnu/system/image.scm (image-with-os): New macro. Rename the old "image-with-os" procedure to ... (image-with-os*): ... this new procedure, (system-image): adapt according, (raw-image-type, iso-image-type, uncompressed-iso-image-type %image-types): new variables, (lookup-image-type-by-name): new procedure. (find-image): remove it. * gnu/system/images/hurd.scm (hurd-image-type): New variable, use it to define ... (hurd-disk-image): ... this variable, using "os->image" procedure. * gnu/tests/install.scm (run-install): Rename installation-disk-image-file-system-type parameter to installation-image-type, use os->config instead of find-image to compute the image passed to system-image, (%test-iso-image-installer) adapt accordingly, (guided-installation-test): ditto. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org> Mathieu Othacehe 2020-09-29images: hurd: Add hurd-barebones-qcow2-image....* gnu/system/images/hurd.scm (hurd-barebones-qcow2-image): New variable. Mathieu Othacehe 2020-07-11image: Do not set journal_model=WAL for the Hurd....This fixes <https://bugs.gnu.org/42151>. * gnu/system/images/hurd.scm (hurd-initialize-root-partition): Use #:wal-mode #f in call to ... * gnu/build/image.scm (initialize-root-partition): ... this, add #:wal-mode? parameter, pass it to ... (register-closure): ... this, add #:wal-mode? parameter, pass it to ... * guix/store/database.scm (with-database): ... this, add #:wal-mode? parameter, pass it to ... (call-with-database): ... this, add #:wal-mode? parameter; when set to #f, do not set journal_model=WAL. Jan (janneke) Nieuwenhuizen 2020-06-25image: hurd: Initialize root partition for the Hurd....This is a follow-up to commit b904b59ce592c89dfb4675a8c06757afed6738a0. * gnu/system/image.scm (hurd-initialize-root-partition): Move to ... * gnu/system/images/hurd.scm (hurd-initialize-root-partition): ... here. (hurd-disk-image): Use it. Jan (janneke) Nieuwenhuizen 2020-06-25image: hurd: Create hurd-compatible ext2 file-system....This is a follow-up to commit b904b59ce592c89dfb4675a8c06757afed6738a0. * gnu/system/images/hurd.scm (hurd-disk-image): Add file-system-options to create an ext2 file-system that is compatible with the Hurd. Jan (janneke) Nieuwenhuizen 2020-06-24image: Move hurd image definition to a dedicated file....This moves hurd-disk-image to a dedicated file. It also defines a default operating-system so that the image can be built standalone. * gnu/system/images/hurd.scm: New file, * gnu/local.mk (GNU_SYSTEM_MODULES): add it, * gnu/system/image.scm (root-offset, root-label): Export it, (hurd-disk-image): remove it as this is now defined in the new, Hurd dedicated file above, (find-image): adapt to avoid loop dependency. Mathieu Othacehe