Fix a ton of compiler warnings
This patch fixes most of current reasons to generate compiler warnings.
The changes consist of:
- adding missing casts
- hiding or unhiding function declarations
- including headers where missing
- add __UNCONST when assigning a const char * to a char *
- adding missing return statements
- changing some types from unsigned to signed, as the code seems to want
signed ints
- converting old-style function definitions to current style (i.e.,
void func(param1, param2) short param1, param2; {...} to
void func (short param1, short param2) {...})
- making the compiler silent about signed vs unsigned comparisons. We
have too many of those in the new libc to fix.
A number of bugs in the test set were fixed. These bugs were never
triggered with our old libc. Consequently, these tests are now forced to
link with the new libc or they will generate errors (in particular tests 43
and 55).
Most changes in NetBSD libc are limited to moving aroudn "#ifndef __minix"
or stuff related to Minix-specific things (code in sys-minix or gen/minix).
This commit is contained in:
@@ -45,19 +45,19 @@
|
||||
|
||||
#include <sys/ctype_bits.h>
|
||||
|
||||
#define isdigit(c) ((int)((_ctype_ + 1)[(c)] & _CTYPE_N))
|
||||
#define islower(c) ((int)((_ctype_ + 1)[(c)] & _CTYPE_L))
|
||||
#define isspace(c) ((int)((_ctype_ + 1)[(c)] & _CTYPE_S))
|
||||
#define ispunct(c) ((int)((_ctype_ + 1)[(c)] & _CTYPE_P))
|
||||
#define isupper(c) ((int)((_ctype_ + 1)[(c)] & _CTYPE_U))
|
||||
#define isalpha(c) ((int)((_ctype_ + 1)[(c)] & (_CTYPE_U|_CTYPE_L)))
|
||||
#define isxdigit(c) ((int)((_ctype_ + 1)[(c)] & (_CTYPE_N|_CTYPE_X)))
|
||||
#define isalnum(c) ((int)((_ctype_ + 1)[(c)] & (_CTYPE_U|_CTYPE_L|_CTYPE_N)))
|
||||
#define isprint(c) ((int)((_ctype_ + 1)[(c)] & (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N|_CTYPE_B)))
|
||||
#define isgraph(c) ((int)((_ctype_ + 1)[(c)] & (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N)))
|
||||
#define iscntrl(c) ((int)((_ctype_ + 1)[(c)] & _CTYPE_C))
|
||||
#define tolower(c) ((int)((_tolower_tab_ + 1)[(c)]))
|
||||
#define toupper(c) ((int)((_toupper_tab_ + 1)[(c)]))
|
||||
#define isdigit(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & _CTYPE_N))
|
||||
#define islower(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & _CTYPE_L))
|
||||
#define isspace(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & _CTYPE_S))
|
||||
#define ispunct(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & _CTYPE_P))
|
||||
#define isupper(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & _CTYPE_U))
|
||||
#define isalpha(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & (_CTYPE_U|_CTYPE_L)))
|
||||
#define isxdigit(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & (_CTYPE_N|_CTYPE_X)))
|
||||
#define isalnum(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & (_CTYPE_U|_CTYPE_L|_CTYPE_N)))
|
||||
#define isprint(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N|_CTYPE_B)))
|
||||
#define isgraph(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & (_CTYPE_P|_CTYPE_U|_CTYPE_L|_CTYPE_N)))
|
||||
#define iscntrl(c) ((int)((_ctype_ + 1)[(unsigned char)(c)] & _CTYPE_C))
|
||||
#define tolower(c) ((int)((_tolower_tab_ + 1)[(unsigned char)(c)]))
|
||||
#define toupper(c) ((int)((_toupper_tab_ + 1)[(unsigned char)(c)]))
|
||||
|
||||
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
|
||||
#define isascii(c) ((unsigned)(c) <= 0177)
|
||||
|
||||
@@ -274,6 +274,9 @@ struct cmsghdr {
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
int __cmsg_alignbytes(void);
|
||||
__END_DECLS
|
||||
|
||||
__BEGIN_DECLS
|
||||
int accept(int, struct sockaddr * __restrict, socklen_t * __restrict);
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#define OPEN_MAX __MINIX_OPEN_MAX /* max open files per process */
|
||||
#endif
|
||||
#define PATH_MAX __MINIX_PATH_MAX /* # chars in a path name */
|
||||
#define PIPE_BUF 7168 /* # bytes in atomic write to a pipe */
|
||||
#define PIPE_BUF 32768 /* # bytes in atomic write to a pipe */
|
||||
|
||||
#define BC_BASE_MAX INT_MAX /* max ibase/obase values in bc(1) */
|
||||
#define BC_DIM_MAX 65535 /* max array elements in bc(1) */
|
||||
|
||||
Reference in New Issue
Block a user