From f252c29710f71e7c260d9e866c8d4eef885705c3 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 2 Sep 2015 19:45:09 +0200 Subject: fix some warnings and errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- include/bits/types.h | 12 ++++++++++++ include/inttypes.h | 3 ++- include/stdlib.h | 17 ++++++++++++++--- include/string.h | 3 +-- 4 files changed, 29 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/bits/types.h b/include/bits/types.h index 5d99e4f..83087b5 100644 --- a/include/bits/types.h +++ b/include/bits/types.h @@ -362,3 +362,15 @@ typedef struct { } imaxdiv_t; #endif + +/** + * Locale datatype. + */ +#if defined(__NEED_locale_t) && !defined(__DEFINED_locale_t) +# define __DEFINED_locale_t +typedef struct __locale locale_t; /* TODO not implemented */ +#endif +#ifndef __INTMAX_MAX +# define __INTMAX_MAX INT64_MAX +#endif + diff --git a/include/inttypes.h b/include/inttypes.h index dac5e27..3f24e9b 100644 --- a/include/inttypes.h +++ b/include/inttypes.h @@ -37,7 +37,8 @@ * @return The quotient in `.quot`, and * the remainder in `.rem`. */ -imaxdiv_t imaxdiv(intmax_t, intmax_t); +imaxdiv_t imaxdiv(intmax_t, intmax_t) + __GCC_ONLY(__attribute__((const))); diff --git a/include/stdlib.h b/include/stdlib.h index fd78d27..9340201 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -65,7 +65,8 @@ * @return The quotient in `.quot`, and * the remainder in `.rem`. */ -div_t div(int, int); +div_t div(int, int) + __GCC_ONLY(__attribute__((const))); /** * Perform an integer division and return @@ -76,7 +77,8 @@ div_t div(int, int); * @return The quotient in `.quot`, and * the remainder in `.rem`. */ -ldiv_t ldiv(long, long); +ldiv_t ldiv(long, long) + __GCC_ONLY(__attribute__((const))); /** * Perform an integer division and return @@ -87,7 +89,16 @@ ldiv_t ldiv(long, long); * @return The quotient in `.quot`, and * the remainder in `.rem`. */ -lldiv_t lldiv(long long, long long); +lldiv_t lldiv(long long, long long) + __GCC_ONLY(__attribute__((const))); + + + +/* TODO implement rand-functions */ +#define RAND_MAX 1 +int rand(void); +int rand_r(unsigned int* seed); +void srand(unsigned int seed); diff --git a/include/string.h b/include/string.h index 483b49b..53aaca6 100644 --- a/include/string.h +++ b/include/string.h @@ -31,8 +31,7 @@ #define __NEED_size_t -#define __NEED_locale_t /* TODO not defined */ - +#define __NEED_locale_t #include -- cgit v1.2.3-70-g09d2