def test_structbyval(self):
    self.set_setting('INLINING_LIMIT', 50)
    src = '\n      #include <stdio.h>\n\n      struct point\n      {\n        int x, y;\n      };\n\n      void dump(struct point p) {\n        p.x++; // should not modify\n        p.y++; // anything in the caller!\n        printf("dump: %d,%d\\n", p.x, p.y);\n      }\n\n      void dumpmod(struct point *p) {\n        p->x++; // should not modify\n        p->y++; // anything in the caller!\n        printf("dump: %d,%d\\n", p->x, p->y);\n      }\n\n      int main( int argc, const char *argv[] ) {\n        point p = { 54, 2 };\n        printf("pre:  %d,%d\\n", p.x, p.y);\n        dump(p);\n        void (*dp)(point p) = dump; // And, as a function pointer\n        dp(p);\n        printf("post: %d,%d\\n", p.x, p.y);\n        dumpmod(&p);\n        dumpmod(&p);\n        printf("last: %d,%d\\n", p.x, p.y);\n        return 0;\n      }\n    '
    self.do_run(src, 'pre:  54,2\ndump: 55,3\ndump: 55,3\npost: 54,2\ndump: 55,3\ndump: 56,4\nlast: 56,4')
def test_structbyval(self):
    self.set_setting('INLINING_LIMIT', 50)
    src = '\n      #include <stdio.h>\n\n      struct point\n      {\n        int x, y;\n      };\n\n      void dump(struct point p) {\n        p.x++; // should not modify\n        p.y++; // anything in the caller!\n        printf("dump: %d,%d\\n", p.x, p.y);\n      }\n\n      void dumpmod(struct point *p) {\n        p->x++; // should not modify\n        p->y++; // anything in the caller!\n        printf("dump: %d,%d\\n", p->x, p->y);\n      }\n\n      int main( int argc, const char *argv[] ) {\n        point p = { 54, 2 };\n        printf("pre:  %d,%d\\n", p.x, p.y);\n        dump(p);\n        void (*dp)(point p) = dump; // And, as a function pointer\n        dp(p);\n        printf("post: %d,%d\\n", p.x, p.y);\n        dumpmod(&p);\n        dumpmod(&p);\n        printf("last: %d,%d\\n", p.x, p.y);\n        return 0;\n      }\n    '
    self.do_run(src, 'pre:  54,2\ndump: 55,3\ndump: 55,3\npost: 54,2\ndump: 55,3\ndump: 56,4\nlast: 56,4')