changes made to enable compilation

This commit is contained in:
ahgamut 2021-10-26 23:45:32 +05:30 committed by Justine Tunney
parent 19f70a154e
commit 7a50dba812
10 changed files with 1171 additions and 33 deletions

View file

@ -208,24 +208,20 @@ fcntl (int fd, int action, /* arg */...)
va_list arg; va_list arg;
int result = -1; int result = -1;
va_start (arg, action); va_start (arg, action);
switch (action) if(action == F_DUPFD)
{
case F_DUPFD:
{ {
int target = va_arg (arg, int); int target = va_arg (arg, int);
result = rpl_fcntl_DUPFD (fd, target); result = rpl_fcntl_DUPFD (fd, target);
break;
} }
case F_DUPFD_CLOEXEC: else if(action == F_DUPFD_CLOEXEC)
{ {
int target = va_arg (arg, int); int target = va_arg (arg, int);
result = rpl_fcntl_DUPFD_CLOEXEC (fd, target); result = rpl_fcntl_DUPFD_CLOEXEC (fd, target);
break;
} }
#if !HAVE_FCNTL #if !HAVE_FCNTL
case F_GETFD: else if(action == F_GETFD)
{ {
# if defined _WIN32 && ! defined __CYGWIN__ # if defined _WIN32 && ! defined __CYGWIN__
HANDLE handle = (HANDLE) _get_osfhandle (fd); HANDLE handle = (HANDLE) _get_osfhandle (fd);
@ -241,7 +237,6 @@ fcntl (int fd, int action, /* arg */...)
if (0 <= dup2 (fd, fd)) if (0 <= dup2 (fd, fd))
result = 0; result = 0;
# endif /* !W32 */ # endif /* !W32 */
break;
} /* F_GETFD */ } /* F_GETFD */
#endif /* !HAVE_FCNTL */ #endif /* !HAVE_FCNTL */
@ -253,9 +248,9 @@ fcntl (int fd, int action, /* arg */...)
using dup2 to move the duplicate onto the original, but that using dup2 to move the duplicate onto the original, but that
is not supported for now. */ is not supported for now. */
default: else
{ {
#if HAVE_FCNTL #if 0
switch (action) switch (action)
{ {
#ifdef F_BARRIERFSYNC /* macOS */ #ifdef F_BARRIERFSYNC /* macOS */
@ -436,8 +431,6 @@ fcntl (int fd, int action, /* arg */...)
#else #else
errno = EINVAL; errno = EINVAL;
#endif #endif
break;
}
} }
va_end (arg); va_end (arg);
return result; return result;

View file

@ -74,7 +74,7 @@
/* A compiler known to have 'bool'. */ /* A compiler known to have 'bool'. */
/* If the compiler already has both 'bool' and '_Bool', we can assume they /* If the compiler already has both 'bool' and '_Bool', we can assume they
are the same types. */ are the same types. */
# if !@HAVE__BOOL@ # if 0
typedef bool _Bool; typedef bool _Bool;
# endif # endif
# else # else
@ -115,7 +115,7 @@ typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
# endif # endif
# endif # endif
# endif # endif
# define bool _Bool // # define bool _Bool
#endif #endif
/* The other macros must be usable in preprocessor directives. */ /* The other macros must be usable in preprocessor directives. */

View file

@ -331,7 +331,7 @@ ar_scan (const char *archive, ar_member_func_t function, const void *varg)
#endif #endif
#ifndef WINDOWS32 #ifndef WINDOWS32
# if !defined (__ANDROID__) && !defined (__BEOS__) # if 0 && !defined (__ANDROID__) && !defined (__BEOS__)
# include <ar.h> # include <ar.h>
# else # else
/* These platforms don't have <ar.h> but have archives in the same format /* These platforms don't have <ar.h> but have archives in the same format

1133
third_party/make/src/config.h vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -19,6 +19,15 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include "filedef.h" #include "filedef.h"
#include "dep.h" #include "dep.h"
#ifndef __ptr_t
#define __ptr_t void*
#endif
#define gl_readdir __dummy2[1]
#define gl_opendir __dummy2[2]
#define gl_closedir __dummy2[0]
#define gl_lstat __dummy2[3]
#define gl_stat __dummy2[4]
#ifdef HAVE_DIRENT_H #ifdef HAVE_DIRENT_H
# include <dirent.h> # include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name) # define NAMLEN(dirent) strlen((dirent)->d_name)

View file

@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>. */ this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _GETOPT_H #ifndef _GETOPT_H
#if 0 && !defined(_GETOPT_H)
#define _GETOPT_H 1 #define _GETOPT_H 1
#ifdef __cplusplus #ifdef __cplusplus
@ -127,4 +128,11 @@ extern int _getopt_internal ();
} }
#endif #endif
#else
extern int _getopt_internal (int argc, char *const *argv,
const char *shortopts,
const struct option *longopts, int *longind,
int long_only);
#endif
#endif /* getopt.h */ #endif /* getopt.h */

