diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2014-04-15 17:09:13 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2014-04-15 17:09:13 +0000 |
commit | 774e30e138dc22a5acd6cfac03ae25194ae8cd6e (patch) | |
tree | 2acda83264153258c7f978efeae08d260598c023 /config | |
parent | 2fc7ac7e8b95a143b6b38eab28622389cc19001b (diff) | |
download | ocaml-774e30e138dc22a5acd6cfac03ae25194ae8cd6e.tar.gz |
PR#6075: avoid using unsafe C library functions (strcpy, strcat, sprintf).
An ISO C99-compliant C compiler and standard library is now assumed.
(Plus special exceptions for MSVC.) In particular, emulation code for
64-bit integer arithmetic was removed, the C compiler must support a
64-bit integer type.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14607 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'config')
-rw-r--r-- | config/auto-aux/int64align.c | 18 | ||||
-rw-r--r-- | config/auto-aux/sizes.c | 5 |
2 files changed, 17 insertions, 6 deletions
diff --git a/config/auto-aux/int64align.c b/config/auto-aux/int64align.c index 9ae8a5bc77..5795e48449 100644 --- a/config/auto-aux/int64align.c +++ b/config/auto-aux/int64align.c @@ -16,9 +16,19 @@ #include <setjmp.h> #include "m.h" -ARCH_INT64_TYPE foo; +#if defined(ARCH_INT64_TYPE) +typedef ARCH_INT64_TYPE int64; +#elif SIZEOF_LONG == 8 +typedef long int64; +#elif SIZEOF_LONGLONG == 8 +typedef long long int64; +#else +#error "No 64-bit integer type available" +#endif + +int64 foo; -void access_int64(ARCH_INT64_TYPE *p) +void access_int64(int64 *p) { foo = *p; } @@ -39,8 +49,8 @@ int main(void) signal(SIGBUS, sig_handler); #endif if(setjmp(failure) == 0) { - access_int64((ARCH_INT64_TYPE *) n); - access_int64((ARCH_INT64_TYPE *) (n+1)); + access_int64((int64 *) n); + access_int64((int64 *) (n+1)); res = 0; } else { res = 1; diff --git a/config/auto-aux/sizes.c b/config/auto-aux/sizes.c index 2700729d44..daa9615d12 100644 --- a/config/auto-aux/sizes.c +++ b/config/auto-aux/sizes.c @@ -15,7 +15,8 @@ int main(int argc, char **argv) { - printf("%d %d %d %d\n", - sizeof(int), sizeof(long), sizeof(long *), sizeof(short)); + printf("%d %d %d %d %d\n", + sizeof(int), sizeof(long), sizeof(long *), sizeof(short), + sizeof(long long)); return 0; } |