Ignore:
Timestamp:
May 23, 2007, 7:31:19 AM (18 years ago)
Author:
bird
Message:

Merged with the 2007-05-23 CVS. Added rsort and fixed a couple of windows build issues.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmakenew/make.h

    r803 r903  
    3939#endif
    4040
    41 
    42 /* Use prototypes if available.  */
    43 #if defined (__cplusplus) || defined (__STDC__) || defined WINDOWS32 /* bird: protos on windows */
    44 # undef  PARAMS
    45 # define PARAMS(protos)  protos
    46 #else /* Not C++ or ANSI C.  */
    47 # undef  PARAMS
    48 # define PARAMS(protos)  ()
    49 #endif /* C++ or ANSI C.  */
    5041
    5142/* Specify we want GNU source code.  This must be defined before any
     
    151142# define NEED_GET_PATH_MAX 1
    152143# define GET_PATH_MAX   (get_path_max ())
    153 # define PATH_VAR(var)  char *var = (char *) alloca (GET_PATH_MAX)
    154 extern unsigned int get_path_max PARAMS ((void));
     144# define PATH_VAR(var)  char *var = alloca (GET_PATH_MAX)
     145unsigned int get_path_max (void);
    155146#endif
    156147
     
    228219#  include <stdlib.h>
    229220# else
    230 extern char *malloc PARAMS ((int));
    231 extern char *realloc PARAMS ((char *, int));
    232 extern void free PARAMS ((char *));
    233 
    234 extern void abort PARAMS ((void)) __attribute__ ((noreturn));
    235 extern void exit PARAMS ((int)) __attribute__ ((noreturn));
     221void *malloc (int);
     222void *realloc (void *, int);
     223void free (void *);
     224
     225void abort (void) __attribute__ ((noreturn));
     226void exit (int) __attribute__ ((noreturn));
    236227# endif /* HAVE_STDLIB_H.  */
    237228
     
    243234#endif
    244235#ifndef EXIT_FAILURE
    245 # define EXIT_FAILURE 0
    246 #endif
    247 
    248 #ifdef  ANSI_STRING
    249 
    250 # ifndef bcmp
    251 #  define bcmp(s1, s2, n)   memcmp ((s1), (s2), (n))
    252 # endif
    253 # ifndef bzero
    254 #  define bzero(s, n)       memset ((s), 0, (n))
    255 # endif
    256 # if defined(HAVE_MEMMOVE) && !defined(bcopy)
    257 #  define bcopy(s, d, n)    memmove ((d), (s), (n))
    258 # endif
    259 
    260 #else   /* Not ANSI_STRING.  */
    261 
    262 # ifndef HAVE_STRCHR
    263 #  define strchr(s, c)      index((s), (c))
    264 #  define strrchr(s, c)     rindex((s), (c))
    265 # endif
    266 
    267 # ifndef bcmp
    268 extern int bcmp PARAMS ((const char *, const char *, int));
    269 # endif
    270 # ifndef bzero
    271 extern void bzero PARAMS ((char *, int));
    272 #endif
    273 # ifndef bcopy
    274 extern void bcopy PARAMS ((const char *b1, char *b2, int));
    275 # endif
     236# define EXIT_FAILURE 1
     237#endif
     238
     239#ifndef  ANSI_STRING
    276240
    277241/* SCO Xenix has a buggy macro definition in <string.h>.  */
    278242#undef  strerror
    279243#if !defined(__DECC)
    280 extern char *strerror PARAMS ((int errnum));
     244char *strerror (int errnum);
    281245#endif
    282246
     
    290254
    291255#if !defined(HAVE_STRSIGNAL)
    292 extern char *strsignal PARAMS ((int signum));
     256char *strsignal (int signum);
    293257#endif
    294258
     
    309273    (*(a) == *(b) && (*(a) == '\0' || !strcmp ((a) + 1, (b) + 1))))
    310274# ifdef HAVE_CASE_INSENSITIVE_FS
    311 /* This is only used on Windows/DOS platforms, so we assume strcmpi().  */
    312275#  define strieq(a, b) \
    313276    ((a) == (b) \
    314277     || (tolower((unsigned char)*(a)) == tolower((unsigned char)*(b)) \
    315          && (*(a) == '\0' || !strcmpi ((a) + 1, (b) + 1))))
     278         && (*(a) == '\0' || !strcasecmp ((a) + 1, (b) + 1))))
    316279# else
    317280#  define strieq(a, b) streq(a, b)
     
    323286#endif
    324287#define strneq(a, b, l) (strncmp ((a), (b), (l)) == 0)
    325 #ifdef  VMS
    326 extern int strcmpi (const char *,const char *);
    327 #endif
    328288
    329289#if defined(__GNUC__) || defined(ENUM_BITFIELDS)
     
    348308
    349309/* Handle other OSs.  */
    350 #if defined(HAVE_DOS_PATHS)
    351 # define PATH_SEPARATOR_CHAR ';'
    352 #elif defined(VMS)
    353 # define PATH_SEPARATOR_CHAR ','
    354 #else
    355 # define PATH_SEPARATOR_CHAR ':'
    356 #endif
    357 
    358 /* This is needed for getcwd() and chdir().  */
    359 #if defined(_MSC_VER) || defined(__BORLANDC__)
     310#ifndef PATH_SEPARATOR_CHAR
     311# if defined(HAVE_DOS_PATHS)
     312#  define PATH_SEPARATOR_CHAR ';'
     313# elif defined(VMS)
     314#  define PATH_SEPARATOR_CHAR ','
     315# else
     316#  define PATH_SEPARATOR_CHAR ':'
     317# endif
     318#endif
     319
     320/* This is needed for getcwd() and chdir(), on some W32 systems.  */
     321#if defined(HAVE_DIRECT_H)
    360322# include <direct.h>
    361323#endif
     
    364326# include <fcntl.h>
    365327# include <malloc.h>
    366 # define pipe(p) _pipe(p, 512, O_BINARY)
    367 # define kill(pid,sig) w32_kill(pid,sig)
    368 
    369 extern void sync_Path_environment(void);
    370 extern int kill(int pid, int sig);
    371 extern char *end_of_token_w32(char *s, char stopchar);
    372 extern int find_and_set_default_shell(char *token);
     328# define pipe(_p)        _pipe((_p), 512, O_BINARY)
     329# define kill(_pid,_sig) w32_kill((_pid),(_sig))
     330
     331void sync_Path_environment (void);
     332int w32_kill (int pid, int sig); /* bird kill -> w32_kill - macro acquired () on the args. */
     333char *end_of_token_w32 (const char *s, char stopchar);
     334int find_and_set_default_shell (const char *token);
    373335
    374336/* indicates whether or not we have Bourne shell */
     
    400362
    401363#if HAVE_ANSI_COMPILER && USE_VARIADIC && HAVE_STDARG_H
    402 extern void message (int prefix, const char *fmt, ...)
    403                      __attribute__ ((__format__ (__printf__, 2, 3)));
    404 extern void error (const struct floc *flocp, const char *fmt, ...)
    405                    __attribute__ ((__format__ (__printf__, 2, 3)));
    406 extern void fatal (const struct floc *flocp, const char *fmt, ...)
     364void message (int prefix, const char *fmt, ...)
     365              __attribute__ ((__format__ (__printf__, 2, 3)));
     366void error (const struct floc *flocp, const char *fmt, ...)
     367            __attribute__ ((__format__ (__printf__, 2, 3)));
     368void fatal (const struct floc *flocp, const char *fmt, ...)
    407369                   __attribute__ ((noreturn, __format__ (__printf__, 2, 3)));
    408370#else
    409 extern void message ();
    410 extern void error ();
    411 extern void fatal ();
    412 #endif
    413 
    414 extern void die PARAMS ((int)) __attribute__ ((noreturn));
    415 extern void log_working_directory PARAMS ((int));
    416 extern void pfatal_with_name PARAMS ((const char *)) __attribute__ ((noreturn));
    417 extern void perror_with_name PARAMS ((const char *, const char *));
    418 extern char *savestring PARAMS ((const char *, unsigned int));
    419 extern char *concat PARAMS ((const char *, const char *, const char *));
    420 extern char *xmalloc PARAMS ((unsigned int));
    421 extern char *xrealloc PARAMS ((char *, unsigned int));
    422 extern char *xstrdup PARAMS ((const char *));
    423 extern char *find_next_token PARAMS ((char **, unsigned int *));
    424 extern char *next_token PARAMS ((const char *));
    425 extern char *end_of_token PARAMS ((const char *));
    426 extern void collapse_continuations PARAMS ((char *));
     371void message ();
     372void error ();
     373void fatal ();
     374#endif
     375
     376void die (int) __attribute__ ((noreturn));
     377void log_working_directory (int);
     378void pfatal_with_name (const char *) __attribute__ ((noreturn));
     379void perror_with_name (const char *, const char *);
     380char *savestring (const char *, unsigned int);
     381char *concat (const char *, const char *, const char *);
     382void *xmalloc (unsigned int);
     383void *xrealloc (void *, unsigned int);
     384char *xstrdup (const char *);
     385char *find_next_token (const char **, unsigned int *);
     386char *next_token (const char *);
     387char *end_of_token (const char *);
     388void collapse_continuations (char *);
    427389#ifdef CONFIG_WITH_OPTIMIZATION_HACKS /* memchr is usually compiler intrinsic, thus faster. */
    428 #define lindex(s, limit, c) ((char *)memchr((s), (c), (limit) - (s)))
    429 #else
    430 extern char *lindex PARAMS ((const char *, const char *, int));
    431 #endif
    432 extern int alpha_compare PARAMS ((const void *, const void *));
    433 extern void print_spaces PARAMS ((unsigned int));
    434 extern char *find_percent PARAMS ((char *));
    435 extern FILE *open_tmpfile PARAMS ((char **, const char *));
     390# define lindex(s, limit, c) ((char *)memchr((s), (c), (limit) - (s)))
     391#else
     392char *lindex (const char *, const char *, int);
     393#endif
     394int alpha_compare (const void *, const void *);
     395void print_spaces (unsigned int);
     396char *find_percent (char *);
     397const char *find_percent_cached (const char **);
     398FILE *open_tmpfile (char **, const char *);
    436399
    437400#ifndef NO_ARCHIVES
    438 extern int ar_name PARAMS ((char *));
    439 extern void ar_parse_name PARAMS ((char *, char **, char **));
    440 extern int ar_touch PARAMS ((char *));
    441 extern time_t ar_member_date PARAMS ((char *));
    442 #endif
    443 
    444 extern int dir_file_exists_p PARAMS ((char *, char *));
    445 extern int file_exists_p PARAMS ((char *));
    446 extern int file_impossible_p PARAMS ((char *));
    447 extern void file_impossible PARAMS ((char *));
    448 extern char *dir_name PARAMS ((char *));
    449 extern void hash_init_directories PARAMS ((void));
    450 
    451 extern void define_default_variables PARAMS ((void));
    452 extern void set_default_suffixes PARAMS ((void));
    453 extern void install_default_suffix_rules PARAMS ((void));
    454 extern void install_default_implicit_rules PARAMS ((void));
    455 
    456 extern void build_vpath_lists PARAMS ((void));
    457 extern void construct_vpath_list PARAMS ((char *pattern, char *dirpath));
    458 extern int vpath_search PARAMS ((char **file, FILE_TIMESTAMP *mtime_ptr));
    459 extern int gpath_search PARAMS ((char *file, unsigned int len));
    460 
    461 extern void construct_include_path PARAMS ((char **arg_dirs));
    462 
    463 extern void user_access PARAMS ((void));
    464 extern void make_access PARAMS ((void));
    465 extern void child_access PARAMS ((void));
    466 
    467 extern void close_stdout PARAMS ((void));
    468 
    469 extern char *strip_whitespace PARAMS ((const char **begpp, const char **endpp));
     401int ar_name (const char *);
     402void ar_parse_name (const char *, char **, char **);
     403int ar_touch (const char *);
     404time_t ar_member_date (const char *);
     405
     406typedef long int (*ar_member_func_t) (int desc, const char *mem, int truncated,
     407                                      long int hdrpos, long int datapos,
     408                                      long int size, long int date, int uid,
     409                                      int gid, int mode, const void *arg);
     410
     411long int ar_scan (const char *archive, ar_member_func_t function, const void *arg);
     412int ar_name_equal (const char *name, const char *mem, int truncated);
     413#ifndef VMS
     414int ar_member_touch (const char *arname, const char *memname);
     415#endif
     416#endif
     417
     418int dir_file_exists_p (const char *, const char *);
     419int file_exists_p (const char *);
     420int file_impossible_p (const char *);
     421void file_impossible (const char *);
     422const char *dir_name (const char *);
     423void hash_init_directories (void);
     424
     425void define_default_variables (void);
     426void set_default_suffixes (void);
     427void install_default_suffix_rules (void);
     428void install_default_implicit_rules (void);
     429
     430void build_vpath_lists (void);
     431void construct_vpath_list (char *pattern, char *dirpath);
     432const char *vpath_search (const char *file, FILE_TIMESTAMP *mtime_ptr);
     433int gpath_search (const char *file, unsigned int len);
     434
     435void construct_include_path (const char **arg_dirs);
     436
     437void user_access (void);
     438void make_access (void);
     439void child_access (void);
     440
     441void close_stdout (void);
     442
     443char *strip_whitespace (const char **begpp, const char **endpp);
    470444
    471445/* String caching  */
    472 extern void strcache_init PARAMS ((void));
    473 extern void strcache_print_stats PARAMS ((const char *prefix));
    474 extern int strcache_iscached PARAMS ((const char *str));
    475 extern const char *strcache_add PARAMS ((const char *str));
    476 extern const char *strcache_add_len PARAMS ((const char *str, int len));
    477 extern int strcache_setbufsize PARAMS ((int size));
     446void strcache_init (void);
     447void strcache_print_stats (const char *prefix);
     448int strcache_iscached (const char *str);
     449const char *strcache_add (const char *str);
     450const char *strcache_add_len (const char *str, int len);
     451int strcache_setbufsize (int size);
    478452
    479453#ifdef  HAVE_VFORK_H
     
    486460#if !defined (__GNU_LIBRARY__) && !defined (POSIX) && !defined (_POSIX_VERSION) && !defined(WINDOWS32)
    487461
    488 extern long int atol ();
     462long int atol ();
    489463# ifndef VMS
    490 extern long int lseek ();
     464long int lseek ();
    491465# endif
    492466
     
    494468
    495469#ifdef  HAVE_GETCWD
    496 # if !defined(VMS) && !defined(__DECC) && !defined(_MSC_VER)
    497 extern char *getcwd ();
    498 # endif
    499 #else
    500 extern char *getwd ();
     470# if !defined(VMS) && !defined(__DECC) && !defined(_MSC_VER) /* bird: MSC */
     471char *getcwd ();
     472# endif
     473#else
     474char *getwd ();
    501475# define getcwd(buf, len)       getwd (buf)
     476#endif
     477
     478#if !HAVE_STRCASECMP
     479# if HAVE_STRICMP
     480#  define strcasecmp stricmp
     481# elif HAVE_STRCMPI
     482#  define strcasecmp strcmpi
     483# else
     484/* Create our own, in misc.c */
     485int strcasecmp (const char *s1, const char *s2);
     486# endif
    502487#endif
    503488
     
    505490extern const struct floc **expanding_var;
    506491
    507 #if !defined(_MSC_VER)
     492#if !defined(_MSC_VER) /* bird */
    508493extern char **environ;
    509494#endif
     
    522507extern int batch_mode_shell;
    523508
     509extern char cmd_prefix;
     510
    524511extern unsigned int job_slots;
    525512extern int job_fds[2];
     
    573560#endif
    574561
    575 
    576562#ifdef __EMX__
    577 # if !HAVE_STRCASECMP
    578 #  define strcasecmp stricmp
    579 # endif
    580 
    581563# if !defined chdir
    582564#  define chdir _chdir2
     
    617599   to do it ourselves here.  */
    618600
    619 #define ENULLLOOP(_v,_c)   do{ errno = 0; \
    620                                while (((_v)=_c)==0 && errno==EINTR); }while(0)
     601#define ENULLLOOP(_v,_c)   do { errno = 0; (_v) = _c; } \
     602                           while((_v)==0 && errno==EINTR)
     603
    621604
    622605#if defined(__EMX__) && defined(CONFIG_WITH_OPTIMIZATION_HACKS) /* bird: saves 40-100ms on libc. */
Note: See TracChangeset for help on using the changeset viewer.