testsuite: add missing prototypes for C functions

In Suse SLES 12, gcc (by default) emits warnings for unprototyped C functions.  In conjunction with -Werror this makes the test suite unusable.

Also: in tests/unboxed-primitive-args/common.ml, fixed what looks like a harmless typo in the declaration of cleanup_float.
master
Xavier Leroy 2015-11-03 11:45:11 +01:00
parent 27c467c777
commit af584b9f1b
6 changed files with 20 additions and 23 deletions

View File

@ -47,9 +47,9 @@ int cmpint(const void * i, const void * j)
int main(int argc, char **argv)
{
#ifdef UNIT_INT
{ extern int FUN();
extern int call_gen_code();
printf("%d\n", call_gen_code(FUN));
{ extern long FUN(void);
extern long call_gen_code(long (*)(void));
printf("%ld\n", call_gen_code(FUN));
}
#else
if (argc < 2) {
@ -57,23 +57,20 @@ int main(int argc, char **argv)
exit(2);
}
#ifdef INT_INT
{ extern int FUN();
extern int call_gen_code();
printf("%d\n", call_gen_code(FUN, atoi(argv[1])));
{ extern long FUN(long);
extern long call_gen_code(long (*)(long), long);
printf("%ld\n", call_gen_code(FUN, atoi(argv[1])));
}
#endif
#ifdef INT_FLOAT
{ extern double FUN();
#ifdef __mc68020__
#define call_gen_code call_gen_code_float
#endif
extern double call_gen_code();
{ extern double FUN(long);
extern double call_gen_code(double (*)(long), long);
printf("%f\n", call_gen_code(FUN, atoi(argv[1])));
}
#endif
#ifdef SORT
{ extern void FUN();
extern void call_gen_code();
{ extern void FUN(long, long, long *);
extern void call_gen_code(void (*)(long, long, long *), long, long, long *);
long n;
long * a, * b;
long i;
@ -100,8 +97,8 @@ int main(int argc, char **argv)
#endif
#endif
#ifdef CHECKBOUND
{ extern void checkbound1(), checkbound2();
extern void call_gen_code();
{ extern void checkbound1(long), checkbound2(long, long);
extern void call_gen_code(void *, ...);
long x, y;
x = atoi(argv[1]);
if (argc >= 3) {

View File

@ -59,8 +59,8 @@ double F, G;
#arg, #res, X, Y, arg, result); \
}
extern void call_gen_code();
extern void testarith();
extern void call_gen_code(void (*)(void));
extern void testarith(void);
void do_test(void)
{

View File

@ -15,7 +15,7 @@
#include "caml/alloc.h"
#include <stdio.h>
value stub1() {
value stub1(void) {
CAMLparam0();
CAMLlocal1(x);
printf("This is stub1!\n"); fflush(stdout);

View File

@ -15,9 +15,9 @@
#include "caml/alloc.h"
#include <stdio.h>
extern value stub1();
extern value stub1(void);
value stub2() {
value stub2(void) {
printf("This is stub2, calling stub1:\n"); fflush(stdout);
stub1();
printf("Ok!\n"); fflush(stdout);

View File

@ -243,7 +243,7 @@ external cleanup_float
-> float -> float -> float -> float -> float -> float -> float -> float
-> float -> float -> float -> float -> float -> float -> float -> float
-> float -> float -> float -> float -> float -> float -> float -> float
-> float = "" "test_cleanup_normal" [@@noalloc] [@@unboxed]
-> float = "" "test_cleanup_float" [@@noalloc] [@@unboxed]
let cleanup_args_and_stack () =
let _ : int =

View File

@ -23,12 +23,12 @@ value test_set_buffers(value v_ocaml_buffer, value v_c_buffer)
return Val_unit;
}
value test_cleanup_normal()
value test_cleanup_normal(void)
{
return Val_int(0);
}
double test_cleanup_float()
double test_cleanup_float(void)
{
return 0.;
}