Skip to content

Commit

Permalink
Fix -pedantic warnings as well
Browse files Browse the repository at this point in the history
  • Loading branch information
jpco committed Dec 29, 2024
1 parent f31f07a commit a9dfc5e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 2 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ static Noreturn usage(void) {
" -p don't load functions from the environment\n"
" -o don't open stdin, stdout, and stderr if they were closed\n"
" -d don't ignore SIGQUIT or SIGTERM\n"
);
eprint(
#if GCINFO
" -I print garbage collector information\n"
#endif
Expand Down
2 changes: 1 addition & 1 deletion match.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static int rangematch(const char *p, const char *q, char c) {
Boolean neg;
Boolean matched = FALSE;
Boolean advanceq = (q != QUOTED && q != UNQUOTED);
#define QX(expr) (advanceq ? (expr) : (void)0)
#define QX(expr) (advanceq ? (expr) : 0)
if (*p == '~' && !ISQUOTED(q, 0)) {
p++, QX(q++);
neg = TRUE;
Expand Down
6 changes: 3 additions & 3 deletions prim.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
static Dict *prims;

extern List *prim(char *s, List *list, Binding *binding, int evalflags) {
List *(*p)(List *, Binding *, int);
p = (List *(*)(List *, Binding *, int)) dictget(prims, s);
Prim *p;
p = (Prim *) dictget(prims, s);
if (p == NULL)
fail("es:prim", "unknown primitive: %s", s);
return (*p)(list, binding, evalflags);
return (p->prim)(list, binding, evalflags);
}

static char *list_prefix;
Expand Down
8 changes: 6 additions & 2 deletions prim.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
/* prim.h -- definitions for es primitives ($Revision: 1.1.1.1 $) */

typedef struct { List *(*prim)(List *, Binding *, int); } Prim;

#define PRIM(name) static List *CONCAT(prim_,name)( \
List UNUSED *list, Binding UNUSED *binding, int UNUSED evalflags \
)
#define X(name) (primdict = dictput( \
#define X(name) STMT( \
static Prim CONCAT(prim_struct_,name) = { CONCAT(prim_,name) }; \
primdict = dictput( \
primdict, \
STRING(name), \
(void *) CONCAT(prim_,name) \
(void *) &CONCAT(prim_struct_,name) \
))

extern Dict *initprims_controlflow(Dict *primdict); /* prim-ctl.c */
Expand Down
4 changes: 3 additions & 1 deletion var.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,16 @@ static Boolean isexported(const char *name) {

/* setnoexport -- mark a list of variable names not for export */
extern void setnoexport(List *list) {
static char noexportchar = '!';

isdirty = TRUE;
if (list == NULL) {
noexport = NULL;
return;
}
gcdisable();
for (noexport = mkdict(); list != NULL; list = list->next)
noexport = dictput(noexport, getstr(list->term), (void *) setnoexport);
noexport = dictput(noexport, getstr(list->term), &noexportchar);
gcenable();
}

Expand Down

0 comments on commit a9dfc5e

Please sign in to comment.