aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--src/cli.c2
-rw-r--r--src/common.h2
-rw-r--r--src/preprocess.c5
-rw-r--r--src/std.h10
5 files changed, 17 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 9505295..3e3a420 100644
--- a/Makefile
+++ b/Makefile
@@ -25,9 +25,9 @@ $(BUILD_DIR):
@mkdir -p $(BUILD_DIR)
$(BUILD_ROOT_DIR)/$(TARGET): $(OBJECTS)
- $(CC) -MMD -g -O0 -o $@ $^
+ $(CC) -Wall -MMD -g -O0 -o $@ $^
$(BUILD_DIR)/%.o: src/%.c
- $(CC) -c -MMD -g -O0 -o $@ $<
+ $(CC) -c -Wall -MMD -g -O0 -o $@ $<
-include $(BUILD_DIR)/*.d
diff --git a/src/cli.c b/src/cli.c
index a55d17e..4efd2e2 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -22,6 +22,8 @@ CliArgs* parse_cli_args(int argc, char** argv) {
// ignore
} else if (c == 'O') {
// ignore
+ } else if (c == 'W') {
+ // ignore
} else if (c == 'M' && argv[i][2] == '\0') {
// ignore -M
} else if (c == 'o') {
diff --git a/src/common.h b/src/common.h
index f8f6b1d..98e27e1 100644
--- a/src/common.h
+++ b/src/common.h
@@ -3,7 +3,7 @@
#include "std.h"
-void fatal_error(const char* msg, ...);
+_Noreturn void fatal_error(const char* msg, ...);
#define unreachable() fatal_error("%s:%d: unreachable", __FILE__, __LINE__)
#define unimplemented() fatal_error("%s:%d: unimplemented", __FILE__, __LINE__)
diff --git a/src/preprocess.c b/src/preprocess.c
index 03a2121..b1753c2 100644
--- a/src/preprocess.c
+++ b/src/preprocess.c
@@ -690,12 +690,12 @@ static const char* resolve_include_name(Preprocessor* pp, const Token* include_n
char* current_filename = strdup(include_name_token->loc.filename);
const char* current_dir = dirname(current_filename);
char* buf = calloc(strlen(include_name) - 2 + 1 + strlen(current_dir) + 1, sizeof(char));
- sprintf(buf, "%s/%.*s", current_dir, strlen(include_name) - 2, include_name + 1);
+ sprintf(buf, "%s/%.*s", current_dir, INT_CAST strlen(include_name) - 2, include_name + 1);
return buf;
} else {
for (int i = 0; i < pp->n_include_paths; ++i) {
char* buf = calloc(strlen(include_name) - 2 + 1 + strlen(pp->include_paths[i]) + 1, sizeof(char));
- sprintf(buf, "%s/%.*s", pp->include_paths[i], strlen(include_name) - 2, include_name + 1);
+ sprintf(buf, "%s/%.*s", pp->include_paths[i], INT_CAST strlen(include_name) - 2, include_name + 1);
if (access(buf, F_OK | R_OK) == 0) {
return buf;
}
@@ -1286,7 +1286,6 @@ static void preprocess_text_line(Preprocessor* pp) {
// '#' 'pragma' ...
// '#' new-line
static void preprocess_group_part(Preprocessor* pp) {
- int first_token_pos = pp->pos;
Token* tok = peek_pp_token(pp);
if (tok->kind == TokenKind_pp_directive_if || tok->kind == TokenKind_pp_directive_ifdef ||
tok->kind == TokenKind_pp_directive_ifndef) {
diff --git a/src/std.h b/src/std.h
index ad31747..ae67d0f 100644
--- a/src/std.h
+++ b/src/std.h
@@ -46,6 +46,16 @@ int system(const char*);
} \
} while (0)
+#ifdef __ducc__
+#define _Noreturn
+#endif
+
+#ifdef __ducc__
+#define INT_CAST
+#else
+#define INT_CAST (int)
+#endif
+
#include <stdarg.h>
int vfprintf(FILE*, const char*, va_list);