View file

@ -2552,12 +2552,10 @@ exec_command (char **argv, char **envp)
# endif /* !__EMX__ */ # endif /* !__EMX__ */
switch (errno)
{ {
case ENOENT: if(errno == ENOENT)
OSS (error, NILF, "%s: %s", argv[0], strerror (errno)); OSS (error, NILF, "%s: %s", argv[0], strerror (errno));
break; else if(errno == ENOEXEC)
case ENOEXEC:
{ {
/* The file was not a program. Try it as a shell script. */ /* The file was not a program. Try it as a shell script. */
const char *shell; const char *shell;
@ -2614,19 +2612,15 @@ exec_command (char **argv, char **envp)
execvp (shell, new_argv); execvp (shell, new_argv);
# endif # endif
OSS (error, NILF, "%s: %s", new_argv[0], strerror (errno)); OSS (error, NILF, "%s: %s", new_argv[0], strerror (errno));
break;
} }
# ifdef __EMX__ # ifdef __EMX__
case EINVAL: else if (errno == EINVAL)
/* this nasty error was driving me nuts :-( */ /* this nasty error was driving me nuts :-( */
O (error, NILF, _("spawnvpe: environment space might be exhausted")); O (error, NILF, _("spawnvpe: environment space might be exhausted"));
/* FALLTHROUGH */ /* FALLTHROUGH */
# endif # endif
default:
OSS (error, NILF, "%s: %s", argv[0], strerror (errno)); OSS (error, NILF, "%s: %s", argv[0], strerror (errno));
break;
} }
# ifdef __EMX__ # ifdef __EMX__
@ -2916,7 +2910,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
instring = word_has_equals = seen_nonequals = last_argument_was_empty = 0; instring = word_has_equals = seen_nonequals = last_argument_was_empty = 0;
for (p = line; *p != '\0'; ++p) for (p = line; *p != '\0'; ++p)
{ {
assert (ap <= end); // assert (ap <= end);
if (instring) if (instring)
{ {

View file

@ -517,7 +517,8 @@ void pfatal_with_name (const char *) NORETURN;
void perror_with_name (const char *, const char *); void perror_with_name (const char *, const char *);
#define xstrlen(_s) ((_s)==NULL ? 0 : strlen (_s)) #define xstrlen(_s) ((_s)==NULL ? 0 : strlen (_s))
void *xmalloc (size_t); void *xmalloc (size_t);
void *xcalloc (size_t); // void *xcalloc (size_t);
#define xcalloc(size) ((xcalloc)(1, (size)))
void *xrealloc (void *, size_t); void *xrealloc (void *, size_t);
char *xstrdup (const char *); char *xstrdup (const char *);
char *xstrndup (const char *, size_t); char *xstrndup (const char *, size_t);

View file

@ -176,7 +176,7 @@ concat (unsigned int num, ...)
/* Like malloc but get fatal error if memory is exhausted. */ /* Like malloc but get fatal error if memory is exhausted. */
/* Don't bother if we're using dmalloc; it provides these for us. */ /* Don't bother if we're using dmalloc; it provides these for us. */
#ifndef HAVE_DMALLOC_H #if 0 && !defined(HAVE_DMALLOC_H)
#undef xmalloc #undef xmalloc
#undef xcalloc #undef xcalloc
@ -204,7 +204,6 @@ xcalloc (size_t size)
return result; return result;
} }
void * void *
xrealloc (void *ptr, size_t size) xrealloc (void *ptr, size_t size)
{ {

View file

@ -27,6 +27,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include "rule.h" #include "rule.h"
#include "debug.h" #include "debug.h"
#include "hash.h" #include "hash.h"
# define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */
#ifdef WINDOWS32 #ifdef WINDOWS32
@ -361,15 +362,15 @@ eval_makefile (const char *filename, unsigned short flags)
deps->error = errno; deps->error = errno;
/* Check for unrecoverable errors: out of mem or FILE slots. */ /* Check for unrecoverable errors: out of mem or FILE slots. */
switch (deps->error)
{ {
if (0 ||
#ifdef EMFILE #ifdef EMFILE
case EMFILE: deps->error == EMFILE ||
#endif #endif
#ifdef ENFILE #ifdef ENFILE
case ENFILE: deps->error == ENFILE ||
#endif #endif
case ENOMEM: deps->error == ENOMEM)
{ {
const char *err = strerror (deps->error); const char *err = strerror (deps->error);
OS (fatal, reading_file, "%s", err); OS (fatal, reading_file, "%s", err);