Greetings,

I tried to update the Fedora bigloo package to 4.3a once hop was
updated to use the newer version, but the bigloo build failed on
s390x.  We had already blacklisted the big endian ppc64 architecture
for bigloo because of build failures there.  I decided to see if I
could find the problem.  The attached patch gets the build to succeed
on both s390x and big endian ppc64.

The problem is mismatched declarations and definitions, as you can see
by examining the patch.  I don't mean to be critical, but extern
declarations in C files are a terrible idea, for precisely this
reason.  If the declarations and definitions get out of sync, the
compiler can't tell you about it, because it has no way of knowing.
All of those declarations should be in header files that are included
by both the defining code and the consuming code.

Note that the patched code is wrong even for little endian
architectures such as x86.  It just happens to "work" by accident.

Regards,
-- 
Jerry James
http://www.jamezone.org/
--- api/gstreamer/src/Clib/bglgst.c.orig	2017-04-18 01:33:52.000000000 -0600
+++ api/gstreamer/src/Clib/bglgst.c	2017-08-17 20:11:16.869429995 -0600
@@ -1053,7 +1053,7 @@ bgl_gsttag_value_to_obj( const GstTagLis
 	    GDate *date;
 
 	    if( gst_tag_list_get_date( list, tag, &date ) )
-	       return bgl_make_date( 1, 1, 1,
+	       return bgl_make_date( 0, 1, 1, 1,
 				     date->day, date->month, date->year,
 				     0, 0, 0 );
 	    else
--- bde/bmem/lib/alloc.c.orig	2017-04-18 01:33:52.000000000 -0600
+++ bde/bmem/lib/alloc.c	2017-08-17 21:40:37.460948521 -0600
@@ -758,7 +758,7 @@ obj_t ident proto { \
 WRAPPER( string_to_bstring_len, STRING_TYPE_NUM, (char *s, int l), (s ,l) )
 WRAPPER( string_to_bstring, STRING_TYPE_NUM, (char *s), (s) )
 WRAPPER( make_string, STRING_TYPE_NUM, (int l, char c), (l,c)  )
-WRAPPER( make_string_sans_fill, STRING_TYPE_NUM, (int l), (l) )
+WRAPPER( make_string_sans_fill, STRING_TYPE_NUM, (long l), (l) )
 WRAPPER( string_append, STRING_TYPE_NUM, (void *s1, void *s2), (s1, s2) )
 WRAPPER( string_append_3, STRING_TYPE_NUM, (void *s1, void *s2, void *s3), (s1, s2, s3) )
 WRAPPER( c_substring, STRING_TYPE_NUM, (void *s, int l1, int l2), (s, l1, l2) )
@@ -812,7 +812,7 @@ WRAPPER( bgl_host, HOSTENT_TYPE_NUM, (ob
 /* date */
 WRAPPER( bgl_seconds_to_date, DATE_TYPE_NUM, (long s), (s) )
 WRAPPER( bgl_nanoseconds_to_date, DATE_TYPE_NUM, (long s), (s) )
-WRAPPER( bgl_make_date, DATE_TYPE_NUM, (int s, int m, int hr, int mday, int mon, int year, long tz, bool_t istz, int isdst), (s, m, hr, mday, mon, year, tz, istz, isdst) )
+WRAPPER( bgl_make_date, DATE_TYPE_NUM, (BGL_LONGLONG_T ns, int s, int m, int hr, int mday, int mon, int year, long tz, bool_t istz, int isdst), (ns, s, m, hr, mday, mon, year, tz, istz, isdst) )
 WRAPPER( bgl_seconds_format, STRING_TYPE_NUM, (long s, obj_t f), (s, f) )
 
 /* dynamic environment */
--- bde/bmem/lib/bmem.h.orig	2017-04-18 01:33:52.000000000 -0600
+++ bde/bmem/lib/bmem.h	2017-08-17 20:10:11.444600428 -0600
@@ -97,7 +97,7 @@ extern void (*____bgl_init_objects)();
 extern void *(*____string_to_bstring)( char * );
 extern void *(*____string_to_bstring_len)( char *, int );
 extern void *(*____make_string)( int, char );
-extern void *(*____make_string_sans_fill)( int );
+extern void *(*____make_string_sans_fill)( long );
 extern void *(*____string_append)( void *, void * );
 extern void *(*____string_append_3)( void *, void *, void * );
 extern void *(*____c_substring)( void *, int, int );
@@ -153,7 +153,7 @@ extern void *(*____bgl_host )( void * );
 
 extern void *(*____bgl_seconds_to_date )( long );
 extern void *(*____bgl_nanoseconds_to_date )( long );
-extern void *(*____bgl_make_date )( int, int, int, int, int, int, long, int, int );
+extern void *(*____bgl_make_date )( BGL_LONGLONG_T, int, int, int, int, int, int, long, bool_t, int );
 extern void *(*____bgl_seconds_format )( long, void * );
 
 extern void *(*____scheduler_start)( void * );
--- bde/bmem/lib/init.c.orig	2017-04-18 01:33:52.000000000 -0600
+++ bde/bmem/lib/init.c	2017-08-17 20:09:43.116674223 -0600
@@ -63,7 +63,7 @@ void *(*____make_bllong)( BGL_LONGLONG_T
 void *(*____string_to_bstring)( char * ) = 0;
 void *(*____string_to_bstring_len)( char *, int ) = 0;
 void *(*____make_string)( int, char ) = 0;
-void *(*____make_string_sans_fill)( int ) = 0;
+void *(*____make_string_sans_fill)( long ) = 0;
 void *(*____string_append)( void *, void * ) = 0;
 void *(*____string_append_3)( void *, void *, void * ) = 0;
 void *(*____c_substring)( void *, int, int ) = 0;
@@ -138,7 +138,7 @@ void *bgl_socket_accept_symbol, *bgl_soc
 /* date */
 void *(*____bgl_seconds_to_date )( long );
 void *(*____bgl_nanoseconds_to_date )( long );
-void *(*____bgl_make_date )( int, int, int, int, int, int, long, bool_t, int );
+void *(*____bgl_make_date )( BGL_LONGLONG_T, int, int, int, int, int, int, long, bool_t, int );
 void *(*____bgl_seconds_format )( long, void * );
 					   
 /* classes */
@@ -421,7 +421,7 @@ bmem_init_inner() {
    /* date */
    ____bgl_seconds_to_date = (void *(*)( long ))get_function( hdl, "bgl_seconds_to_date" );
    ____bgl_nanoseconds_to_date = (void *(*)( long ))get_function( hdl, "bgl_nanoseconds_to_date" );
-   ____bgl_make_date = (void *(*)( int, int, int, int, int, int, long, bool_t, int ))get_function( hdl, "bgl_make_date" );
+   ____bgl_make_date = (void *(*)( BGL_LONGLONG_T, int, int, int, int, int, int, long, bool_t, int ))get_function( hdl, "bgl_make_date" );
    ____bgl_seconds_format = (void *(*)( long, void * ))get_function( hdl, "bgl_seconds_format" );
 
    /* class */
--- runtime/Clib/callcc.c.orig	2017-04-18 01:33:52.000000000 -0600
+++ runtime/Clib/callcc.c	2017-08-16 20:17:27.973583422 -0600
@@ -24,7 +24,7 @@ extern int flush_regs_in_stack();
 /*---------------------------------------------------------------------*/
 extern long glob_dummy;
 
-extern obj_t make_fx_procedure();
+extern obj_t make_fx_procedure( obj_t (*)(), int, int );
 extern obj_t c_constant_string_to_string( char * );
 
 static obj_t callcc_restore_stack();
--- runtime/Clib/cbinary.c.orig	2017-04-18 01:33:52.000000000 -0600
+++ runtime/Clib/cbinary.c	2017-08-16 20:22:27.612760838 -0600
@@ -50,8 +50,8 @@
 extern obj_t obj_to_string( obj_t, obj_t );
 extern obj_t string_to_obj( obj_t, obj_t, obj_t );
 extern obj_t c_constant_string_to_string( char * );
-extern obj_t make_string_sans_fill( int );
-extern obj_t bgl_string_shrink();
+extern obj_t make_string_sans_fill( long );
+extern obj_t bgl_string_shrink(obj_t, long);
 
 /*---------------------------------------------------------------------*/
 /*    obj_t                                                            */
--- runtime/Clib/ccontrol.c.orig	2017-04-18 01:33:52.000000000 -0600
+++ runtime/Clib/ccontrol.c	2017-08-17 18:00:48.466680487 -0600
@@ -13,7 +13,7 @@
 /*---------------------------------------------------------------------*/
 /*    External definitions.                                            */
 /*---------------------------------------------------------------------*/
-extern obj_t make_string_sans_fill( int );
+extern obj_t make_string_sans_fill( long );
 
 /*---------------------------------------------------------------------*/
 /*    obj_t                                                            */
--- runtime/Clib/cports.c.orig	2017-04-18 07:58:03.442793433 -0600
+++ runtime/Clib/cports.c	2017-08-17 18:00:21.020753088 -0600
@@ -211,7 +211,7 @@ BGL_RUNTIME_DEF long default_io_bufsiz;
 /*---------------------------------------------------------------------*/
 BGL_RUNTIME_DECL obj_t bgl_make_input_port( obj_t, FILE *, obj_t, obj_t );
 extern obj_t make_string( int, unsigned char );
-extern obj_t make_string_sans_fill( int );
+extern obj_t make_string_sans_fill( long );
 
 /*---------------------------------------------------------------------*/
 /*    Prototypes                                                       */
--- runtime/Clib/cprocess.c.orig	2017-04-18 01:33:52.000000000 -0600
+++ runtime/Clib/cprocess.c	2017-08-16 19:48:22.018342783 -0600
@@ -58,7 +58,7 @@ extern long  bgl_list_length( obj_t );
 extern char *bgl_string_to_gc_cstring( obj_t );
 extern obj_t string_to_bstring( char * );
 extern ssize_t bgl_syswrite( obj_t, char *, size_t );
-extern obj_t make_string_sans_fill( int );
+extern obj_t make_string_sans_fill( long );
 
 /*---------------------------------------------------------------------*/
 /*    Prototypes                                                       */
--- runtime/Clib/crgc.c.orig	2017-04-18 01:33:52.000000000 -0600
+++ runtime/Clib/crgc.c	2017-08-16 19:47:29.602478903 -0600
@@ -52,7 +52,7 @@
 extern obj_t bigloo_case_sensitive;
 extern obj_t bgl_string_to_keyword_len( char *, long );
 extern obj_t bgl_string_to_symbol_len( char *, long );
-extern obj_t make_string_sans_fill( int );
+extern obj_t make_string_sans_fill( long );
 extern obj_t string_to_bstring_len( char *, int );
 extern int bgl_debug();
 extern obj_t bgl_escape_C_string( unsigned char *, long, long );
--- runtime/Clib/csocket.c.orig	2017-04-18 01:33:52.000000000 -0600
+++ runtime/Clib/csocket.c	2017-08-16 19:47:05.555541352 -0600
@@ -151,7 +151,7 @@ extern bool_t bigloo_strcmp( obj_t o1, o
 extern bool_t bgl_dns_enable_cache();
 extern long bgl_dns_cache_validity_timeout();
 extern ssize_t bgl_syswrite( obj_t, char *, size_t );
-extern obj_t make_string_sans_fill( int );
+extern obj_t make_string_sans_fill( long );
 
 #ifndef _BGL_WIN32_VER
 extern int dup( int );
--- runtime/Clib/cstring.c.orig	2017-04-18 01:33:52.000000000 -0600
+++ runtime/Clib/cstring.c	2017-08-16 19:15:09.183034824 -0600
@@ -98,7 +98,7 @@ make_string( int len, unsigned char c )
 /*---------------------------------------------------------------------*/
 BGL_RUNTIME_DEF
 obj_t
-make_string_sans_fill( int len ) {
+make_string_sans_fill( long len ) {
    obj_t string = GC_MALLOC_ATOMIC( STRING_SIZE + len );
 
 #if( !defined( TAG_STRING ) )
--- runtime/Ieee/port.scm.orig	2017-04-18 01:33:52.000000000 -0600
+++ runtime/Ieee/port.scm	2017-08-17 17:56:18.284355211 -0600
@@ -117,7 +117,7 @@
 		   "BGL_INPUT_PORT_LENGTH_SET")
 	    (macro c-input-port-last-token-position::elong (::input-port)
 		   "INPUT_PORT_TOKENPOS")
-	    (macro c-input-port-bufsiz::int (::input-port)
+	    (macro c-input-port-bufsiz::long (::input-port)
 		   "BGL_INPUT_PORT_BUFSIZ")
 	    (macro c-closed-input-port?::bool (::obj)
 		   "INPUT_PORT_CLOSEP")
@@ -130,7 +130,7 @@
 	    
 	    ($close-output-port::obj (::output-port) "bgl_close_output_port")
 	    (c-get-output-string::bstring (::output-port)"get_output_string")
-	    (c-default-io-bufsiz::int "default_io_bufsiz")
+	    (c-default-io-bufsiz::long "default_io_bufsiz")
 	    (c-reset-eof::bool (::obj) "reset_eof")
 	    (macro c-flush-output-port::obj (::output-port)
 		   "bgl_flush_output_port")
@@ -272,7 +272,7 @@
 		       "bgl_input_port_seek")
 	       (method static c-set-output-port-position!::obj (::output-port ::long)
 		       "bgl_output_port_seek")
-	       (method static c-input-port-bufsiz::int (::input-port)
+	       (method static c-input-port-bufsiz::long (::input-port)
 		       "bgl_input_port_bufsiz")
 	       
 	       (method static c-closed-input-port?::bool (::input-port)
--- runtime/Include/bigloo.h.orig	2017-04-18 01:33:52.000000000 -0600
+++ runtime/Include/bigloo.h	2017-08-16 19:20:31.534244922 -0600
@@ -2613,7 +2613,7 @@ BGL_RUNTIME_DECL obj_t bgl_display_char(
 BGL_RUNTIME_DECL obj_t bgl_flush_output_port( obj_t );
 BGL_RUNTIME_DECL obj_t bgl_write( obj_t, unsigned char *, size_t );
    
-BGL_RUNTIME_DECL obj_t bgl_make_date();
+BGL_RUNTIME_DECL obj_t bgl_make_date( BGL_LONGLONG_T, int, int, int, int, int, int, long, bool_t, int );
    
 BGL_RUNTIME_DECL obj_t bgl_make_condvar( obj_t );
 BGL_RUNTIME_DECL obj_t bgl_make_mutex( obj_t );
@@ -2640,7 +2640,7 @@ BGL_RUNTIME_DECL obj_t bgl_make_class( o
 				       obj_t, obj_t, obj_t, obj_t, obj_t,
 				       long, obj_t );
 
-BGL_RUNTIME_DECL obj_t bgl_getgroups();
+BGL_RUNTIME_DECL obj_t bgl_getgroups( void );
    
 #if !HAVE_MMAP   
 BGL_RUNTIME_DECL unsigned char bgl_mmap_nommap_ref( obj_t, long );
@@ -2668,7 +2668,7 @@ BGL_RUNTIME_DECL obj_t bgl_make_server_s
 BGL_RUNTIME_DECL obj_t bgl_socket_accept( obj_t, bool_t, obj_t, obj_t );
 BGL_RUNTIME_DECL long bgl_socket_accept_many( obj_t, bool_t, obj_t, obj_t, obj_t );
    
-BGL_RUNTIME_DECL obj_t bgl_gethostname();
+BGL_RUNTIME_DECL obj_t bgl_gethostname( void );
 BGL_RUNTIME_DECL obj_t bgl_socket_hostname( obj_t );
 BGL_RUNTIME_DECL obj_t bgl_datagram_socket_hostname( obj_t );
 BGL_RUNTIME_DECL obj_t bgl_getsockopt( obj_t, obj_t );
@@ -2684,7 +2684,7 @@ BGL_RUNTIME_DECL obj_t bgl_regcomp( obj_
 BGL_RUNTIME_DECL obj_t bgl_regfree( obj_t );
 BGL_RUNTIME_DECL obj_t bgl_regmatch( obj_t, char *, bool_t, int, int );
 
-BGL_RUNTIME_DECL void bgl_restore_signal_handlers();
+BGL_RUNTIME_DECL void bgl_restore_signal_handlers( void );
 extern void bps_bassign(obj_t *field, obj_t value, obj_t obj);
 extern void bps_bmassign(obj_t *field, obj_t value);
 
--- runtime/Include/bigloo_string.h.orig	2017-04-18 01:33:52.000000000 -0600
+++ runtime/Include/bigloo_string.h	2017-08-16 19:13:56.990231034 -0600
@@ -24,7 +24,7 @@ extern "C" {
 /*---------------------------------------------------------------------*/
 /*    extern                                                           */
 /*---------------------------------------------------------------------*/
-BGL_RUNTIME_DECL obj_t make_string_sans_fill();
+BGL_RUNTIME_DECL obj_t make_string_sans_fill( long );
 BGL_RUNTIME_DECL obj_t string_to_bstring( char * );
 BGL_RUNTIME_DECL obj_t string_to_bstring_len( char *, int );
 BGL_RUNTIME_DECL obj_t close_init_string();
--- runtime/objs/obj_s/Ieee/input.c.orig	2017-04-18 01:34:28.000000000 -0600
+++ runtime/objs/obj_s/Ieee/input.c	2017-08-17 17:55:53.445404901 -0600
@@ -189,7 +189,7 @@ extern int rgc_buffer_unget_char(obj_t,
 static obj_t BGl_list4817z00zz__r4_input_6_10_2z00 = BUNSPEC;
 static obj_t BGl_z62portzd2ze3stringzd2listz81zz__r4_input_6_10_2z00(obj_t, obj_t);
 BGL_EXPORTED_DECL obj_t BGl_readzd2charszd2zz__r4_input_6_10_2z00(obj_t, obj_t);
-extern int default_io_bufsiz;
+extern long default_io_bufsiz;
 BGL_EXPORTED_DECL obj_t BGl_readzd2charsz12zc0zz__r4_input_6_10_2z00(obj_t, obj_t, obj_t);
 extern obj_t BGl_bigloozd2typezd2errorz00zz__errorz00(obj_t, obj_t, obj_t);
 static obj_t BGl_z62filezd2ze3stringz53zz__r4_input_6_10_2z00(obj_t, obj_t);
--- runtime/objs/obj_s/Ieee/port.c.orig	2017-04-18 01:34:27.000000000 -0600
+++ runtime/objs/obj_s/Ieee/port.c	2017-08-17 17:56:04.311383514 -0600
@@ -341,7 +341,7 @@ static obj_t BGl_z62inputzd2portzd2fillz
 static obj_t BGl_z62outputzd2stringzd2portzf3z91zz__r4_ports_6_10_1z00(obj_t, obj_t);
 static obj_t BGl_z62withzd2outputzd2tozd2stringzb0zz__r4_ports_6_10_1z00(obj_t, obj_t);
 static obj_t BGl_z62currentzd2outputzd2portz62zz__r4_ports_6_10_1z00(obj_t);
-extern int default_io_bufsiz;
+extern long default_io_bufsiz;
 BGL_EXPORTED_DECL obj_t BGl_openzd2inputzd2czd2stringzd2zz__r4_ports_6_10_1z00(char *);
 static obj_t BGl_z62setzd2inputzd2portzd2positionz12za2zz__r4_ports_6_10_1z00(obj_t, obj_t, obj_t);
 BGL_EXPORTED_DECL obj_t BGl_openzd2outputzd2procedurez00zz__r4_ports_6_10_1z00(obj_t, obj_t, obj_t, obj_t);
--- runtime/objs/obj_u/Ieee/input.c.orig	2017-04-18 01:34:17.000000000 -0600
+++ runtime/objs/obj_u/Ieee/input.c	2017-08-17 17:55:17.648475358 -0600
@@ -183,7 +183,7 @@ extern "C"
 		obj_t);
 	BGL_EXPORTED_DECL obj_t BGl_readzd2charszd2zz__r4_input_6_10_2z00(obj_t,
 		obj_t);
-	extern int default_io_bufsiz;
+	extern long default_io_bufsiz;
 	BGL_EXPORTED_DECL obj_t BGl_readzd2charsz12zc0zz__r4_input_6_10_2z00(obj_t,
 		obj_t, obj_t);
 	extern obj_t BGl_bigloozd2typezd2errorz00zz__errorz00(obj_t, obj_t, obj_t);
--- runtime/objs/obj_u/Ieee/port.c.orig	2017-04-18 01:34:16.000000000 -0600
+++ runtime/objs/obj_u/Ieee/port.c	2017-08-17 17:55:34.920441363 -0600
@@ -557,7 +557,7 @@ extern "C"
 	static obj_t
 		BGl_z62withzd2outputzd2tozd2stringzb0zz__r4_ports_6_10_1z00(obj_t, obj_t);
 	static obj_t BGl_keyword2396z00zz__r4_ports_6_10_1z00 = BUNSPEC;
-	extern int default_io_bufsiz;
+	extern long default_io_bufsiz;
 	BGL_EXPORTED_DECL obj_t
 		BGl_openzd2outputzd2procedurez00zz__r4_ports_6_10_1z00(obj_t, obj_t, obj_t,
 		obj_t);
--- runtime/objs/obj_u/Unsafe/gunzip.c.orig	2017-04-18 01:34:10.000000000 -0600
+++ runtime/objs/obj_u/Unsafe/gunzip.c	2017-08-17 17:54:54.949520035 -0600
@@ -214,7 +214,7 @@ extern "C"
 		obj_t, obj_t, long, obj_t, long, obj_t, obj_t, long, obj_t, obj_t, obj_t,
 		obj_t, obj_t);
 	extern obj_t BGl_readzd2charszd2zz__r4_input_6_10_2z00(obj_t, obj_t);
-	extern int default_io_bufsiz;
+	extern long default_io_bufsiz;
 	extern obj_t BGl_readzd2charsz12zc0zz__r4_input_6_10_2z00(obj_t, obj_t,
 		obj_t);
 	extern bool_t BGl_za7erozf3z54zz__r4_numbers_6_5z00(obj_t);

Reply via email to