diff options
author | Akinori Hattori <hattya@gentoo.org> | 2016-11-29 19:17:18 +0900 |
---|---|---|
committer | Akinori Hattori <hattya@gentoo.org> | 2016-11-29 19:17:18 +0900 |
commit | 5d11e566d57fd1102c27a9a7628a6d5b788c050d (patch) | |
tree | 4eb31314d8c451c1532bdd2d29805a7b83290240 /dev-scheme/gauche/files | |
parent | dev-scheme/gauche: fix build (diff) | |
download | gentoo-5d11e566d57fd1102c27a9a7628a6d5b788c050d.tar.gz gentoo-5d11e566d57fd1102c27a9a7628a6d5b788c050d.tar.bz2 gentoo-5d11e566d57fd1102c27a9a7628a6d5b788c050d.zip |
dev-scheme/gauche: fix build
Gentoo-Bug: 600976
Package-Manager: portage-2.3.0
Diffstat (limited to 'dev-scheme/gauche/files')
-rw-r--r-- | dev-scheme/gauche/files/gauche-0.9.5-main.patch | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/dev-scheme/gauche/files/gauche-0.9.5-main.patch b/dev-scheme/gauche/files/gauche-0.9.5-main.patch deleted file mode 100644 index 20f70703552d..000000000000 --- a/dev-scheme/gauche/files/gauche-0.9.5-main.patch +++ /dev/null @@ -1,116 +0,0 @@ -commit 97196adb9dab30e7ab610daf4cc486bfc01ed403 -Author: Shiro Kawai <shiro@acm.org> -Date: Mon Oct 17 11:00:44 2016 -1000 - - Fix main.c to call 'main' proc properly - - https://github.com/shirok/Gauche/issues/244 - -diff --git a/src/core.c b/src/core.c -index 923d116..fc01211 100644 ---- a/src/core.c -+++ b/src/core.c -@@ -653,9 +653,14 @@ void Scm_SimpleMain(int argc, const char *argv[], - ScmModule *user = Scm_UserModule(); - ScmObj mainproc = Scm_GlobalVariableRef(user, SCM_SYMBOL(SCM_INTERN("main")), 0); - if (SCM_PROCEDUREP(mainproc)) { -- ScmObj r = Scm_ApplyRec1(mainproc, args); -- if (SCM_INTP(r)) Scm_Exit(SCM_INT_VALUE(r)); -- else Scm_Exit(70); -+ static ScmObj run_main_proc = SCM_UNDEFINED; -+ SCM_BIND_PROC(run_main_proc, "run-main", Scm_GaucheInternalModule()); -+ SCM_ASSERT(SCM_PROCEDUREP(run_main_proc)); -+ -+ ScmEvalPacket epak; -+ int r = Scm_Apply(run_main_proc, SCM_LIST2(mainproc, args), &epak); -+ SCM_ASSERT(r == 1 && SCM_INTP(epak.results[0])); -+ Scm_Exit(SCM_INT_VALUE(epak.results[0])); - } else { - Scm_Exit(70); - } -diff --git a/src/libeval.scm b/src/libeval.scm -index 2a2c1fc..279fd7f 100644 ---- a/src/libeval.scm -+++ b/src/libeval.scm -@@ -370,6 +370,17 @@ - (loop1))))) - - ;;; -+;;; Kick 'main' procedure -+;;; Returns an integer suitable for the exit code. -+;;; This is mainly to display proper stack trace in case 'main' -+;;; raises an error. -+(select-module gauche.internal) -+(define (run-main main args) -+ (guard (e [else (report-error e) 70]) -+ (let1 r (main args) -+ (if (fixnum? r) r 70)))) -+ -+;;; - ;;; Macros - ;;; - -diff --git a/src/main.c b/src/main.c -index 46223a6..55660c9 100644 ---- a/src/main.c -+++ b/src/main.c -@@ -502,22 +502,14 @@ int execute_script(const char *scriptfile, ScmObj args) - SCM_BINDING_STAY_IN_MODULE); - } - if (SCM_PROCEDUREP(mainproc)) { --#if 0 /* Temporarily turned off due to the bug that loses stack traces. */ -+ static ScmObj run_main_proc = SCM_UNDEFINED; -+ SCM_BIND_PROC(run_main_proc, "run-main", Scm_GaucheInternalModule()); -+ SCM_ASSERT(SCM_PROCEDUREP(run_main_proc)); -+ - ScmEvalPacket epak; -- int r = Scm_Apply(mainproc, SCM_LIST1(args), &epak); -- if (r > 0) { -- ScmObj res = epak.results[0]; -- if (SCM_INTP(res)) return SCM_INT_VALUE(res); -- else return 70; /* EX_SOFTWARE, see SRFI-22. */ -- } else { -- Scm_ReportError(epak.exception); -- return 70; /* EX_SOFTWARE, see SRFI-22. */ -- } --#else -- ScmObj r = Scm_ApplyRec1(mainproc, args); -- if (SCM_INTP(r)) return SCM_INT_VALUE(r); -- else return 70; --#endif -+ int r = Scm_Apply(run_main_proc, SCM_LIST2(mainproc, args), &epak); -+ SCM_ASSERT(r == 1 && SCM_INTP(epak.results[0])); -+ return SCM_INT_VALUE(epak.results[0]); - } - return 0; - } -diff --git a/test/scripts.scm b/test/scripts.scm -index 44bb44b..4e6777b 100644 ---- a/test/scripts.scm -+++ b/test/scripts.scm -@@ -58,6 +58,25 @@ - (process-output->string '("./gosh" "-ftest" "test.o"))) - (delete-files "test.o"))) - -+;; This caused assertion failure in 0.9.5, because 'main' was called -+;; via Scm_ApplyRec without base VM running. -+;; See https://github.com/shirok/Gauche/issues/244 -+(test* "proper error handling of 'main'" "ok" -+ (unwind-protect -+ (begin -+ (delete-files "test.o") -+ (with-output-to-file "test.o" -+ (^[] -+ (write -+ '(use gauche.partcont)) -+ (write -+ '(define (main args) -+ (reset (shift k (call-with-input-file "gauche.h" k))) -+ (print 'ok) -+ 0)))) -+ (process-output->string '("./gosh" "-ftest" "test.o"))) -+ (delete-files "test.o"))) -+ - ;;======================================================================= - (test-section "gauche-config") - |