stdlib_h.c 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (c) 2004, Bull SA. All rights reserved.
  3. * Created by: Laurent.Vivier@bull.net
  4. * This file is licensed under the GPL license. For the full content
  5. * of this license, see the COPYING file at the top level of this
  6. * source tree.
  7. */
  8. /* test if stdlib.h exists and can be included */
  9. // #define _POSIX_C_SOURCE 200809L
  10. #include <stdlib.h>
  11. #include <sys/time.h>
  12. #ifndef __compar_fn_t_defined
  13. #define __compar_fn_t_defined
  14. typedef int (*__compar_fn_t) (const void *, const void *);
  15. #endif
  16. void (*test_abort)(void);
  17. int (*test_abs)(int);
  18. double (*test_atof)(const char *__nptr);
  19. int (*test_atoi)(const char *__nptr);
  20. long (*test_atol)(const char *__nptr);
  21. long long (*test_atoll)(const char *__nptr);
  22. void * (*test_bsearch)(const void *__key, const void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar);
  23. void * (*test_calloc)(size_t, size_t);
  24. div_t (*test_div)(int __numer, int __denom);
  25. void (*test_free)(void *);
  26. char * (*test_getenv)(const char *__string);
  27. long (*test_labs)(long);
  28. ldiv_t (*test_ldiv)(long __numer, long __denom);
  29. void * (*test_malloc)(size_t);
  30. void (*test_qsort)(void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar);
  31. int (*test_rand)(void);
  32. int (*test_rand_r)(unsigned *__seed);
  33. void * (*test_realloc)(void *, size_t);
  34. int (*test_setenv)(const char *__string, const char *__value, int __overwrite);
  35. void (*test_srand)(unsigned __seed);
  36. double (*test_strtod)(const char *__restrict __n, char **__restrict __end_PTR);
  37. float (*test_strtof)(const char *__restrict __n, char **__restrict __end_PTR);
  38. long (*test_strtol)(const char *__restrict __n, char **__restrict __end_PTR, int __base);
  39. long double (*test_strtold)(const char *__restrict, char **__restrict);
  40. long long (*test_strtoll)(const char *__restrict __n, char **__restrict __end_PTR, int __base);
  41. unsigned long (*test_strtoul)(const char *__restrict __n, char **__restrict __end_PTR, int __base);
  42. unsigned long long (*test_strtoull)(const char *__restrict __n, char **__restrict __end_PTR, int __base);
  43. int (*test_unsetenv)(const char *__string);
  44. __attribute__((unused)) static int test_defined()
  45. {
  46. test_abort = abort;
  47. test_abs = abs;
  48. test_atof = atof;
  49. test_atoi = atoi;
  50. test_atol = atol;
  51. test_atoll = atoll;
  52. test_bsearch = bsearch;
  53. test_calloc = calloc;
  54. test_div = div;
  55. test_free = free;
  56. test_getenv = getenv;
  57. test_labs = labs;
  58. test_ldiv = ldiv;
  59. test_malloc = malloc;
  60. test_qsort = qsort;
  61. test_rand = rand;
  62. // test_rand_r = rand_r;
  63. test_realloc = realloc;
  64. // test_setenv = setenv;
  65. test_srand = srand;
  66. test_strtod = strtod;
  67. test_strtof = strtof;
  68. test_strtol = strtol;
  69. test_strtold = strtold;
  70. test_strtoll = strtoll;
  71. test_strtoul = strtoul;
  72. test_strtoull = strtoull;
  73. // test_unsetenv = unsetenv;
  74. return 0;
  75. }