Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/tls-maxphys]: src/sys/external/bsd/sljit/dist/test_src Compile with WARN...



details:   https://anonhg.NetBSD.org/src/rev/0e7693ecd72c
branches:  tls-maxphys
changeset: 852943:0e7693ecd72c
user:      alnsn <alnsn%NetBSD.org@localhost>
date:      Mon Nov 05 00:18:51 2012 +0000

description:
Compile with WARNS=3.

diffstat:

 sys/external/bsd/sljit/dist/test_src/sljitMain.c |  88 ++++++++++++++++++++++++
 1 files changed, 88 insertions(+), 0 deletions(-)

diffs (92 lines):

diff -r 2359bd0d2c29 -r 0e7693ecd72c sys/external/bsd/sljit/dist/test_src/sljitMain.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/external/bsd/sljit/dist/test_src/sljitMain.c  Mon Nov 05 00:18:51 2012 +0000
@@ -0,0 +1,88 @@
+/*
+ *    Stack-less Just-In-Time compiler
+ *
+ *    Copyright 2009-2010 Zoltan Herczeg (hzmester%freemail.hu@localhost). All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above copyright notice, this list of
+ *      conditions and the following disclaimer.
+ *
+ *   2. Redistributions in binary form must reproduce the above copyright notice, this list
+ *      of conditions and the following disclaimer in the documentation and/or other materials
+ *      provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE COPYRIGHT HOLDER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "sljitLir.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+void sljit_test(void);
+
+#if 0
+void error(SLJIT_CONST char* str)
+{
+       printf("An error occured: %s\n", str);
+       exit(-1);
+}
+
+union executable_code {
+       void* code;
+       sljit_w (SLJIT_CALL *func)(sljit_w* a);
+};
+typedef union executable_code executable_code;
+
+void devel(void)
+{
+       executable_code code;
+
+       struct sljit_compiler *compiler = sljit_create_compiler();
+       sljit_w buf[4];
+
+       if (!compiler)
+               error("Not enough of memory");
+       buf[0] = 5;
+       buf[1] = 12;
+       buf[2] = 0;
+       buf[3] = 0;
+
+#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
+       sljit_compiler_verbose(compiler, stdout);
+#endif
+       sljit_emit_enter(compiler, 1, 4, 5, 2 * sizeof(sljit_w));
+
+       sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
+
+       code.code = sljit_generate_code(compiler);
+       sljit_free_compiler(compiler);
+
+       printf("Code at: %p\n", code.code);
+
+       printf("Function returned with %ld\n", (long)code.func((sljit_w*)buf));
+       printf("buf[0] = %ld\n", (long)buf[0]);
+       printf("buf[1] = %ld\n", (long)buf[1]);
+       printf("buf[2] = %ld\n", (long)buf[2]);
+       printf("buf[3] = %ld\n", (long)buf[3]);
+       sljit_free_code(code.code);
+}
+#endif
+
+int main(int argc, char* argv[])
+{
+       /* devel(); */
+       sljit_test();
+
+       return 0;
+}



Home | Main Index | Thread Index | Old Index