Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ANSI C standard of zsh
- X-seq: zsh-workers 52750
- From: Oliver Kiddle <opk@xxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Clinton Bunch <cdb_zsh@xxxxxxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: ANSI C standard of zsh
- Date: Wed, 13 Mar 2024 17:49:56 +0100
- Archived-at: <https://zsh.org/workers/52750>
- In-reply-to: <CAH+w=7YtC6=ycHEwgXBn1=TFL8s6-grscZ8CUMvYJj4=nhTB+w@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <4da53188-feb2-42d2-9294-899715991be1@zentaur.org> <CAH+w=7YtC6=ycHEwgXBn1=TFL8s6-grscZ8CUMvYJj4=nhTB+w@mail.gmail.com>
Bart Schaefer wrote:
> On Tue, Mar 12, 2024 at 2:44 PM Clinton Bunch <cdb_zsh@xxxxxxxxxxx> wrote:
> > I propose that we update the development guide to remove the bit about the 1989 standard (much less K&R compatibility) since it is no longer true, and I personally question if it even makes sense as a goal 30+ years in to development.
No objections from me. Replacement wording would be welcome. We're using
string pasting (##) in quite a few places despite that being "not
available".
stdbool.h apparently already gets used in wcwidth9.h but
--enable-unicode9 is also something whose time has passed and which
should be removed.
It may also be useful to consider things like whether stdbool.h should
be included once from zsh_system.h
> I think we pretty much agreed on that back in December (workers/51212
> anyone?) and just never edited that bit of the document.
The sentiment there was similar but the legacy code removed at that
point likely ceased to be relevant even before C99 was defined.
I wouldn't draw too many conclusions from zsh failing to compile with
c89. The errors mostly come from system header files. Often the
standards options enforce a level of strictness that can be absent with
default options. With the right vintage C compiler, you'll likely find
that specifying the C99 standard also breaks the build, sometimes even
with -std=gnu99.
It was quite some time after 1999 before C99 became usable. C++ was
higher priority for the compiler writers at that time. I think the
K&R support continued to be relevant for long after the ANSI standard
because some Unix vendors (HP?) included a basic K&R compiler with the
OS but charged extra for the newer one. But I doubt anyone has needed
ansi2knr in a long time. The attached patch strips out all the ansi2knr
support.
There's something for ._foo_ file extensions in Makemod.in.in that looks
like someone's leftover debug from years back. Or does it have a strange
purpose I couldn't fathom? It's possible that I've missed a use of the
_(Args) macro buried somewhere in conditional code. We had logic in
aclocal.m4 to select appropriate compiler options to select ansi form.
Perhaps some of this is still actually relevant but it seemed better to
clear it. From memory I was always forcing -xansi into CFLAGS on IRIX
manually and the same approach would still be open. I also needed to
mark a couple of #ifdefs for makepro.awk to keep them in utils.c where a
function conditionally had a macro replacement. With different results
from configure, similar problems may remain elsewhere.
Oliver
diff --git a/Config/defs.mk.in b/Config/defs.mk.in
index 2bc17482a..116875fb9 100644
--- a/Config/defs.mk.in
+++ b/Config/defs.mk.in
@@ -75,7 +75,6 @@ IMPOPT = @IMPOPT@
# utilities
AWK = @AWK@
-ANSI2KNR = @ANSI2KNR@
YODL = @YODL@ @YODL_OPTIONS@
YODL2TXT = @YODL@2txt
YODL2HTML = @YODL@2html
@@ -100,7 +99,7 @@ LDFLAGS='$(LDFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' \
DLCFLAGS='$(DLCFLAGS)' DLLDFLAGS='$(DLLDFLAGS)' \
LIBLDFLAGS='$(LIBLDFLAGS)' EXELDFLAGS='$(EXELDFLAGS)' \
LIBS='$(LIBS)' DL_EXT='$(DL_EXT)' DLLD='$(DLLD)' \
-AWK='$(AWK)' ANSI2KNR='$(ANSI2KNR)' \
+AWK='$(AWK)' \
YODL='$(YODL)' YODL2TXT='$(YODL2TXT)' YODL2HTML='$(YODL2HTML)' \
FUNCTIONS_INSTALL='$(FUNCTIONS_INSTALL)' tzsh='$(tzsh)'
diff --git a/Etc/zsh-development-guide b/Etc/zsh-development-guide
index 5cb542709..bdabe17d8 100644
--- a/Etc/zsh-development-guide
+++ b/Etc/zsh-development-guide
@@ -240,7 +240,7 @@ C coding style
There must be an empty line, a line with "/**/", a line with the
type of the function, and finally the name of the function with typed
arguments. These lines must not be indented. The script generating
- function prototypes and the ansi2knr program depend on this format.
+ function prototypes depends on this format.
* Variable declarations must similarly be preceded by a
line containing only "/**/", for the prototype generation script.
diff --git a/Src/Makemod.in.in b/Src/Makemod.in.in
index ea0cdc3a4..3343ae1d0 100644
--- a/Src/Makemod.in.in
+++ b/Src/Makemod.in.in
@@ -52,32 +52,17 @@ DLCOMPILE = $(CC) -c -I. -I$(dir_top)/Src -I$(sdir_top)/Src -I$(sdir_top)/Src/
LINK = $(CC) $(LDFLAGS) $(EXELDFLAGS) $(EXTRA_LDFLAGS) -o $@
DLLINK = $(DLLD) $(LDFLAGS) $(LIBLDFLAGS) $(DLLDFLAGS) -o $@
-KNR_OBJ=.o
-KNROBJ=._foo_
+OBJ=.o
-ANSIOBJ=.o
-ANSI_OBJ=._foo_
+.SUFFIXES: .c .$(DL_EXT) ..o .o .syms .pro .epro
-.SUFFIXES: .c .$(DL_EXT) ..o .._foo_ .o ._foo_ .syms .pro .epro
-
-.c$(ANSI@U@OBJ):
+.c$(OBJ):
$(COMPILE) -o $@ $<
@rm -f $(dir_src)/stamp-modobjs
-.c$(KNR@U@OBJ):
- @ANSI2KNR@ $< > $@.c
- $(COMPILE) -o $@ $@.c
- rm -f $@.c
- @rm -f $(dir_src)/stamp-modobjs
-
-.c.$(ANSI@U@OBJ):
+.c.$(OBJ):
$(DLCOMPILE) -o $@ $<
-.c.$(KNR@U@OBJ):
- @ANSI2KNR@ $< > $@.c
- $(DLCOMPILE) -o $@ $@.c
- rm -f $@.c
-
.c.syms:
$(AWK) -f $(sdir_src)/makepro.awk $< $(subdir) > $@
diff --git a/Src/Modules/files.c b/Src/Modules/files.c
index bf0e8f8a8..a3fec1daa 100644
--- a/Src/Modules/files.c
+++ b/Src/Modules/files.c
@@ -29,8 +29,8 @@
#include "files.mdh"
-typedef int (*MoveFunc) _((char const *, char const *));
-typedef int (*RecurseFunc) _((char *, char *, struct stat const *, void *));
+typedef int (*MoveFunc) (char const *, char const *);
+typedef int (*RecurseFunc) (char *, char *, struct stat const *, void *);
struct recursivecmd;
diff --git a/Src/Modules/watch.c b/Src/Modules/watch.c
index ba17cf940..acc499518 100644
--- a/Src/Modules/watch.c
+++ b/Src/Modules/watch.c
@@ -584,7 +584,7 @@ readwtab(WATCH_STRUCT_UTMP **head, int initial_sz)
if (sz)
qsort((void *) *head, sz, sizeof(WATCH_STRUCT_UTMP),
- (int (*) _((const void *, const void *)))ucmp);
+ (int (*) (const void *, const void *))ucmp);
return sz;
}
diff --git a/Src/Modules/zftp.c b/Src/Modules/zftp.c
index 47a5e9de9..0c26828fd 100644
--- a/Src/Modules/zftp.c
+++ b/Src/Modules/zftp.c
@@ -127,7 +127,7 @@ typedef int (*readwrite_t)(int, char *, off_t, int);
struct zftpcmd {
const char *nam;
- int (*fun) _((char *, char **, int));
+ int (*fun) (char *, char **, int);
int min, max, flags;
};
diff --git a/Src/Modules/zprof.c b/Src/Modules/zprof.c
index 56cdab888..171a15b90 100644
--- a/Src/Modules/zprof.c
+++ b/Src/Modules/zprof.c
@@ -163,9 +163,9 @@ bin_zprof(UNUSED(char *nam), UNUSED(char **args), Options ops, UNUSED(int func))
*ap = NULL;
qsort(fs, ncalls, sizeof(f),
- (int (*) _((const void *, const void *))) cmpsfuncs);
+ (int (*) (const void *, const void *)) cmpsfuncs);
qsort(as, narcs, sizeof(a),
- (int (*) _((const void *, const void *))) cmpparcs);
+ (int (*) (const void *, const void *)) cmpparcs);
printf("num calls time self name\n-----------------------------------------------------------------------------------\n");
for (fp = fs, i = 1; *fp; fp++, i++) {
@@ -179,7 +179,7 @@ bin_zprof(UNUSED(char *nam), UNUSED(char **args), Options ops, UNUSED(int func))
(*fp)->name);
}
qsort(fs, ncalls, sizeof(f),
- (int (*) _((const void *, const void *))) cmptfuncs);
+ (int (*) (const void *, const void *)) cmptfuncs);
for (fp = fs; *fp; fp++) {
printf("\n-----------------------------------------------------------------------------------\n\n");
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 9b87cad93..09282d42d 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -3253,7 +3253,7 @@ makearray(LinkList l, int type, int flags, int *np, int *nlp, int *llp)
/* Now sort the array (it contains matches). */
matchorder = flags;
qsort((void *) rp, n, sizeof(Cmatch),
- (int (*) _((const void *, const void *)))matchcmp);
+ (int (*) (const void *, const void *))matchcmp);
/* since the matches are sorted and the default is to remove
* all duplicates, -1 (remove only consecutive dupes) is a no-op,
@@ -3295,7 +3295,7 @@ makearray(LinkList l, int type, int flags, int *np, int *nlp, int *llp)
sp = (Cmatch *) zhalloc((n + 1) * sizeof(Cmatch));
memcpy(sp, rp, (n + 1) * sizeof(Cmatch));
qsort((void *) sp, n, sizeof(Cmatch),
- (int (*) _((const void *, const void *)))matchcmp);
+ (int (*) (const void *, const void *))matchcmp);
for (asp = sp + 1; *asp; asp++) {
Cmatch *ap = asp - 1, *bp = asp;
if (matcheq(*ap, *bp)) {
diff --git a/Src/Zle/zle.h b/Src/Zle/zle.h
index 010ead3d2..5bb9e7a5e 100644
--- a/Src/Zle/zle.h
+++ b/Src/Zle/zle.h
@@ -186,7 +186,7 @@ typedef struct thingy *Thingy;
/* widgets (ZLE functions) */
-typedef int (*ZleIntFunc) _((char **));
+typedef int (*ZleIntFunc) (char **);
struct widget {
int flags; /* flags (see below) */
@@ -319,7 +319,7 @@ struct vichange {
typedef struct keymap *Keymap;
-typedef void (*KeyScanFunc) _((char *, Thingy, char *, void *));
+typedef void (*KeyScanFunc) (char *, Thingy, char *, void *);
#define invicmdmode() (!strcmp(curkeymapname, "vicmd"))
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index 041682ee9..5012917f5 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -745,7 +745,7 @@ bin_bindkey(char *name, char **argv, Options ops, UNUSED(int func))
static struct opn {
char o;
char selp;
- int (*func) _((char *, char *, Keymap, char **, Options, char));
+ int (*func) (char *, char *, Keymap, char **, Options, char);
int min, max;
} const opns[] = {
{ 'l', 0, bin_bindkey_lsmaps, 0, -1 },
diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c
index 1b036a8a0..f71435b01 100644
--- a/Src/Zle/zle_thingy.c
+++ b/Src/Zle/zle_thingy.c
@@ -344,7 +344,7 @@ bin_zle(char *name, char **args, Options ops, UNUSED(int func))
{
static struct opn {
char o;
- int (*func) _((char *, char **, Options, char));
+ int (*func) (char *, char **, Options, char);
int min, max;
} const opns[] = {
{ 'l', bin_zle_list, 0, -1 },
diff --git a/Src/exec.c b/Src/exec.c
index 0231bc361..e955e85df 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -267,7 +267,7 @@ static char *blank_env[] = { NULL };
/* Execution functions. */
-static int (*execfuncs[WC_COUNT-WC_CURSH]) _((Estate, int)) = {
+static int (*execfuncs[WC_COUNT-WC_CURSH]) (Estate, int) = {
execcursh, exectime, NULL /* execfuncdef handled specially */,
execfor, execselect,
execwhile, execrepeat, execcase, execif, execcond,
diff --git a/Src/glob.c b/Src/glob.c
index bd199ace3..3e34f708e 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -133,7 +133,7 @@ typedef struct stat *Statptr; /* This makes the Ultrix compiler happy. Go figu
#define TT_TERABYTES 5
-typedef int (*TestMatchFunc) _((char *, struct stat *, off_t, char *));
+typedef int (*TestMatchFunc) (char *, struct stat *, off_t, char *);
struct qual {
struct qual *next; /* Next qualifier, must match */
@@ -1264,7 +1264,7 @@ zglob(LinkList list, LinkNode np, int nountok)
int sense, qualsfound;
off_t data;
char *sdata, *newcolonmod, *ptr;
- int (*func) _((char *, Statptr, off_t, char *));
+ int (*func) (char *, Statptr, off_t, char *);
/*
* Initialise state variables for current file pattern.
@@ -1310,7 +1310,7 @@ zglob(LinkList list, LinkNode np, int nountok)
if (*ptr == Dash)
*ptr = '-';
while (*s && !newcolonmod) {
- func = (int (*) _((char *, Statptr, off_t, char *)))0;
+ func = (int (*) (char *, Statptr, off_t, char *)) 0;
if (*s == ',') {
/* A comma separates alternative sets of qualifiers */
s++;
@@ -1961,7 +1961,7 @@ zglob(LinkList list, LinkNode np, int nountok)
/* Sort arguments in to lexical (and possibly numeric) order. *
* This is reversed to facilitate insertion into the list. */
qsort((void *) & matchbuf[0], matchct, sizeof(struct gmatch),
- (int (*) _((const void *, const void *)))gmatchcmp);
+ (int (*) (const void *, const void *)) gmatchcmp);
}
if (first < 0) {
diff --git a/Src/hist.c b/Src/hist.c
index 448dfddbc..1a00c30ed 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -34,25 +34,25 @@
* word control. */
/**/
-mod_export int (*hgetc) _((void));
+mod_export int (*hgetc) (void);
/**/
-void (*hungetc) _((int));
+void (*hungetc) (int);
/**/
-void (*hwaddc) _((int));
+void (*hwaddc) (int);
/**/
-void (*hwbegin) _((int));
+void (*hwbegin) (int);
/**/
-void (*hwabort) _((void));
+void (*hwabort) (void);
/**/
-void (*hwend) _((void));
+void (*hwend) (void);
/**/
-void (*addtoline) _((int));
+void (*addtoline) (int);
/* != 0 means history substitution is turned off */
diff --git a/Src/makepro.awk b/Src/makepro.awk
index 0d53c5850..56c4f4595 100644
--- a/Src/makepro.awk
+++ b/Src/makepro.awk
@@ -131,8 +131,8 @@ BEGIN {
sub(/@-.*$/, "", dnam)
# Put parens etc. back
- gsub(/@[{]/, " _((", dcltor)
- gsub(/@}/, "))", dcltor)
+ gsub(/@[{]/, " (", dcltor)
+ gsub(/@}/, ")", dcltor)
gsub(/@</, "(", dcltor)
gsub(/@>/, ")", dcltor)
gsub(/@!/, ",", dcltor)
diff --git a/Src/mem.c b/Src/mem.c
index fb4be47bf..0b6f76e46 100644
--- a/Src/mem.c
+++ b/Src/mem.c
@@ -1057,17 +1057,17 @@ zrealloc(void *ptr, size_t size)
#if !defined(__hpux) && !defined(DGUX) && !defined(__osf__)
# if defined(_BSD)
# ifndef HAVE_BRK_PROTO
- extern int brk _((caddr_t));
+ extern int brk (caddr_t);
# endif
# ifndef HAVE_SBRK_PROTO
- extern caddr_t sbrk _((int));
+ extern caddr_t sbrk (int);
# endif
# else
# ifndef HAVE_BRK_PROTO
- extern int brk _((void *));
+ extern int brk (void *);
# endif
# ifndef HAVE_SBRK_PROTO
- extern void *sbrk _((int));
+ extern void *sbrk (int);
# endif
# endif
#endif
diff --git a/Src/mkbltnmlst.sh b/Src/mkbltnmlst.sh
index 067ecdaf9..1994ace60 100644
--- a/Src/mkbltnmlst.sh
+++ b/Src/mkbltnmlst.sh
@@ -122,12 +122,12 @@ for bin_mod in $bin_mods; do
esac
done
echo " {"
- echo " extern int setup_${q_bin_mod} _((Module));"
- echo " extern int boot_${q_bin_mod} _((Module));"
- echo " extern int features_${q_bin_mod} _((Module,char***));"
- echo " extern int enables_${q_bin_mod} _((Module,int**));"
- echo " extern int cleanup_${q_bin_mod} _((Module));"
- echo " extern int finish_${q_bin_mod} _((Module));"
+ echo " extern int setup_${q_bin_mod} (Module);"
+ echo " extern int boot_${q_bin_mod} (Module);"
+ echo " extern int features_${q_bin_mod} (Module,char***);"
+ echo " extern int enables_${q_bin_mod} (Module,int**);"
+ echo " extern int cleanup_${q_bin_mod} (Module);"
+ echo " extern int finish_${q_bin_mod} (Module);"
echo
echo " register_module(\"$bin_mod\","
echo " setup_${q_bin_mod},"
diff --git a/Src/modentry.c b/Src/modentry.c
index 4d8217f43..23c499d94 100644
--- a/Src/modentry.c
+++ b/Src/modentry.c
@@ -1,10 +1,10 @@
#include "zsh.mdh"
-int setup_ _((Module));
-int boot_ _((Module));
-int cleanup_ _((Module));
-int finish_ _((Module));
-int modentry _((int boot, Module m, void *ptr));
+int setup_ (Module);
+int boot_ (Module);
+int cleanup_ (Module);
+int finish_ (Module);
+int modentry (int boot, Module m, void *ptr);
/**/
int
diff --git a/Src/parse.c b/Src/parse.c
index 40eb0ee0b..334365649 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -2392,7 +2392,7 @@ par_nl_wordlist(void)
*/
/**/
-void (*condlex) _((void)) = zshlex;
+void (*condlex) (void) = zshlex;
/*
* cond : cond_1 { SEPER } [ DBAR { SEPER } cond ]
diff --git a/Src/prototypes.h b/Src/prototypes.h
index e3db4f5ee..3578482d0 100644
--- a/Src/prototypes.h
+++ b/Src/prototypes.h
@@ -28,9 +28,9 @@
*/
#ifndef HAVE_STDLIB_H
-char *malloc _((size_t));
-char *realloc _((void *, size_t));
-char *calloc _((size_t, size_t));
+char *malloc (size_t);
+char *realloc (void *, size_t);
+char *calloc (size_t, size_t);
#endif
#if !(defined(USES_TERMCAP_H) || defined(USES_TERM_H))
@@ -45,11 +45,11 @@ char *calloc _((size_t, size_t));
#else
#define TC_CONST
#endif
-extern int tgetent _((char *bp, TC_CONST char *name));
-extern int tgetnum _((char *id));
-extern int tgetflag _((char *id));
-extern char *tgetstr _((char *id, char **area));
-extern int tputs _((TC_CONST char *cp, int affcnt, int (*outc) (int)));
+extern int tgetent (char *bp, TC_CONST char *name);
+extern int tgetnum (char *id);
+extern int tgetflag (char *id);
+extern char *tgetstr (char *id, char **area);
+extern int tputs (TC_CONST char *cp, int affcnt, int (*outc) (int));
#undef TC_CONST
#endif
@@ -70,30 +70,30 @@ char *tgoto(const char *cap, int col, int row);
#endif
#ifdef __osf__
-char *mktemp _((char *));
+char *mktemp (char *);
#endif
#if defined(__osf__) && defined(__alpha) && defined(__GNUC__)
/* Digital cc does not need these prototypes, gcc does need them */
# ifndef HAVE_IOCTL_PROTO
-int ioctl _((int d, unsigned long request, void *argp));
+int ioctl (int d, unsigned long request, void *argp);
# endif
# ifndef HAVE_MKNOD_PROTO
-int mknod _((const char *pathname, int mode, dev_t device));
+int mknod (const char *pathname, int mode, dev_t device);
# endif
-int nice _((int increment));
-int select _((int nfds, fd_set * readfds, fd_set * writefds, fd_set * exceptfds, struct timeval *timeout));
+int nice (int increment);
+int select (int nfds, fd_set * readfds, fd_set * writefds, fd_set * exceptfds, struct timeval *timeout);
#endif
#if defined(DGUX) && defined(__STDC__)
/* Just plain missing. */
-extern int getrlimit _((int resource, struct rlimit *rlp));
-extern int setrlimit _((int resource, const struct rlimit *rlp));
-extern int getrusage _((int who, struct rusage *rusage));
-extern int gettimeofday _((struct timeval *tv, struct timezone *tz));
-extern int wait3 _((union wait *wait_status, int options, struct rusage *rusage));
-extern int getdomainname _((char *name, int maxlength));
-extern int select _((int nfds, fd_set * readfds, fd_set * writefds, fd_set * exceptfds, struct timeval *timeout));
+extern int getrlimit (int resource, struct rlimit *rlp);
+extern int setrlimit (int resource, const struct rlimit *rlp);
+extern int getrusage (int who, struct rusage *rusage);
+extern int gettimeofday (struct timeval *tv, struct timezone *tz);
+extern int wait3 (union wait *wait_status, int options, struct rusage *rusage);
+extern int getdomainname (char *name, int maxlength);
+extern int select (int nfds, fd_set * readfds, fd_set * writefds, fd_set * exceptfds, struct timeval *timeout);
#endif /* DGUX and __STDC__ */
#ifdef __NeXT__
@@ -101,34 +101,34 @@ extern pid_t getppid(void);
#endif
#if defined(__sun__) && !defined(__SVR4) /* SunOS */
-extern char *strerror _((int errnum));
+extern char *strerror (int errnum);
#endif
/**************************************************/
/*** prototypes for functions built in compat.c ***/
#ifndef HAVE_STRSTR
-extern char *strstr _((const char *s, const char *t));
+extern char *strstr (const char *s, const char *t);
#endif
#ifndef HAVE_GETHOSTNAME
-extern int gethostname _((char *name, size_t namelen));
+extern int gethostname (char *name, size_t namelen);
#endif
#ifndef HAVE_GETTIMEOFDAY
-extern int gettimeofday _((struct timeval *tv, struct timezone *tz));
+extern int gettimeofday (struct timeval *tv, struct timezone *tz);
#endif
#ifndef HAVE_DIFFTIME
-extern double difftime _((time_t t2, time_t t1));
+extern double difftime (time_t t2, time_t t1);
#endif
#ifndef HAVE_STRERROR
-extern char *strerror _((int errnum));
+extern char *strerror (int errnum);
#endif
/*** end of prototypes for functions in compat.c ***/
/***************************************************/
#ifndef HAVE_MEMMOVE
-extern void bcopy _((const void *, void *, size_t));
+extern void bcopy (const void *, void *, size_t);
#endif
diff --git a/Src/signals.h b/Src/signals.h
index 391f11fed..7910f6b79 100644
--- a/Src/signals.h
+++ b/Src/signals.h
@@ -27,7 +27,7 @@
*
*/
-#define SIGNAL_HANDTYPE void (*)_((int))
+#define SIGNAL_HANDTYPE void (*)(int)
#ifndef HAVE_KILLPG
# define killpg(pgrp,sig) kill(-(pgrp),sig)
@@ -145,7 +145,7 @@
#ifdef BSD_SIGNALS
#define signal_block(S) sigblock(S)
#else
-extern sigset_t signal_block _((sigset_t));
+extern sigset_t signal_block (sigset_t);
#endif /* BSD_SIGNALS */
-extern sigset_t signal_unblock _((sigset_t));
+extern sigset_t signal_unblock (sigset_t);
diff --git a/Src/utils.c b/Src/utils.c
index c8831c85e..ce4e875fd 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -5277,6 +5277,7 @@ nicedupstring(char const *s)
}
+/**/
#ifndef MULTIBYTE_SUPPORT
/* Unmetafy and output a string, displaying special characters readably. */
@@ -5311,8 +5312,9 @@ niceztrlen(char const *s)
}
return l;
}
-#endif
+/**/
+#endif
/**/
#ifdef MULTIBYTE_SUPPORT
@@ -7633,6 +7635,7 @@ mode_to_octal(mode_t mode)
return m;
}
+/**/
#ifdef MAILDIR_SUPPORT
/*
* Stat a file. If it's a maildir, check all messages
@@ -7756,4 +7759,6 @@ mailstat(char *path, struct stat *st)
*st = st_ret_last = st_ret;
return 0;
}
+
+/**/
#endif
diff --git a/Src/zsh.h b/Src/zsh.h
index fae62b8d0..090abf8f5 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -618,7 +618,7 @@ union linkroot {
/* Specific elements of linked lists */
/*************************************/
-typedef void (*voidvoidfnptr_t) _((void));
+typedef void (*voidvoidfnptr_t) (void);
/*
* Element of the prepromptfns list.
@@ -678,7 +678,7 @@ struct timedfn {
#define COND_MOD 18
#define COND_MODI 19
-typedef int (*CondHandler) _((char **, int));
+typedef int (*CondHandler) (char **, int);
struct conddef {
Conddef next; /* next in list */
@@ -1164,28 +1164,28 @@ struct dirsav {
/* Definitions for Hash Tables */
/*******************************/
-typedef void *(*VFunc) _((void *));
-typedef void (*FreeFunc) _((void *));
+typedef void *(*VFunc) (void *);
+typedef void (*FreeFunc) (void *);
-typedef unsigned (*HashFunc) _((const char *));
-typedef void (*TableFunc) _((HashTable));
+typedef unsigned (*HashFunc) (const char *);
+typedef void (*TableFunc) (HashTable);
/*
* Note that this is deliberately "char *", not "const char *",
* since the AddNodeFunc is passed a pointer to a string that
* will be stored and later freed.
*/
-typedef void (*AddNodeFunc) _((HashTable, char *, void *));
-typedef HashNode (*GetNodeFunc) _((HashTable, const char *));
-typedef HashNode (*RemoveNodeFunc) _((HashTable, const char *));
-typedef void (*FreeNodeFunc) _((HashNode));
-typedef int (*CompareFunc) _((const char *, const char *));
+typedef void (*AddNodeFunc) (HashTable, char *, void *);
+typedef HashNode (*GetNodeFunc) (HashTable, const char *);
+typedef HashNode (*RemoveNodeFunc) (HashTable, const char *);
+typedef void (*FreeNodeFunc) (HashNode);
+typedef int (*CompareFunc) (const char *, const char *);
/* type of function that is passed to *
* scanhashtable or scanmatchtable */
-typedef void (*ScanFunc) _((HashNode, int));
-typedef void (*ScanTabFunc) _((HashTable, ScanFunc, int));
+typedef void (*ScanFunc) (HashNode, int);
+typedef void (*ScanTabFunc) (HashTable, ScanFunc, int);
-typedef void (*PrintTableStats) _((HashTable));
+typedef void (*PrintTableStats) (HashTable);
/* Hash table for standard open hashing. Instances of struct hashtable can be *
* created only by newhashtable(). In fact, this function creates an instance *
@@ -1352,7 +1352,7 @@ struct funcstack {
/* node in list of function call wrappers */
-typedef int (*WrapFunc) _((Eprog, FuncWrap, char *));
+typedef int (*WrapFunc) (Eprog, FuncWrap, char *);
struct funcwrap {
FuncWrap next;
@@ -1428,8 +1428,8 @@ enum {
* builtin structure.
*/
-typedef int (*HandlerFunc) _((char *, char **, Options, int));
-typedef int (*HandlerFuncAssign) _((char *, char **, LinkList, Options, int));
+typedef int (*HandlerFunc) (char *, char **, Options, int);
+typedef int (*HandlerFuncAssign) (char *, char **, LinkList, Options, int);
#define NULLBINCMD ((HandlerFunc) 0)
struct builtin {
@@ -1526,10 +1526,10 @@ struct module {
/* Module record is an alias */
#define MOD_ALIAS (1<<6)
-typedef int (*Module_generic_func) _((void));
-typedef int (*Module_void_func) _((Module));
-typedef int (*Module_features_func) _((Module, char ***));
-typedef int (*Module_enables_func) _((Module, int **));
+typedef int (*Module_generic_func) (void);
+typedef int (*Module_void_func) (Module);
+typedef int (*Module_features_func) (Module, char ***);
+typedef int (*Module_enables_func) (Module, int **);
struct linkedmod {
char *name;
@@ -1574,7 +1574,7 @@ struct feature_enables {
/* C-function hooks */
-typedef int (*Hookfn) _((Hookdef, void *));
+typedef int (*Hookfn) (Hookdef, void *);
struct hookdef {
Hookdef next;
@@ -1789,33 +1789,33 @@ typedef const struct gsu_array *GsuArray;
typedef const struct gsu_hash *GsuHash;
struct gsu_scalar {
- char *(*getfn) _((Param));
- void (*setfn) _((Param, char *));
- void (*unsetfn) _((Param, int));
+ char *(*getfn) (Param);
+ void (*setfn) (Param, char *);
+ void (*unsetfn) (Param, int);
};
struct gsu_integer {
- zlong (*getfn) _((Param));
- void (*setfn) _((Param, zlong));
- void (*unsetfn) _((Param, int));
+ zlong (*getfn) (Param);
+ void (*setfn) (Param, zlong);
+ void (*unsetfn) (Param, int);
};
struct gsu_float {
- double (*getfn) _((Param));
- void (*setfn) _((Param, double));
- void (*unsetfn) _((Param, int));
+ double (*getfn) (Param);
+ void (*setfn) (Param, double);
+ void (*unsetfn) (Param, int);
};
struct gsu_array {
- char **(*getfn) _((Param));
- void (*setfn) _((Param, char **));
- void (*unsetfn) _((Param, int));
+ char **(*getfn) (Param);
+ void (*setfn) (Param, char **);
+ void (*unsetfn) (Param, int);
};
struct gsu_hash {
- HashTable (*getfn) _((Param));
- void (*setfn) _((Param, HashTable));
- void (*unsetfn) _((Param, int));
+ HashTable (*getfn) (Param);
+ void (*setfn) (Param, HashTable);
+ void (*unsetfn) (Param, int);
};
@@ -2984,7 +2984,7 @@ enum errflag_bits {
/* Sorting */
/***********/
-typedef int (*CompareFn) _((const void *, const void *));
+typedef int (*CompareFn) (const void *, const void *);
enum {
SORTIT_ANYOLDHOW = 0, /* Defaults */
@@ -3042,13 +3042,13 @@ struct hist_stack {
short *chwords;
int chwordlen;
int chwordpos;
- int (*hgetc) _((void));
- void (*hungetc) _((int));
- void (*hwaddc) _((int));
- void (*hwbegin) _((int));
- void (*hwabort) _((void));
- void (*hwend) _((void));
- void (*addtoline) _((int));
+ int (*hgetc) (void);
+ void (*hungetc) (int);
+ void (*hwaddc) (int);
+ void (*hwbegin) (int);
+ void (*hwabort) (void);
+ void (*hwend) (void);
+ void (*addtoline) (int);
unsigned char *cstack;
int csp;
int hist_keep_comment;
@@ -3218,7 +3218,7 @@ enum {
/* compctl entry point pointers */
-typedef int (*CompctlReadFn) _((char *, char **, Options, char *));
+typedef int (*CompctlReadFn) (char *, char **, Options, char *);
/* ZLE entry point pointer */
diff --git a/Src/zsh_system.h b/Src/zsh_system.h
index 16f724401..5c004d53e 100644
--- a/Src/zsh_system.h
+++ b/Src/zsh_system.h
@@ -82,12 +82,6 @@
*/
#define _STRPTIME_DONTZERO
-#ifdef PROTOTYPES
-# define _(Args) Args
-#else
-# define _(Args) ()
-#endif
-
#ifndef HAVE_ALLOCA
# define alloca zhalloc
#else
@@ -101,7 +95,7 @@
# pragma alloca
# else
# ifndef alloca
-char *alloca _((size_t));
+char *alloca (size_t);
# endif
# endif
# endif
diff --git a/aclocal.m4 b/aclocal.m4
index c26e2d834..792d533f2 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -2,56 +2,6 @@
# Copyright (C) 1992, 1994 Free Software Foundation, Inc.
# Francois Pinard <pinard@xxxxxxxxxxxxxxxx>, 1992.
-# @defmac fp_PROG_CC_STDC
-# @maindex PROG_CC_STDC
-# @ovindex CC
-# If the C compiler in not in ANSI C mode by default, try to add an option
-# to output variable @code{CC} to make it so. This macro tries various
-# options that select ANSI C on some system or another. It considers the
-# compiler to be in ANSI C mode if it defines @code{__STDC__} to 1 and
-# handles function prototypes correctly.
-#
-# If you use this macro, you should check after calling it whether the C
-# compiler has been set to accept ANSI C; if not, the shell variable
-# @code{fp_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
-# code in ANSI C, you can make an un-ANSIfied copy of it by using the
-# program @code{ansi2knr}, which comes with Ghostscript.
-# @end defmac
-
-define(fp_PROG_CC_STDC,
-[AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C,
-fp_cv_prog_cc_stdc,
-[fp_cv_prog_cc_stdc=no
-ac_save_CFLAGS="$CFLAGS"
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX -qlanglvl=ansi
-# Ultrix and OSF/1 -std1
-# HP-UX -Ae or -Aa -D_HPUX_SOURCE
-# SVR4 -Xc
-# For HP-UX, we try -Ae first; this turns on ANSI but also extensions,
-# as well as defining _HPUX_SOURCE, and we can then use long long.
-# We keep the old version for backward compatibility.
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" -Xc
-do
- CFLAGS="$ac_save_CFLAGS $ac_arg"
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
-[#ifndef __STDC__
-choke me
-#endif
-]], [[int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};]])],
-[fp_cv_prog_cc_stdc="$ac_arg"; break],[])
-done
-CFLAGS="$ac_save_CFLAGS"
-])
-case "x$fp_cv_prog_cc_stdc" in
- x|xno) ;;
- *) CC="$CC $fp_cv_prog_cc_stdc" ;;
-esac
-])
-
AC_DEFUN(AC_PROG_LN,
[AC_MSG_CHECKING(whether ln works)
AC_CACHE_VAL(ac_cv_prog_LN,
diff --git a/configure.ac b/configure.ac
index 175d90433..ba3f2fe90 100644
--- a/configure.ac
+++ b/configure.ac
@@ -273,11 +273,6 @@ fi],
AC_DEFINE(CONFIG_LOCALE)
)
-dnl Do you want to compile as K&R C.
-AC_ARG_ENABLE(ansi2knr,
-AS_HELP_STRING([--enable-ansi2knr],[translate source to K&R C before compiling]),
-[ansi2knr="$enableval"], [ansi2knr=default])
-
ifdef([runhelpdir],[undefine([runhelpdir])])dnl
AC_ARG_ENABLE(runhelpdir,
AS_HELP_STRING([--enable-runhelpdir=DIR],[the directory in which to install run-help files]),
@@ -483,7 +478,7 @@ fi
dnl if the user hasn't specified CFLAGS, then
dnl if compiler is gcc, then use -O2 and some warning flags
dnl else use -O
-if test -n "$auto_cflags" && test ."$ansi2knr" != .yes; then
+if test -n "$auto_cflags"; then
if test "${enable_zsh_debug}" = yes; then
if test -n "$GCC"; then
CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -ggdb"
@@ -558,28 +553,6 @@ case "$host_os" in
esac
fp_PROG_CC_STDC
-AC_MSG_CHECKING([whether to use prototypes])
-if test ."$ansi2knr" = .yes || test ."$ansi2knr" = .no; then
- msg="(overridden) "
-else
- msg=
- if test ."$fp_cv_prog_cc_stdc" = .no; then
- ansi2knr=yes
- else
- ansi2knr=no
- fi
-fi
-AH_TEMPLATE([PROTOTYPES],
-[Define to 1 if ANSI function prototypes are usable.])
-if test "$ansi2knr" = yes; then
- AC_MSG_RESULT(${msg}no)
- U=_
-else
- AC_MSG_RESULT(${msg}yes)
- AC_DEFINE(PROTOTYPES)
- U=
-fi
-AC_SUBST(U)
AC_FUNC_ALLOCA dnl Check how to get `alloca'.
@@ -647,18 +620,6 @@ case "$LC_PAPER" in
esac
AC_SUBST(PAPERSIZE)
-AC_CHECK_PROGS([ANSI2KNR], [ansi2knr], [: ansi2knr])
-
-if test x"$ansi2knr" = xyes && test x"$ANSI2KNR" = x": ansi2knr"; then
- echo "----------"
- echo "configure fatal error:"
- echo "ansi2knr was specified (--enable-ansi2knr) but the program could not be found."
- echo "Either remove the configure option if it is not required or build the ansi2knr"
- echo "program before reconfiguring Zsh. The source code for ansi2knr is also"
- echo "available in the GPL directory on Zsh distribution sites."
- exit 1
-fi
-
dnl ------------------
dnl CHECK HEADER FILES
dnl ------------------
Messages sorted by:
Reverse Date,
Date,
Thread,
Author