aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2025-09-19 17:37:36 +0200
committerRuben Beltran del Rio <git@r.bdr.sh>2025-09-19 17:37:36 +0200
commite9553cf80c3a5588b68a38ea7a99936a8b9b88b7 (patch)
tree3a60831f6142470467cc14e8fb7e160613f5c711
parent00ea2943c81d2b3a8531e8b7b591de3443b1250c (diff)
Fix warnings for older compilers
-rw-r--r--Makefile2
-rw-r--r--src/wmap_parser.c16
2 files changed, 11 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 76a6d9c..7e2145e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
# WMAP Parser Makefile
# ANSI C compatible library with clean build structure
-CC = gcc
+CC ?= gcc
CFLAGS_RELEASE = -ansi -pedantic -Wall -Wextra -O2 -fomit-frame-pointer
CFLAGS_DEBUG = -ansi -pedantic -Wall -Wextra -g -DDEBUG
diff --git a/src/wmap_parser.c b/src/wmap_parser.c
index e0cf6d6..0fa8427 100644
--- a/src/wmap_parser.c
+++ b/src/wmap_parser.c
@@ -1,5 +1,9 @@
#include "wmap_parser.h"
+/* Forward declarations for older compilers */
+static int wmap_lexer_is_identifier_char(char c);
+static int wmap_lexer_is_keyword(const char* text, const char* keyword);
+
static void wmap_lexer_init(wmap_lexer_t* lexer, const char* input) {
lexer->input = input;
lexer->pos = 0;
@@ -18,7 +22,7 @@ static void wmap_lexer_skip_whitespace(wmap_lexer_t* lexer) {
}
}
-WMAP_68K_INLINE int wmap_lexer_is_identifier_char(char c) WMAP_68K_FAST_CALL {
+static int wmap_lexer_is_identifier_char(char c) {
return c != '-' && c != '+' && c != ',' && c != '[' && c != ']' &&
c != '(' && c != ')' && c != '\n' && c != '\r' && c != '\0' && c != ' ' && c != '\t';
}
@@ -104,7 +108,7 @@ static wmap_token_type_t wmap_lexer_next_token(wmap_lexer_t* lexer) {
}
}
- if (isdigit(c) || c == '.') {
+ if (isdigit((unsigned char)c) || c == '.') {
start = lexer->pos;
has_dot = 0;
@@ -112,12 +116,12 @@ static wmap_token_type_t wmap_lexer_next_token(wmap_lexer_t* lexer) {
has_dot = 1;
lexer->pos++;
lexer->col++;
- if (!isdigit(lexer->input[lexer->pos])) {
+ if (!isdigit((unsigned char)lexer->input[lexer->pos])) {
return lexer->current_token = WMAP_TOKEN_ERROR;
}
}
- while (isdigit(lexer->input[lexer->pos])) {
+ while (isdigit((unsigned char)lexer->input[lexer->pos])) {
lexer->pos++;
lexer->col++;
}
@@ -126,7 +130,7 @@ static wmap_token_type_t wmap_lexer_next_token(wmap_lexer_t* lexer) {
has_dot = 1;
lexer->pos++;
lexer->col++;
- while (isdigit(lexer->input[lexer->pos])) {
+ while (isdigit((unsigned char)lexer->input[lexer->pos])) {
lexer->pos++;
lexer->col++;
}
@@ -169,7 +173,7 @@ static wmap_token_type_t wmap_lexer_next_token(wmap_lexer_t* lexer) {
return lexer->current_token = WMAP_TOKEN_ERROR;
}
-WMAP_68K_INLINE int wmap_lexer_is_keyword(const char* text, const char* keyword) WMAP_68K_FAST_CALL {
+static int wmap_lexer_is_keyword(const char* text, const char* keyword) {
int i = 0;
while (text[i] && keyword[i]) {
char tc = text[i];