break statement not within loop or switch

kaffe@rufus.w3.org kaffe@rufus.w3.org
Thu, 23 Jul 1998 18:50:29 +0100




Hello!

While I try to compile latest kaffe-snap on HP-UX 10.20 I get following
error:

make[1]: Entering directory `/home/proski/local/src/kaffe-snap/kaffe'
make[2]: Entering directory
`/home/proski/local/src/kaffe-snap/kaffe/kaffevm'
gcc  -g -O2  -I. -I. -I./../../config -I../../config -I../../include
-I./../../i
nclude -I../../libraries/clib -DINTERPRETER -I./intrp   -DKVER=\"1.00\"  -c
 -fpi
c external.c -o external.o
external.c: In function `loadNativeLibrarySym':
external.c:182: break statement not within loop or switch
make[2]: *** [external.o] Error 1
make[2]: Leaving directory
`/home/proski/local/src/kaffe-snap/kaffe/kaffevm'
make[1]: *** [all] Error 1
make[1]: Leaving directory `/home/proski/local/src/kaffe-snap/kaffe'
make: *** [all] Error 1

The problem is apparently not in kaffe/kaffevm/external.c, but in
kaffe/kaffevm/shlib.h at the line 86, where break is actually used "not
within loop or switch". Possible fix could be:
=========================
--- kaffe-snap/kaffe/kaffevm/slib.h.orig        Tue Mar 31 20:10:54 1998
+++ kaffe-snap/kaffe/kaffevm/slib.h     Thu Jul 23 18:51:38 1998
@@ -82,8 +82,8 @@
 #define        LIBRARYFUNCTION(FUNC, SYM)
\
        {                                                               \
                shl_t all_libs = 0;                                     \
-               if (shl_findsym(&all_libs,SYM,TYPE_PROCEDURE,&FUNC) == 0) {
\
-                       break;                                          \
+               if (!shl_findsym(&all_libs,SYM,TYPE_PROCEDURE,&FUNC))   \
+                       FUNC = 0;
\
                }                                                       \
        }
 #define        LIBRARYHANDLE   shl_t
=========================
man shl_findsym says:
"This routine returns 0 if successful; otherwise -1 is returned."
So, if the symbol is not found, we set FUNC to 0. Other implementations of
LIBRARYFUNCTION do the same thing. Please note that Kaffe doesn't work on
HP-UX now, so I can't test it!

Pavel Roskin
ECsoft
London, UK