diff options
author | Eric Andersen <andersen@codepoet.org> | 2000-10-04 23:26:55 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2000-10-04 23:26:55 +0000 |
commit | eb2ecd0b083611bdd07c5352ffc9cfa22e0de711 (patch) | |
tree | 5e61cf2b2ddc07dd19b577b7bfa3f83b81f7de8a /include | |
parent | 4d6ba4ccf89262743eb2093474a571decb455d27 (diff) |
Fix all the makefiles. Clean up some warnings, cleanup some headers.
-Erik
Diffstat (limited to 'include')
-rw-r--r-- | include/a.out.h | 115 | ||||
-rw-r--r-- | include/alloca.h | 41 | ||||
-rw-r--r-- | include/features.h | 6 | ||||
-rw-r--r-- | include/regex.h | 18 | ||||
-rw-r--r-- | include/stdlib.h | 140 |
5 files changed, 85 insertions, 235 deletions
diff --git a/include/a.out.h b/include/a.out.h deleted file mode 100644 index bd58346c1..000000000 --- a/include/a.out.h +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (C) 1990-1996 - * This file is part of the ld86 command for Linux-86 - * It is distributed under the GNU Library General Public License. - * - * - This may actually be BSD or Minix code, can someone clarify please. -RDB - */ - -#ifndef __AOUT_H -#define __AOUT_H - -struct exec { /* a.out header */ - unsigned char a_magic[2]; /* magic number */ - unsigned char a_flags; /* flags, see below */ - unsigned char a_cpu; /* cpu id */ - unsigned char a_hdrlen; /* length of header */ - unsigned char a_unused; /* reserved for future use */ - unsigned short a_version; /* version stamp (not used at present) */ - long a_text; /* size of text segement in bytes */ - long a_data; /* size of data segment in bytes */ - long a_bss; /* size of bss segment in bytes */ - long a_entry; /* entry point */ - long a_total; /* total memory allocated */ - long a_syms; /* size of symbol table */ - - /* SHORT FORM ENDS HERE */ - long a_trsize; /* text relocation size */ - long a_drsize; /* data relocation size */ - long a_tbase; /* text relocation base */ - long a_dbase; /* data relocation base */ -}; - -#define A_MAGIC0 (unsigned char) 0x01 -#define A_MAGIC1 (unsigned char) 0x03 -#define BADMAG(X) ((X).a_magic[0] != A_MAGIC0 ||(X).a_magic[1] != A_MAGIC1) - -/* CPU Id of TARGET machine (byte order coded in low order two bits) */ -#define A_NONE 0x00 /* unknown */ -#define A_I8086 0x04 /* intel i8086/8088 */ -#define A_M68K 0x0B /* motorola m68000 */ -#define A_NS16K 0x0C /* national semiconductor 16032 */ -#define A_I80386 0x10 /* intel i80386 */ -#define A_SPARC 0x17 /* Sun SPARC */ - -#define A_BLR(cputype) ((cputype&0x01)!=0) /* TRUE if bytes left-to-right */ -#define A_WLR(cputype) ((cputype&0x02)!=0) /* TRUE if words left-to-right */ - -/* Flags. */ -#define A_UZP 0x01 /* unmapped zero page (pages) */ -#define A_PAL 0x02 /* page aligned executable */ -#define A_NSYM 0x04 /* new style symbol table */ -#define A_EXEC 0x10 /* executable */ -#define A_SEP 0x20 /* separate I/D */ -#define A_PURE 0x40 /* pure text */ -#define A_TOVLY 0x80 /* text overlay */ - -/* Offsets of various things. */ -#define A_MINHDR 32 -#define A_TEXTPOS(X) ((long)(X).a_hdrlen) -#define A_DATAPOS(X) (A_TEXTPOS(X) + (X).a_text) -#define A_HASRELS(X) ((X).a_hdrlen > (unsigned char) A_MINHDR) -#define A_HASEXT(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 8)) -#define A_HASLNS(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 16)) -#define A_HASTOFF(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 24)) -#define A_TRELPOS(X) (A_DATAPOS(X) + (X).a_data) -#define A_DRELPOS(X) (A_TRELPOS(X) + (X).a_trsize) -#define A_SYMPOS(X) (A_TRELPOS(X) + (A_HASRELS(X) ? \ - ((X).a_trsize + (X).a_drsize) : 0)) - -struct reloc { - long r_vaddr; /* virtual address of reference */ - unsigned short r_symndx; /* internal segnum or extern symbol num */ - unsigned short r_type; /* relocation type */ -}; - -/* r_tyep values: */ -#define R_ABBS 0 -#define R_RELLBYTE 2 -#define R_PCRBYTE 3 -#define R_RELWORD 4 -#define R_PCRWORD 5 -#define R_RELLONG 6 -#define R_PCRLONG 7 -#define R_REL3BYTE 8 -#define R_KBRANCHE 9 - -/* r_symndx for internal segments */ -#define S_ABS ((unsigned short)-1) -#define S_TEXT ((unsigned short)-2) -#define S_DATA ((unsigned short)-3) -#define S_BSS ((unsigned short)-4) - -struct nlist { /* symbol table entry */ - char n_name[8]; /* symbol name */ - long n_value; /* value */ - unsigned char n_sclass; /* storage class */ - unsigned char n_numaux; /* number of auxiliary entries (not used) */ - unsigned short n_type; /* language base and derived type (not used) */ -}; - -/* Low bits of storage class (section). */ -#define N_SECT 07 /* section mask */ -#define N_UNDF 00 /* undefined */ -#define N_ABS 01 /* absolute */ -#define N_TEXT 02 /* text */ -#define N_DATA 03 /* data */ -#define N_BSS 04 /* bss */ -#define N_COMM 05 /* (common) */ - -/* High bits of storage class. */ -#define N_CLASS 0370 /* storage class mask */ -#define C_NULL -#define C_EXT 0020 /* external symbol */ -#define C_STAT 0030 /* static */ - -#endif /* _AOUT_H */ diff --git a/include/alloca.h b/include/alloca.h deleted file mode 100644 index 741eca743..000000000 --- a/include/alloca.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 1992, 1996, 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _ALLOCA_H -#define _ALLOCA_H 1 - -#include <features.h> - -#define __need_size_t -#include <stddef.h> - -__BEGIN_DECLS - -/* Remove any previous definitions. */ -#undef alloca - -/* Allocate a block that will be freed when the calling function exits. */ -extern __ptr_t alloca __P ((size_t __size)); - -#ifdef __GNUC__ -# define alloca(size) __builtin_alloca (size) -#endif /* GCC. */ - -__END_DECLS - -#endif /* alloca.h */ diff --git a/include/features.h b/include/features.h index d97a1aff2..dd2c5ae03 100644 --- a/include/features.h +++ b/include/features.h @@ -9,6 +9,11 @@ #define __UCLIBC_MAJOR__ 9 #define __UCLIBC_MINOR__ 1 +/* Make a half-hearted attempt to accomodate non-gcc compilers */ +#ifndef __GNUC__ +#define __attribute(foo) /* Ignore */ +#endif + /* __restrict is known in EGCS 1.2 and above. */ #if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 92) # define __restrict /* Ignore */ @@ -49,6 +54,7 @@ #define __USE_POSIX2 #define _POSIX_THREAD_SAFE_FUNCTIONS + #include <sys/cdefs.h> diff --git a/include/regex.h b/include/regex.h index 813882c42..64a8de685 100644 --- a/include/regex.h +++ b/include/regex.h @@ -1568,9 +1568,9 @@ typedef void (*rx_hash_freefn) (); #ifdef __STDC__ -RX_DECL int rx_bitset_is_equal (int size, rx_Bitset a, rx_Bitset b); +//RX_DECL int rx_bitset_is_equal (int size, rx_Bitset a, rx_Bitset b); RX_DECL int rx_bitset_is_subset (int size, rx_Bitset a, rx_Bitset b); -RX_DECL int rx_bitset_empty (int size, rx_Bitset set); +//RX_DECL int rx_bitset_empty (int size, rx_Bitset set); RX_DECL void rx_bitset_null (int size, rx_Bitset b); RX_DECL void rx_bitset_universe (int size, rx_Bitset b); RX_DECL void rx_bitset_complement (int size, rx_Bitset b); @@ -1579,9 +1579,9 @@ RX_DECL void rx_bitset_union (int size, rx_Bitset a, rx_Bitset b); RX_DECL void rx_bitset_intersection (int size, rx_Bitset a, rx_Bitset b); RX_DECL void rx_bitset_difference (int size, rx_Bitset a, rx_Bitset b); -RX_DECL void rx_bitset_revdifference (int size, - rx_Bitset a, rx_Bitset b); -RX_DECL void rx_bitset_xor (int size, rx_Bitset a, rx_Bitset b); +//RX_DECL void rx_bitset_revdifference (int size, +// rx_Bitset a, rx_Bitset b); +//RX_DECL void rx_bitset_xor (int size, rx_Bitset a, rx_Bitset b); RX_DECL unsigned long rx_bitset_hash (int size, rx_Bitset b); RX_DECL struct rx_hash_item * rx_hash_find (struct rx_hash * table, unsigned long hash, @@ -1616,8 +1616,8 @@ RX_DECL struct rexp_node * rx_mk_r_2phase_star (struct rx * rx, struct rexp_node * b); RX_DECL struct rexp_node * rx_mk_r_side_effect (struct rx * rx, rx_side_effect a); -RX_DECL struct rexp_node * rx_mk_r_data (struct rx * rx, - void * a); +//RX_DECL struct rexp_node * rx_mk_r_data (struct rx * rx, +// void * a); RX_DECL void rx_free_rexp (struct rx * rx, struct rexp_node * node); RX_DECL struct rexp_node * rx_copy_rexp (struct rx *rx, struct rexp_node *node); @@ -2803,8 +2803,8 @@ rx_search (rxb, startpos, range, stop, total_size, */ { - struct rx_inx * next_tr_table; - struct rx_inx * this_tr_table; + struct rx_inx * next_tr_table = NULL; + struct rx_inx * this_tr_table = NULL; /* The fastest route through the loop is when the instruction * is RX_NEXT_CHAR. This case is detected when SEARCH_STATE.IFR->DATA diff --git a/include/stdlib.h b/include/stdlib.h index d323d099b..b1ae61d06 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -1,6 +1,7 @@ -/* stdlib.h <ndf@linux.mit.edu> */ +/* stdlib.h */ #include <features.h> #include <sys/types.h> +#include <limits.h> #ifndef __STDLIB_H #define __STDLIB_H @@ -10,102 +11,101 @@ #define NULL ((void *) 0) #endif -/* For program termination */ -#define EXIT_FAILURE 1 -#define EXIT_SUCCESS 0 +/* We define these the same for all machines. + * Changes from this to the outside world should be done in `_exit'. */ +#define EXIT_FAILURE 1 /* Failing exit status. */ +#define EXIT_SUCCESS 0 /* Successful exit status. */ -/* Call all functions registered with `atexit' and `on_exit', - * in the reverse of the order in which they were registered - * perform stdio cleanup, and terminate program execution with STATUS. */ -extern void exit __P ((int __status)) __attribute__ ((__noreturn__)); -/* Register a function to be called when `exit' is called. */ -extern int atexit __P ((void (*__func) (void))); -/* Abort execution and generate a core-dump. */ -extern void abort __P ((void)) __attribute__ ((__noreturn__)); +/* The largest number rand will return */ +#define RAND_MAX INT_MIN -extern void * malloc __P ((size_t)); -extern void * calloc __P ((size_t, size_t)); -extern void free __P ((void *)); -extern void * realloc __P ((void *, size_t)); +/* Maximum length of a multibyte character in the current locale. */ +#define MB_CUR_MAX 1 -#if defined __USE_GNU || defined __USE_BSD || defined __USE_MISC -# include <alloca.h> -#endif /* Use GNU, BSD, or misc. */ +typedef struct +{ + int quot; /* Quotient. */ + int rem; /* Remainder. */ +} div_t; -#ifdef DEBUG_MALLOC +typedef struct +{ + long int quot; /* Quotient. */ + long int rem; /* Remainder. */ +} ldiv_t; -extern void * malloc_dbg __P ((size_t, char* func, char* file, int line)); -extern void * calloc_dbg __P ((size_t, size_t, char* func, char* file, int line)); -extern void free_dbg __P ((void *, char* func, char* file, int line)); -extern void * realloc_dbg __P ((void *, size_t, char* func, char* file, int line)); +/* comparison function used by bsearch() and qsort() */ +typedef int (*__compar_fn_t) __P ((__const __ptr_t, __const __ptr_t)); +typedef __compar_fn_t comparison_fn_t; -#define malloc(x) malloc_dbg((x),__FUNCTION__,__FILE__,__LINE__) -#define calloc(x,y) calloc_dbg((x),(y),__FUNCTION__,__FILE__,__LINE__) -#define free(x) free_dbg((x),__FUNCTION__,__FILE__,__LINE__) -#define realloc(x) realloc((x),__FUNCTION__,__FILE__,__LINE__) +/* String to number conversion functions */ +#define atof(x) strtod((x),(char**)0) +#define atoi(x) (int)strtol((x),(char**)0,10) +#define atol(x) strtol((x),(char**)0,10) +extern long strtol __P ((const char * nptr, char ** endptr, int base)); +extern unsigned long strtoul __P ((const char * nptr, char ** endptr, int base)); +#ifndef __HAS_NO_FLOATS__ +extern char * gcvt __P ((float number, size_t ndigit, char * buf)); +extern float strtod __P ((const char * nptr, char ** endptr)); #endif + + +/* Random number functions */ extern int rand __P ((void)); extern void srand __P ((unsigned int seed)); -extern long strtol __P ((const char * nptr, char ** endptr, int base)); -extern unsigned long strtoul __P ((const char * nptr, - char ** endptr, int base)); -#ifndef __HAS_NO_FLOATS__ -extern float strtod __P ((const char * nptr, char ** endptr)); + +/* Memory management functions */ +extern __ptr_t alloca __P ((size_t __size)); +extern __ptr_t calloc __P ((size_t, size_t)); +extern __ptr_t malloc __P ((size_t)); +extern __ptr_t realloc __P ((__ptr_t, size_t)); +extern void free __P ((__ptr_t)); + +#ifdef DEBUG_MALLOC +extern __ptr_t malloc_dbg __P ((size_t, char* func, char* file, int line)); +extern __ptr_t calloc_dbg __P ((size_t, size_t, char* func, char* file, int line)); +extern void free_dbg __P ((__ptr_t, char* func, char* file, int line)); +extern __ptr_t realloc_dbg __P ((__ptr_t, size_t, char* func, char* file, int line)); +#define malloc(x) malloc_dbg((x),__FUNCTION__,__FILE__,__LINE__) +#define calloc(x,y) calloc_dbg((x),(y),__FUNCTION__,__FILE__,__LINE__) +#define free(x) free_dbg((x),__FUNCTION__,__FILE__,__LINE__) +#define realloc(x) realloc((x),__FUNCTION__,__FILE__,__LINE__) #endif -extern char *getenv __P ((__const char *__name)); -extern int putenv __P ((__const char *__string)); +/* System and environment functions */ +extern void abort __P ((void)) __attribute__ ((__noreturn__)); +extern int atexit __P ((void (*__func) (void))); +extern void exit __P ((int __status)) __attribute__ ((__noreturn__)); +extern void _exit __P ((int __status)) __attribute__ ((__noreturn__)); +extern char *getenv __P ((__const char *__name)); +extern int putenv __P ((__const char *__string)); +extern char *realpath __P ((__const char *__restrict __name, + char *__restrict __resolved)); extern int setenv __P ((__const char *__name, __const char *__value, int __replace)); -extern void unsetenv __P ((__const char *__name)); - extern int system __P ((__const char *__command)); +extern void unsetenv __P ((__const char *__name)); -extern char * gcvt __P ((float number, size_t ndigit, char * buf)); - -#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED -/* Return the canonical absolute name of file NAME. The last file name - * component need not exist, and may be a symlink to a nonexistent file. - * If RESOLVED is null, the result is malloc'd; otherwise, if the canonical - * name is PATH_MAX chars or more, returns null with `errno' set to - * ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars, returns the - * name in RESOLVED. */ -extern char *realpath __P ((__const char *__restrict __name, - char *__restrict __resolved)); -#endif -/* Shorthand for type of comparison functions. */ -typedef int (*__compar_fn_t) __P ((__const __ptr_t, __const __ptr_t)); -typedef __compar_fn_t comparison_fn_t; -/* Sort NMEMB elements of BASE, of SIZE bytes each, - using COMPAR to perform the comparisons. */ +/* Search and sort functions */ +extern __ptr_t bsearch __P ((__const __ptr_t __key, __const __ptr_t __base, + size_t __nmemb, size_t __size, __compar_fn_t __compar)); extern void qsort __P ((__ptr_t __base, size_t __nmemb, size_t __size, __compar_fn_t __compar)); -#define atof(x) strtod((x),(char**)0) -#define atoi(x) (int)strtol((x),(char**)0,10) -#define atol(x) strtol((x),(char**)0,10) -/* Returned by `div'. */ -typedef struct - { - int quot; /* Quotient. */ - int rem; /* Remainder. */ - } div_t; - -/* Returned by `ldiv'. */ -typedef struct - { - long int quot; /* Quotient. */ - long int rem; /* Remainder. */ - } ldiv_t; +/* Integer math functions */ +extern int abs __P ((int __x)) __attribute__ ((__const__)); +extern div_t div __P ((int __numer, int __denom)) __attribute__ ((__const__)); +extern long int labs __P ((long int __x)) __attribute__ ((__const__)); +extern ldiv_t ldiv __P ((long int __numer, long int __denom)) __attribute__ ((__const__)); |