From 37e4fc9ceea84fc2b643adb7d83774ed9d5ce7d2 Mon Sep 17 00:00:00 2001 From: Erwin Janssen Date: Mon, 31 Oct 2016 14:36:47 +0100 Subject: [PATCH] Remove all usage of _PACKAGE_ast and PACKAGE_ast These two defines are never set in the configuration or code. Manually setting them causes the build to fail. Therefore all usage of these defines can be removed. --- cmd/lefty/common.h | 5 ---- cmd/lefty/dot2l/dotparse.y | 3 --- cmd/lefty/internal.c | 17 -------------- lib/cgraph/cgraph.h | 16 ------------- lib/neatogen/matinv.c | 4 ---- lib/sfio/sfexit.c | 5 ---- lib/sfio/sfhdr.h | 35 +--------------------------- lib/sfio/sfio.h | 5 ---- lib/sfio/sfmode.c | 12 ---------- lib/sfio/sfpkrd.c | 2 -- lib/sfio/sfpopen.c | 47 -------------------------------------- lib/sfio/sftmp.c | 12 ---------- lib/sfio/vthread.h | 6 ----- lib/vmalloc/malloc.c | 4 ---- lib/vmalloc/vmalloc.h | 4 ---- lib/vmalloc/vmexit.c | 4 ++-- lib/vmalloc/vmhdr.h | 26 --------------------- 17 files changed, 3 insertions(+), 204 deletions(-) diff --git a/cmd/lefty/common.h b/cmd/lefty/common.h index aafe68c63..7d34fd981 100644 --- a/cmd/lefty/common.h +++ b/cmd/lefty/common.h @@ -39,10 +39,6 @@ extern "C" { #define FEATURE_X11 1 #endif -#ifdef _PACKAGE_ast -#include -#define HAVE_STRERROR 1 -#else #include #include #include @@ -55,7 +51,6 @@ extern "C" { #ifdef HAVE_SYS_SELECT_H #include #endif -#endif #include #include diff --git a/cmd/lefty/dot2l/dotparse.y b/cmd/lefty/dot2l/dotparse.y index 38fa60a28..31a651b77 100644 --- a/cmd/lefty/dot2l/dotparse.y +++ b/cmd/lefty/dot2l/dotparse.y @@ -12,9 +12,6 @@ *************************************************************************/ %{ -#if defined(_PACKAGE_ast) -#include -#endif #include typedef void *Tobj; diff --git a/cmd/lefty/internal.c b/cmd/lefty/internal.c index 770317478..497412544 100644 --- a/cmd/lefty/internal.c +++ b/cmd/lefty/internal.c @@ -75,9 +75,6 @@ int Iparsegraphlabel (int, Tonm_t *); int Ireadgraph (int, Tonm_t *); int Iwritegraph (int, Tonm_t *); #endif -#ifdef _PACKAGE_ast -int Imatch (int, Tonm_t *); -#endif #ifdef FEATURE_CS int C2Lreadcsmessage (int, Tonm_t *); #endif @@ -151,9 +148,6 @@ Ifunc_t Ifuncs[] = { { "readgraph", Ireadgraph, 1, 2 }, { "writegraph", Iwritegraph, 3, 3 }, #endif -#ifdef _PACKAGE_ast - { "match", Imatch, 2, 2 }, -#endif #ifdef FEATURE_CS { "readcsmessage", C2Lreadcsmessage, 1, 1 }, #endif @@ -827,17 +821,6 @@ int Iwritegraph (int argc, lvar_t *argv) { } #endif -#ifdef _PACKAGE_ast -/* ast related functions */ - -int Imatch (int argc, lvar_t *argv) { - if (!T_ISSTRING (argv[0].o) || !T_ISSTRING (argv[1].o)) - return L_FAILURE; - rtno = Tinteger (strmatch (Tgetstring (argv[0].o), Tgetstring (argv[1].o))); - return L_SUCCESS; -} -#endif - static void growbufp (int newsize) { if (!(bufp = realloc ( bufp, ((newsize + BUFINCR - 1) / BUFINCR) * BUFINCR * BUFSIZE diff --git a/lib/cgraph/cgraph.h b/lib/cgraph/cgraph.h index 23376229f..bb3ddffaf 100644 --- a/lib/cgraph/cgraph.h +++ b/lib/cgraph/cgraph.h @@ -245,17 +245,6 @@ struct Agraph_s { Agclos_t *clos; /* shared resources */ }; - -#if defined(_PACKAGE_ast) -/* fine control of object callbacks */ -# if defined(_BLD_cgraph) && defined(__EXPORT__) -# define extern __EXPORT__ -# endif -# if !defined(_BLD_cgraph) && defined(__IMPORT__) -# define extern __IMPORT__ -# endif -#endif - extern void agpushdisc(Agraph_t * g, Agcbdisc_t * disc, void *state); extern int agpopdisc(Agraph_t * g, Agcbdisc_t * disc); extern int agcallbacks(Agraph_t * g, int flag); /* return prev value */ @@ -418,11 +407,6 @@ extern agusererrf agseterrf(agusererrf); #define TAILPORT_ID "tailport" #define HEADPORT_ID "headport" -#if defined(_PACKAGE_ast) -# if !defined(_BLD_cgraph) && defined(__IMPORT__) -# define extern __IMPORT__ -# endif -#endif #if defined(_MSC_VER) && !defined(CGRAPH_EXPORTS) #define extern __declspec(dllimport) #endif diff --git a/lib/neatogen/matinv.c b/lib/neatogen/matinv.c index 0f3bf1f01..35b56df2a 100644 --- a/lib/neatogen/matinv.c +++ b/lib/neatogen/matinv.c @@ -34,10 +34,6 @@ * n - the order of the matrices A and Ainv */ -#if defined(_PACKAGE_ast) -#include -#else -#endif #include #include "render.h" extern int lu_decompose(double **a, int n); diff --git a/lib/sfio/sfexit.c b/lib/sfio/sfexit.c index b7678f72b..0be4d1a28 100644 --- a/lib/sfio/sfexit.c +++ b/lib/sfio/sfexit.c @@ -18,10 +18,6 @@ ** Written by Kiem-Phong Vo */ -#if PACKAGE_ast -int _AST_already_has_them; -#else - #if !_lib_atexit #if _lib_onexit @@ -158,5 +154,4 @@ waitpid(int pid, int *status, int options) #endif /*_lib_waitpid*/ -#endif /*!PACKAGE_ast */ #endif diff --git a/lib/sfio/sfhdr.h b/lib/sfio/sfhdr.h index 7aca87afb..02d6db375 100644 --- a/lib/sfio/sfhdr.h +++ b/lib/sfio/sfhdr.h @@ -33,24 +33,6 @@ extern "C" { /* note that the macro vt_threaded has effect on vthread.h */ #include -/* file system info */ -#if defined(_PACKAGE_ast) - -#include -#include -#include -#include - -#if _mem_st_blksize_stat -#define _stat_blksize 1 -#endif - -#if _lib_localeconv && _hdr_locale -#define _lib_locale 1 -#endif - -#else /*!defined(_PACKAGE_ast) */ - #if defined(__mips) && __mips == 2 && !defined(_NO_LARGEFILE64_SOURCE) #define _NO_LARGEFILE64_SOURCE 1 #endif @@ -124,8 +106,6 @@ extern "C" { #include #endif -#endif /*defined(_PACKAGE_ast)*/ - #include #include @@ -379,7 +359,7 @@ extern "C" { #define ESPIPE 29 #endif /* see if we can use memory mapping for io */ -#if !defined(_PACKAGE_ast) && defined(_mmap_worthy) +#if defined(_mmap_worthy) # ifdef _LARGEFILE64_SOURCE # undef mmap # endif @@ -740,13 +720,8 @@ extern "C" { #define SF_RADIX 64 /* maximum integer conversion base */ -#if defined(_PACKAGE_ast) -#define SF_MAXINT INT_MAX -#define SF_MAXLONG LONG_MAX -#else #define SF_MAXINT ((int)(((uint)~0) >> 1)) #define SF_MAXLONG ((long)(((ulong)~0L) >> 1)) -#endif #define SF_MAXCHAR ((uchar)(~0)) @@ -844,9 +819,6 @@ extern "C" { #define max(x,y) ((x) > (y) ? (x) : (y)) /* fast functions for memory copy and memory clear */ -#if defined(_PACKAGE_ast) -#define memclear(s,n) memzero(s,n) -#else #if _lib_bcopy && !_lib_memcpy #define memcpy(to,fr,n) bcopy((fr),(to),(n)) #endif @@ -855,7 +827,6 @@ extern "C" { #else #define memclear(s,n) memset((s),'\0',(n)) #endif -#endif /*defined(_PACKAGE_ast)*/ /* note that MEMCPY advances the associated pointers */ #define MEMCPY(to,fr,n) \ @@ -916,8 +887,6 @@ extern "C" { extern int munmap(void *, size_t); #endif -#if !defined(_PACKAGE_ast) - #ifdef WIN32 #undef SF_ERROR #include @@ -981,8 +950,6 @@ extern "C" { extern int open(const char *, int, ...); #endif -#endif /* defined(_PACKAGE_ast) */ - #endif /*_SFHDR_H*/ #ifdef __cplusplus } diff --git a/lib/sfio/sfio.h b/lib/sfio/sfio.h index ddd766656..fe2ac1884 100644 --- a/lib/sfio/sfio.h +++ b/lib/sfio/sfio.h @@ -25,9 +25,6 @@ extern "C" { ** Written by Kiem-Phong Vo */ -#if defined(_PACKAGE_ast) -#include -#else #include #include @@ -93,8 +90,6 @@ extern "C" { #endif #endif -#endif /* defined(_PACKAGE_ast) */ - /* Sfoff_t should be large enough for largest file address */ diff --git a/lib/sfio/sfmode.c b/lib/sfio/sfmode.c index f629dbdf5..4ffeeb079 100644 --- a/lib/sfio/sfmode.c +++ b/lib/sfio/sfmode.c @@ -34,14 +34,8 @@ static char *Version = "\n@(#)sfio (AT&T Labs - kpv) 2001-02-01\0\n"; */ /* the below is for protecting the application from SIGPIPE */ -#if defined(_PACKAGE_ast) -#include -#include -#define Sfsignal_f Sig_handler_t -#else #include typedef void (*Sfsignal_f) (int); -#endif static int _Sfsigp = 0; /* # of streams needing SIGPIPE protection */ /* done at exiting time */ @@ -233,18 +227,12 @@ int _sfpclose(reg Sfio_t * f) CLOSE(p->file); /* wait for process termination */ -#if defined(_PACKAGE_ast) - sigcritical(1); -#endif #ifndef WIN32 while ((pid = waitpid(p->pid, &status, 0)) == -1 && errno == EINTR); #endif if (pid < 0) status = -1; -#if defined(_PACKAGE_ast) - sigcritical(0); -#endif #ifdef SIGPIPE vtmtxlock(_Sfmutex); diff --git a/lib/sfio/sfpkrd.c b/lib/sfio/sfpkrd.c index d38ed84e3..d0176fe0d 100644 --- a/lib/sfio/sfpkrd.c +++ b/lib/sfio/sfpkrd.c @@ -12,13 +12,11 @@ *************************************************************************/ #include "sfhdr.h" -#if !defined(_PACKAGE_ast) #ifndef FIONREAD #if _sys_ioctl #include #endif #endif -#endif /* Read/Peek a record from an unseekable device ** diff --git a/lib/sfio/sfpopen.c b/lib/sfio/sfpopen.c index dbf17d75f..55810d7e7 100644 --- a/lib/sfio/sfpopen.c +++ b/lib/sfio/sfpopen.c @@ -17,10 +17,6 @@ ** Written by Kiem-Phong Vo. */ -#if defined(_PACKAGE_ast) -#include -#else - #define EXIT_NOTFOUND 127 #define READ 0 @@ -118,8 +114,6 @@ static void execute(const char *argcmd) _exit(EXIT_NOTFOUND); } -#endif /*defined(_PACKAGE_ast)*/ - #ifndef WIN32 /** * @param f @@ -128,46 +122,6 @@ static void execute(const char *argcmd) */ Sfio_t *sfpopen(Sfio_t * f, const char *command, const char *mode) { -#if defined(_PACKAGE_ast) - reg Proc_t *proc; - reg int sflags; - reg long flags; - reg int bits; - char *av[4]; - - if (!command || !command[0] || !(sflags = _sftype(mode, NiL, NiL))) - return 0; - - if (f == (Sfio_t *) (-1)) { /* stdio compatibility mode */ - f = NIL(Sfio_t *); - bits = SF_STDIO; - } else - bits = 0; - - flags = 0; - if (sflags & SF_READ) - flags |= PROC_READ; - if (sflags & SF_WRITE) - flags |= PROC_WRITE; - av[0] = "sh"; - av[1] = "-c"; - av[2] = (char *) command; - av[3] = 0; - if (!(proc = procopen(0, av, 0, 0, flags))) - return 0; - if (!(f = sfnew(f, NIL(void *), (size_t) SF_UNBOUND, - (sflags & SF_READ) ? proc->rfd : proc->wfd, sflags)) || - ((f->bits |= bits), - _sfpopen(f, (sflags & SF_READ) ? proc->wfd : -1, proc->pid)) < 0) - { - if (f) - sfclose(f); - procclose(proc); - return 0; - } - procfree(proc); - return f; -#else reg int pid, fd, pkeep, ckeep, sflags; int stdio, parent[2], child[2]; Sfio_t sf; @@ -285,6 +239,5 @@ Sfio_t *sfpopen(Sfio_t * f, const char *command, const char *mode) } return NIL(Sfio_t *); } -#endif /*defined(_PACKAGE_ast)*/ } #endif diff --git a/lib/sfio/sftmp.c b/lib/sfio/sftmp.c index 3616432a4..52a63757d 100644 --- a/lib/sfio/sftmp.c +++ b/lib/sfio/sftmp.c @@ -122,7 +122,6 @@ static int _rmtmp(Sfio_t * f, char *file) return 0; } -#if !defined(_PACKAGE_ast) #include #define TMPDFLT "/tmp" static char **Tmppath, **Tmpcur; @@ -167,15 +166,12 @@ char **_sfgetpath(char *path) return dirs; } -#endif /*!defined(_PACKAGE_ast) */ - static int _tmpfd(Sfio_t * f) { reg char *file; reg int fd; int t; -#if !defined(_PACKAGE_ast) /* set up path of dirs to create temp files */ if (!Tmppath && !(Tmppath = _sfgetpath("TMPPATH"))) { if (!(Tmppath = (char **) malloc(2 * sizeof(char *)))) @@ -196,12 +192,10 @@ static int _tmpfd(Sfio_t * f) Tmpcur += 1; if (!Tmpcur || !Tmpcur[0]) Tmpcur = Tmppath; -#endif /*!defined(_PACKAGE_ast) */ file = NIL(char *); fd = -1; for (t = 0; t < 10; ++t) { /* compute a random name */ -#if !defined(_PACKAGE_ast) static ulong Key, A; if (A == 0 || t > 0) { /* get a quasi-random coefficient */ reg int r; @@ -216,9 +210,6 @@ static int _tmpfd(Sfio_t * f) Key = A * Key + 987654321; file = sfprints("%s/sf%3.3.32lu.%3.3.32lu", Tmpcur[0], (Key >> 15) & 0x7fff, Key & 0x7fff); -#else - file = pathtmp(file, NiL, "sf", NiL); -#endif /*!defined(_PACKAGE_ast) */ if (!file) return -1; @@ -245,9 +236,6 @@ static int _tmpfd(Sfio_t * f) if (fd >= 0) _rmtmp(f, file); -#if defined(_PACKAGE_ast) - free(file); -#endif /*defined(_PACKAGE_ast)*/ return fd; } diff --git a/lib/sfio/vthread.h b/lib/sfio/vthread.h index a186943ce..b06d96232 100644 --- a/lib/sfio/vthread.h +++ b/lib/sfio/vthread.h @@ -30,12 +30,6 @@ extern "C" { #include #include -/* ast doesn't do threads yet */ -#if defined(_PACKAGE_ast) && !defined(vt_threaded) -#define vt_threaded 0 -#endif - - #if !defined(vt_threaded) || (defined(vt_threaded) && vt_threaded == 1) #define _may_use_threads 1 #else diff --git a/lib/vmalloc/malloc.c b/lib/vmalloc/malloc.c index ff5a6b79d..d50ff97ab 100644 --- a/lib/vmalloc/malloc.c +++ b/lib/vmalloc/malloc.c @@ -143,11 +143,7 @@ static int createfile(char *file) } *next = '\0'; -#if defined(_PACKAGE_ast) - return open(buf, O_WRONLY | O_CREAT | O_TRUNC, CREAT_MODE); -#else return creat(buf, CREAT_MODE); -#endif } static void pfprint(void) diff --git a/lib/vmalloc/vmalloc.h b/lib/vmalloc/vmalloc.h index e66a230c8..9424ae39d 100644 --- a/lib/vmalloc/vmalloc.h +++ b/lib/vmalloc/vmalloc.h @@ -25,11 +25,7 @@ extern "C" { #define VMALLOC_VERSION 19990805L -#if defined(_PACKAGE_ast) -#include -#else #include -#endif typedef struct _vmalloc_s Vmalloc_t; typedef struct _vmstat_s Vmstat_t; diff --git a/lib/vmalloc/vmexit.c b/lib/vmalloc/vmexit.c index de0073486..05837911b 100644 --- a/lib/vmalloc/vmexit.c +++ b/lib/vmalloc/vmexit.c @@ -17,7 +17,7 @@ ** Any required functions for process exiting. ** Written by Kiem-Phong Vo, kpv@research.att.com (05/25/93). */ -#if defined(_PACKAGE_ast) || _lib_atexit +#if _lib_atexit int Vm_atexit_already_defined; #else @@ -64,4 +64,4 @@ void exit(int type) #endif /* _lib_onexit || _lib_on_exit */ -#endif /*!PACKAGE_ast */ +#endif /*_lib_atexit */ diff --git a/lib/vmalloc/vmhdr.h b/lib/vmalloc/vmhdr.h index 551c53f16..22fefc384 100644 --- a/lib/vmalloc/vmhdr.h +++ b/lib/vmalloc/vmhdr.h @@ -31,30 +31,9 @@ extern "C" { ** Written by Kiem-Phong Vo, kpv@research.att.com, 01/16/94. */ - -#if defined(_PACKAGE_ast) - -#if defined(__STDPP__directive) && defined(__STDPP__hide) - __STDPP__directive pragma pp:hide getpagesize -#else -#define getpagesize ______getpagesize -#endif - -#include - -#if defined(__STDPP__directive) && defined(__STDPP__hide) - __STDPP__directive pragma pp:nohide getpagesize -#else -#undef getpagesize -#endif - -#else - #include #include "FEATURE/vmalloc" -#endif /*defined(_PACKAGE_ast)*/ - #undef free #undef malloc #undef realloc @@ -432,9 +411,6 @@ extern "C" { extern Vmextern_t _Vmextern; - -#if !defined(_PACKAGE_ast) - extern size_t getpagesize(void); #ifndef WIN32 @@ -463,8 +439,6 @@ extern "C" { #endif extern void _cleanup(void); -#endif /*!PACKAGE_ast */ - /* for vmdcsbrk.c */ #if !_typ_ssize_t typedef int ssize_t; -- 2.40.0