From 01da863154351c303ecfdfa2267567e966da2133 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Tue, 4 Jan 2022 08:24:40 +0000 Subject: [PATCH] In the original ast code base, src/{cmd/nmake,lib/libast}/Makefile (nmake makefiles) defined this macro: __OBSOLETE__ == $("6 months ago":@F=%(%Y0101)T) This was used to automatically disable code after a period between 6 and 18 months, on 1st Jan of each year, in preprocessor directives like: #if __OBSOLETE__ < 20080101 // obsolete code here #endif However, when compiling without nmake (as we do), this __OBSOLETE__ macro is not defined at all. And undefined macros evaluate to zero in arithmetic comparisons, so all that obsolete code has been getting compiled. Thankfully it doesn't seem to have done any harm, but all that code was supposed to expire between 2008 and 2014. src/lib/libast/disc/sfstrtmp.c: - Removed. Was supposed to be a stub #if __OBSOLETE__ >= 20070101. src/lib/libast/include/ast.h: - Remove unused fmtbasell() macro (/* until 2014-01-01 */). Other changed files: - Remove __OBSOLETE__d code. --- src/cmd/ksh93/sh/waitevent.c | 17 --------- src/lib/libast/Mamfile | 11 +----- src/lib/libast/disc/sfstrtmp.c | 62 --------------------------------- src/lib/libast/include/ast.h | 1 - src/lib/libast/misc/fts.c | 15 -------- src/lib/libast/misc/procrun.c | 3 -- src/lib/libast/port/astconf.c | 9 ----- src/lib/libast/string/fmtbase.c | 18 ---------- src/lib/libcmd/cmdinit.c | 16 --------- 9 files changed, 1 insertion(+), 151 deletions(-) delete mode 100644 src/lib/libast/disc/sfstrtmp.c diff --git a/src/cmd/ksh93/sh/waitevent.c b/src/cmd/ksh93/sh/waitevent.c index 03a78ddcb..8dbc6b8bc 100644 --- a/src/cmd/ksh93/sh/waitevent.c +++ b/src/cmd/ksh93/sh/waitevent.c @@ -35,20 +35,3 @@ void *sh_waitnotify(int(*newevent)(int,long,int)) shgd->waitevent = newevent; return((void*)old); } - -#if __OBSOLETE__ < 20080101 -/* - * this used to be a private symbol - * retain the old name for a bit for a smooth transition - */ - -#if defined(__EXPORT__) -#define extern __EXPORT__ -#endif - -extern void *_sh_waitnotify(int(*newevent)(int,long,int)) -{ - return sh_waitnotify(newevent); -} - -#endif diff --git a/src/lib/libast/Mamfile b/src/lib/libast/Mamfile index e69b08075..1635ce12a 100644 --- a/src/lib/libast/Mamfile +++ b/src/lib/libast/Mamfile @@ -6072,22 +6072,13 @@ make install prev uwin/support.c exec - ${CC} ${mam_cc_FLAGS} ${KSH_RELFLAGS} ${CCFLAGS} -I. -Iuwin -Istd -c uwin/support.c done support.o generated - make sfstrtmp.o - make disc/sfstrtmp.c - prev include/ast.h implicit - prev include/sfio_t.h implicit - done disc/sfstrtmp.c - meta sfstrtmp.o %.c>%.o disc/sfstrtmp.c sfstrtmp - prev disc/sfstrtmp.c - exec - ${CC} ${mam_cc_FLAGS} ${KSH_RELFLAGS} ${CCFLAGS} -I. -Icomp -Iinclude -Istd -D__OBSOLETE__=20120101 -D_PACKAGE_ast -c disc/sfstrtmp.c - done sfstrtmp.o generated exec - ${AR} rc libast.a state.o transition.o opendir.o readdir.o rewinddir.o seekdir.o telldir.o getcwd.o fastfind.o hashalloc.o hashdump.o hashfree.o hashlast.o hashlook.o hashscan.o hashsize.o hashview.o hashwalk.o memhash.o memsum.o strhash.o strkey.o strsum.o stracmp.o strnacmp.o ccmap.o ccmapid.o ccnative.o chresc.o chrtoi.o exec - ${AR} rc libast.a streval.o strexpr.o strmatch.o strcopy.o modei.o modex.o strmode.o strlcat.o strlcpy.o strlook.o strncopy.o strsearch.o strpsearch.o stresc.o stropt.o strtape.o strpcmp.o strnpcmp.o strvcmp.o strnvcmp.o tok.o tokline.o tokscan.o pathaccess.o pathcat.o pathcanon.o pathcheck.o pathpath.o pathexists.o pathfind.o pathicase.o pathkey.o pathprobe.o pathrepl.o pathnative.o pathposix.o pathtemp.o pathtmp.o pathstat.o pathgetlink.o pathsetlink.o pathbin.o pathshell.o pathcd.o pathprog.o ftwalk.o ftwflags.o fts.o astintercept.o conformance.o getenv.o setenviron.o optget.o optjoin.o optesc.o optctx.o strsort.o struniq.o magic.o mime.o mimetype.o signal.o sigflag.o systrace.o error.o errorf.o errormsg.o errorx.o localeconv.o setlocale.o translate.o catopen.o iconv.o lc.o lctab.o mc.o base64.o recfmt.o recstr.o reclen.o fmtrec.o fmtbase.o fmtbuf.o fmtclock.o fmtdev.o fmtelapsed.o fmterror.o fmtesc.o fmtfmt.o fmtfs.o fmtident.o fmtint.o fmtip4.o fmtip6.o fmtls.o fmtmatch.o fmtmode.o fmtnum.o fmtperm.o fmtre.o fmttime.o exec - ${AR} rc libast.a fmtuid.o fmtgid.o fmtsignal.o fmtscale.o fmttmx.o fmttv.o fmtversion.o strelapsed.o strperm.o struid.o strgid.o strtoip4.o strtoip6.o stack.o stk.o swapget.o swapmem.o swapop.o swapput.o sigdata.o sigcrit.o sigunblock.o procopen.o procclose.o procrun.o procfree.o tmdate.o tmequiv.o tmfix.o tmfmt.o tmform.o tmgoff.o tminit.o tmleap.o tmlex.o tmlocale.o tmmake.o tmpoff.o tmscan.o tmsleep.o tmtime.o tmtype.o tmweek.o tmword.o tmzone.o tmxdate.o tmxduration.o tmxfmt.o tmxgettime.o tmxleap.o tmxmake.o tmxscan.o tmxsettime.o tmxsleep.o tmxtime.o tmxtouch.o tvcmp.o tvgettime.o tvsettime.o tvsleep.o tvtouch.o cmdarg.o vecargs.o vecfile.o vecfree.o vecload.o vecstring.o univdata.o touch.o mnt.o debug.o memccpy.o memchr.o memcmp.o memcpy.o memdup.o memmove.o memset.o mkdir.o mkfifo.o mknod.o rmdir.o remove.o rename.o link.o unlink.o strdup.o strchr.o strrchr.o strstr.o strtod.o strtold.o strtol.o strtoll.o strtoul.o strtoull.o strton.o strtonll.o strntod.o strntold.o strnton.o exec - ${AR} rc libast.a strntonll.o strntol.o strntoll.o strntoul.o strntoull.o strcasecmp.o strncasecmp.o strerror.o mktemp.o tmpnam.o fsync.o execlp.o execve.o execvp.o execvpe.o spawnveg.o vfork.o killpg.o hsearch.o tsearch.o getlogin.o putenv.o setenv.o unsetenv.o lstat.o statvfs.o eaccess.o gross.o omitted.o readlink.o symlink.o getpgrp.o setpgid.o setsid.o waitpid.o creat64.o fcntl.o open.o atexit.o getdents.o getwd.o dup2.o errno.o getpreroot.o ispreroot.o realopen.o setpreroot.o getgroups.o mount.o system.o iblocks.o modedata.o tmdata.o memfatal.o sfkeyprintf.o sfdcdio.o sfdcdos.o sfdcfilter.o sfdcseekable.o sfdcslow.o sfdcsubstr.o sfdctee.o sfdcunion.o sfdcmore.o sfdcprefix.o wc.o wc2utf8.o basename.o closelog.o dirname.o fmtmsglib.o fnmatch.o ftw.o getdate.o getsubopt.o glob.o nftw.o openlog.o re_comp.o resolvepath.o realpath.o regcmp.o regexp.o setlogmask.o strftime.o strptime.o swab.o syslog.o tempnam.o wordexp.o mktime.o regalloc.o regclass.o regcoll.o regcomp.o regcache.o regdecomp.o regerror.o regexec.o regfatal.o reginit.o exec - ${AR} rc libast.a regnexec.o regsubcomp.o regsubexec.o regsub.o regrecord.o regrexec.o regstat.o dtclose.o dtdisc.o dthash.o dtlist.o dtmethod.o dtopen.o dtstat.o dtstrhash.o dttree.o dtuser.o dtview.o dtwalk.o dtnew.o dtcomp.o sfclose.o sfclrlock.o sfdisc.o sfdlen.o sfexcept.o sfgetl.o sfgetu.o sfcvt.o sfecvt.o sffcvt.o sfextern.o sffilbuf.o sfflsbuf.o sfprints.o sfgetd.o sfgetr.o sfllen.o sfmode.o sfmove.o sfnew.o sfpkrd.o sfnotify.o sfnputc.o sfopen.o sfpeek.o sfpoll.o sfpool.o sfpopen.o sfprintf.o sfputd.o sfputl.o sfputr.o sfputu.o sfrd.o sfread.o sfreserve.o sfscanf.o sfseek.o sfset.o sfsetbuf.o sfsetfd.o sfsize.o sfsk.o sfstack.o sfstrtod.o sfsync.o sfswap.o sftable.o sftell.o sftmp.o sfungetc.o sfvprintf.o sfvscanf.o sfwr.o sfwrite.o sfpurge.o sfraise.o sfwalk.o sfgetm.o sfmutex.o sfputm.o sfresize.o _sfclrerr.o _sfeof.o _sferror.o _sffileno.o _sfopen.o _sfstacked.o _sfvalue.o _sfgetc.o _sfgetl.o _sfgetl2.o _sfgetu.o _sfgetu2.o _sfdlen.o _sfllen.o _sfslen.o _sfulen.o _sfputc.o _sfputd.o _sfputl.o _sfputm.o exec - ${AR} rc libast.a _sfputu.o clearerr.o fclose.o fdopen.o feof.o ferror.o fflush.o fgetc.o fgetpos.o fgets.o fileno.o fopen.o fprintf.o fpurge.o fputc.o fputs.o fread.o freopen.o fscanf.o fseek.o fseeko.o fsetpos.o ftell.o ftello.o fwrite.o flockfile.o ftrylockfile.o funlockfile.o getc.o getchar.o getw.o pclose.o popen.o printf.o putc.o putchar.o puts.o putw.o rewind.o scanf.o setbuf.o setbuffer.o setlinebuf.o setvbuf.o snprintf.o sprintf.o sscanf.o asprintf.o vasprintf.o tmpfile.o ungetc.o vfprintf.o vfscanf.o vprintf.o vscanf.o vsnprintf.o vsprintf.o vsscanf.o _doprnt.o _doscan.o _filbuf.o _flsbuf.o _stdfun.o _stdopen.o _stdprintf.o _stdscanf.o _stdsprnt.o _stdvbuf.o _stdvsnprnt.o _stdvsprnt.o _stdvsscn.o fgetwc.o fwprintf.o putwchar.o vfwscanf.o wprintf.o fgetws.o fwscanf.o swprintf.o vswprintf.o wscanf.o fputwc.o getwc.o swscanf.o vswscanf.o fputws.o getwchar.o ungetwc.o vwprintf.o fwide.o putwc.o vfwprintf.o vwscanf.o stdio_c99.o fcloseall.o fmemopen.o getdelim.o getline.o frexp.o frexpl.o astcopy.o - exec - ${AR} rc libast.a astconf.o astdynamic.o astquery.o astwinsize.o conftab.o aststatic.o getopt.o getoptl.o aso.o asolock.o asometh.o asorelax.o aso-sem.o aso-fcntl.o vmbest.o vmclear.o vmclose.o vmdcheap.o vmdebug.o vmdisc.o vmexit.o vmlast.o vmopen.o vmpool.o vmprivate.o vmprofile.o vmregion.o vmsegment.o vmset.o vmstat.o vmstrdup.o vmtrace.o vmwalk.o vmmopen.o malloc.o vmgetmem.o a64l.o acosh.o asinh.o atanh.o cbrt.o crypt.o erf.o err.o exp.o exp__E.o expm1.o gamma.o getpass.o lgamma.o log.o log1p.o log__L.o rand48.o random.o rcmd.o rint.o support.o sfstrtmp.o + exec - ${AR} rc libast.a astconf.o astdynamic.o astquery.o astwinsize.o conftab.o aststatic.o getopt.o getoptl.o aso.o asolock.o asometh.o asorelax.o aso-sem.o aso-fcntl.o vmbest.o vmclear.o vmclose.o vmdcheap.o vmdebug.o vmdisc.o vmexit.o vmlast.o vmopen.o vmpool.o vmprivate.o vmprofile.o vmregion.o vmsegment.o vmset.o vmstat.o vmstrdup.o vmtrace.o vmwalk.o vmmopen.o malloc.o vmgetmem.o a64l.o acosh.o asinh.o atanh.o cbrt.o crypt.o erf.o err.o exp.o exp__E.o expm1.o gamma.o getpass.o lgamma.o log.o log1p.o log__L.o rand48.o random.o rcmd.o rint.o support.o exec - (ranlib libast.a) >/dev/null 2>&1 || true done libast.a generated done ast virtual diff --git a/src/lib/libast/disc/sfstrtmp.c b/src/lib/libast/disc/sfstrtmp.c deleted file mode 100644 index 84fa41292..000000000 --- a/src/lib/libast/disc/sfstrtmp.c +++ /dev/null @@ -1,62 +0,0 @@ -/*********************************************************************** -* * -* This software is part of the ast package * -* Copyright (c) 1985-2011 AT&T Intellectual Property * -* Copyright (c) 2020-2021 Contributors to ksh 93u+m * -* and is licensed under the * -* Eclipse Public License, Version 1.0 * -* by AT&T Intellectual Property * -* * -* A copy of the License is available at * -* http://www.eclipse.org/org/documents/epl-v10.html * -* (with md5 checksum b35adb5213ca9657e911e9befb180842) * -* * -* Information and Software Systems Research * -* AT&T Research * -* Florham Park NJ * -* * -* Glenn Fowler * -* David Korn * -* Phong Vo * -* * -***********************************************************************/ -/* - * Glenn Fowler - * AT&T Research - * - * sfio tmp string buffer support - */ - -#include -#include - -#if __OBSOLETE__ >= 20070101 /* sfstr* macros now use sfsetbuf() */ - -NoN(sfstrtmp) - -#else - -#if defined(__EXPORT__) -#define extern __EXPORT__ -#endif - -/* - * replace buffer in string stream f for either SF_READ or SF_WRITE - */ - -extern int -sfstrtmp(register Sfio_t* f, int mode, void* buf, size_t siz) -{ - if (!(f->_flags & SF_STRING)) - return -1; - if (f->_flags & SF_MALLOC) - free(f->_data); - f->_flags &= ~(SF_ERROR|SF_MALLOC); - f->mode = mode; - f->_next = f->_data = (unsigned char*)buf; - f->_endw = f->_endr = f->_endb = f->_data + siz; - f->_size = siz; - return 0; -} - -#endif diff --git a/src/lib/libast/include/ast.h b/src/lib/libast/include/ast.h index 665b231a1..2886423e1 100644 --- a/src/lib/libast/include/ast.h +++ b/src/lib/libast/include/ast.h @@ -306,7 +306,6 @@ extern int chrtoi(const char*); extern char* conformance(const char*, size_t); extern int eaccess(const char*, int); extern char* fmtbase(intmax_t, int, int); -#define fmtbasell(a,b,c) fmtbase(a,b,c) /* until 2014-01-01 */ extern char* fmtbuf(size_t); extern char* fmtclock(Sfulong_t); extern char* fmtelapsed(unsigned long, int); diff --git a/src/lib/libast/misc/fts.c b/src/lib/libast/misc/fts.c index e4fe61c76..c12a587a7 100644 --- a/src/lib/libast/misc/fts.c +++ b/src/lib/libast/misc/fts.c @@ -192,17 +192,11 @@ node(FTS* fts, FTSENT* parent, register char* name, register size_t namelen) f->status = 0; f->symlink = 0; f->fts_level = (f->fts_parent = parent)->fts_level + 1; -#if __OBSOLETE__ < 20140101 - f->_fts_level = (short)f->fts_level; -#endif f->fts_link = 0; f->fts_pointer = 0; f->fts_number = 0; f->fts_errno = 0; f->fts_namelen = namelen; -#if __OBSOLETE__ < 20140101 - f->_fts_namelen = (unsigned short)f->fts_namelen; -#endif f->fts_name = f->name; f->fts_statp = &f->statb; memcpy(f->fts_name, name, namelen + 1); @@ -635,9 +629,6 @@ toplist(FTS* fts, register char* const* pathnames) *s = 0; f->fts_namelen = s - path; } -#if __OBSOLETE__ < 20140101 - f->_fts_namelen = (unsigned short)f->fts_namelen; -#endif if (!*path) { errno = ENOENT; @@ -775,9 +766,6 @@ fts_open(char* const* pathnames, int flags, int (*comparf)(FTSENT* const*, FTSEN fts->parent->fts_info = FTS_D; memcpy(fts->parent->fts_accpath = fts->parent->fts_path = fts->parent->fts_name = fts->parent->name, ".", 2); fts->parent->fts_level = -1; -#if __OBSOLETE__ < 20140101 - fts->parent->_fts_level = (short)fts->parent->fts_level; -#endif fts->parent->fts_statp = &fts->parent->statb; fts->parent->must = 2; fts->parent->type = DT_UNKNOWN; @@ -1415,9 +1403,6 @@ fts_read(register FTS* fts) } note: -#if __OBSOLETE__ < 20140101 - f->_fts_pathlen = (unsigned short)f->fts_pathlen; -#endif for (p = notify; p; p = p->next) if ((n = (*p->notifyf)(fts, f, p->context)) > 0) break; diff --git a/src/lib/libast/misc/procrun.c b/src/lib/libast/misc/procrun.c index a10a07387..aec0f154d 100644 --- a/src/lib/libast/misc/procrun.c +++ b/src/lib/libast/misc/procrun.c @@ -36,9 +36,6 @@ int procrun(const char* path, char** argv, int flags) { -#if __OBSOLETE__ < 20090101 - flags &= argv ? PROC_ARGMOD : PROC_CHECK; -#endif if (flags & PROC_CHECK) { char buf[PATH_MAX]; diff --git a/src/lib/libast/port/astconf.c b/src/lib/libast/port/astconf.c index f3a4c2790..99b5f2f4a 100644 --- a/src/lib/libast/port/astconf.c +++ b/src/lib/libast/port/astconf.c @@ -1408,15 +1408,6 @@ astgetconf(const char* name, const char* path, const char* value, int flags, Err Lookup_t look; Sfio_t* tmp; -#if __OBSOLETE__ < 20080101 - if (pointerof(flags) == (void*)errorf) - { - conferror = errorf; - flags = ASTCONF_error; - } - else if (conferror && conferror != errorf) - conferror = 0; -#endif if (!name) { if (path) diff --git a/src/lib/libast/string/fmtbase.c b/src/lib/libast/string/fmtbase.c index 4e0c5e4c6..1a864357e 100644 --- a/src/lib/libast/string/fmtbase.c +++ b/src/lib/libast/string/fmtbase.c @@ -50,21 +50,3 @@ fmtbase(intmax_t n, int b, int p) sfsprintf(buf, z, p ? "%#..*I*u" : "%..*I*u", b, sizeof(n), n); return buf; } - -#if __OBSOLETE__ < 20140101 - -#undef fmtbasell - -#if defined(__EXPORT__) -#define extern __EXPORT__ -#endif - -extern char* -fmtbasell(intmax_t n, int b, int p) -{ - return fmtbase(n, b, p); -} - -#undef extern - -#endif diff --git a/src/lib/libcmd/cmdinit.c b/src/lib/libcmd/cmdinit.c index a82a0f8fb..8637c25ba 100644 --- a/src/lib/libcmd/cmdinit.c +++ b/src/lib/libcmd/cmdinit.c @@ -57,19 +57,3 @@ _cmd_init(int argc, char** argv, Shbltin_t* context, const char* catalog, int fl opt_info.index = 0; return 0; } - -#if __OBSOLETE__ < 20080101 - -#if defined(__EXPORT__) -#define extern __EXPORT__ -#endif - -#undef cmdinit - -extern void -cmdinit(char** argv, Shbltin_t* context, const char* catalog, int flags) -{ - _cmd_init(0, argv, context, catalog, flags); -} - -#endif