From e3ddd337e08b4815874ea066b643382c76d5413c Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 12 Aug 2015 13:58:38 -0500 Subject: [PATCH] compiler, alien: fix some duplication in ERROR: definitions. hope this doesnt trigger more failing builds than it fixed... --- basis/alien/libraries/libraries.factor | 10 +++------- basis/compiler/errors/errors.factor | 4 ++-- basis/compiler/tests/linkage-errors.factor | 13 +++++-------- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/basis/alien/libraries/libraries.factor b/basis/alien/libraries/libraries.factor index 4d18497243..144cdd5670 100755 --- a/basis/alien/libraries/libraries.factor +++ b/basis/alien/libraries/libraries.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2009, 2010 Slava Pestov, Joe Groff. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors alien alien.strings assocs io.backend -kernel namespaces destructors sequences strings +USING: accessors alien alien.strings assocs compiler.errors +io.backend kernel namespaces destructors sequences strings system io.pathnames fry combinators vocabs ; IN: alien.libraries @@ -27,8 +27,6 @@ TUPLE: library { path string } dll dlerror { abi abi initial: cdecl } ; C: library -ERROR: no-library name ; - : lookup-library ( name -- library ) libraries get at ; : open-dll ( path -- dll dll-error/f ) @@ -80,8 +78,6 @@ M: library dispose dll>> [ dispose ] when* ; : library-abi ( library -- abi ) lookup-library [ abi>> ] [ cdecl ] if* ; -ERROR: no-such-symbol name library ; - : address-of ( name library -- value ) 2dup load-library dlsym-raw [ 2nip ] [ no-such-symbol ] if* ; @@ -92,7 +88,7 @@ deploy-libraries [ V{ } clone ] initialize : deploy-library ( name -- ) dup libraries get key? [ deploy-libraries get 2dup member? [ 2drop ] [ push ] if ] - [ no-library ] if ; + [ "deploy-library failure" no-such-library ] if ; HOOK: >deployed-library-path os ( path -- path' ) diff --git a/basis/compiler/errors/errors.factor b/basis/compiler/errors/errors.factor index 62c83a4601..1409925f9a 100644 --- a/basis/compiler/errors/errors.factor +++ b/basis/compiler/errors/errors.factor @@ -57,13 +57,13 @@ T{ error-type-holder { fatal? f } } define-error-type -TUPLE: no-such-library name message ; +ERROR: no-such-library name message ; M: no-such-library summary drop "Library not found" ; : no-such-library-error ( name message word -- ) \ no-such-library set-linkage-error ; -TUPLE: no-such-symbol name message ; +ERROR: no-such-symbol name message ; M: no-such-symbol summary drop "Symbol not found" ; diff --git a/basis/compiler/tests/linkage-errors.factor b/basis/compiler/tests/linkage-errors.factor index 85b4624df5..001896fd66 100644 --- a/basis/compiler/tests/linkage-errors.factor +++ b/basis/compiler/tests/linkage-errors.factor @@ -13,12 +13,12 @@ FUNCTION: void this_does_not_exist ( ) = ] must-fail-with -[ T{ no-such-symbol { name "this_does_not_exist" } } ] -[ +{ t } [ \ this_does_not_exist linkage-errors get at error>> + [ no-such-symbol? ] [ name>> "this_does_not_exist" = ] bi and ! We don't care about the error message from dlerror, just ! wipe it out - clone f >>message + ! clone f >>message ] unit-test << "no_such_library" "no_such_library" cdecl add-library >> @@ -38,10 +38,7 @@ FUNCTION: void no_such_function ( ) = ] must-fail-with -[ T{ no-such-library { name "no_such_library" } } ] -[ +{ t } [ \ no_such_function linkage-errors get at error>> - ! We don't care about the error message from dlerror, just - ! wipe it out - clone f >>message + [ no-such-library? ] [ name>> "no_such_library" = ] bi and ] unit-test