summaryrefslogtreecommitdiff
path: root/usr.bin/make/make.h
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2022-02-04 23:22:19 +0000
committerrillig <rillig@NetBSD.org>2022-02-04 23:22:19 +0000
commit2bf5716a7b9fdcc681e834d8aabc5d5fdd340f1b (patch)
tree51e3c924b03f53012efeef3fabbcafb2a5a89b41 /usr.bin/make/make.h
parent96ab9b0200dc9f801397194d5fca21cd0cdec051 (diff)
make: use unsigned int for line numbers everywhere
Previously, some line numbers were stored as signed int while others were stored as size_t. Since line numbers are never negative, use an unsigned type. Since the maximum file size for makefiles is 1 GB (see loadfile), unsigned int is large enough even on 64-bit platforms. Using a single data types reduces the number of type conversions. Using unsigned int improves compatibility with C90 (printf %u instead of %zu), which is needed by bmake, which is derived from usr.bin/make. No functional change.
Diffstat (limited to 'usr.bin/make/make.h')
-rw-r--r--usr.bin/make/make.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/make/make.h b/usr.bin/make/make.h
index 308b34761eb..b41d55964ef 100644
--- a/usr.bin/make/make.h
+++ b/usr.bin/make/make.h
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.296 2022/01/31 20:49:27 rillig Exp $ */
+/* $NetBSD: make.h,v 1.297 2022/02/04 23:22:19 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -499,7 +499,7 @@ typedef struct GNode {
/* Filename where the GNode got defined, unlimited lifetime */
const char *fname;
/* Line number where the GNode got defined, 1-based */
- size_t lineno;
+ unsigned lineno;
} GNode;
/* Error levels for diagnostics during parsing. */
@@ -805,7 +805,7 @@ void SearchPath_Free(SearchPath *);
struct ForLoop;
int For_Eval(const char *) MAKE_ATTR_USE;
bool For_Accum(const char *, int *) MAKE_ATTR_USE;
-void For_Run(int, int);
+void For_Run(unsigned, unsigned);
bool For_NextIteration(struct ForLoop *, Buffer *);
char *ForLoop_Details(struct ForLoop *);
void ForLoop_Free(struct ForLoop *);
@@ -832,13 +832,14 @@ bool GetBooleanExpr(const char *, bool);
void Parse_Init(void);
void Parse_End(void);
-void PrintLocation(FILE *, bool, const char *, size_t);
+void PrintLocation(FILE *, bool, const char *, unsigned);
void PrintStackTrace(bool);
void Parse_Error(ParseErrorLevel, const char *, ...) MAKE_ATTR_PRINTFLIKE(2, 3);
bool Parse_VarAssign(const char *, bool, GNode *) MAKE_ATTR_USE;
void Parse_AddIncludeDir(const char *);
void Parse_File(const char *, int);
-void Parse_PushInput(const char *, int, int, Buffer, struct ForLoop *);
+void Parse_PushInput(const char *, unsigned, unsigned, Buffer,
+ struct ForLoop *);
void Parse_MainName(GNodeList *);
int Parse_NumErrors(void) MAKE_ATTR_USE;