~mcf/cproc

use enum in signatures of 'peek' and 'consume' v1 PROPOSED

Diogo Santos: 1
 use enum in signatures of 'peek' and 'consume'

 2 files changed, 4 insertions(+), 4 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~mcf/cproc/patches/53106/mbox | git am -3
Learn more about email & git

[PATCH] use enum in signatures of 'peek' and 'consume' Export this patch

GCC 13.2 warns about this with `-Wsign-compare`.
---
 cc.h | 4 ++--
 pp.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cc.h b/cc.h
index cb53b0d..8defc18 100644
--- a/cc.h
+++ b/cc.h
@@ -424,9 +424,9 @@ extern enum ppflags ppflags;
void ppinit(void);

void next(void);
bool peek(int);
bool peek(enum tokenkind);
char *expect(enum tokenkind, const char *);
bool consume(int);
bool consume(enum tokenkind);

/* type */

diff --git a/pp.c b/pp.c
index 99e56e8..62b9468 100644
--- a/pp.c
+++ b/pp.c
@@ -638,7 +638,7 @@ next(void)
}

bool
peek(int kind)
peek(enum tokenkind kind)
{
	static struct token pending;
	struct token old;
@@ -667,7 +667,7 @@ expect(enum tokenkind kind, const char *msg)
}

bool
consume(int kind)
consume(enum tokenkind kind)
{
	if (tok.kind != kind)
		return false;
-- 
2.45.1