fixed: implicit function _fullpath

This commit is contained in:
Sven Vogel 2024-06-05 11:49:55 +02:00
parent edefc717c8
commit 3587451b93
4 changed files with 14 additions and 11 deletions

View File

@ -2,7 +2,7 @@ name: MSYS2
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
msys2-ucrt64: msys2-mingw64:
runs-on: windows-latest runs-on: windows-latest
defaults: defaults:
run: run:

View File

@ -219,6 +219,7 @@ void AST_delete_node(struct AST_Node_t *node) {
} }
if (node->parent != NULL) { if (node->parent != NULL) {
[[maybe_unused]]
const struct AST_Node_t* child = AST_detach_child(node->parent, node); const struct AST_Node_t* child = AST_detach_child(node->parent, node);
assert(child == node); assert(child == node);
} }

View File

@ -16,6 +16,8 @@
#elif defined(_WIN32) || defined(WIN32) #elif defined(_WIN32) || defined(WIN32)
#include <Windows.h> #include <Windows.h>
// for _fullpath
#include <stdlib.h>
#define MAX_PATH_BYTES _MAX_PATH #define MAX_PATH_BYTES _MAX_PATH
@ -122,15 +124,15 @@ void print_diagnostic(ModuleFile *file, TokenLocation *location, Message kind, c
free((void *) absolute_path); free((void *) absolute_path);
const size_t lines = location->line_end - location->line_start + 1; const unsigned long int lines = location->line_end - location->line_start + 1;
for (size_t l = 0; l < lines; l++) { for (unsigned long int l = 0; l < lines; l++) {
printf(" %4ld | ", location->line_start + l); printf(" %4ld | ", location->line_start + l);
size_t chars = 0; unsigned long int chars = 0;
// print line before token group start // print line before token group start
size_t limit = min(location->col_start, SEEK_BUF_BYTES); unsigned long int limit = min(location->col_start, SEEK_BUF_BYTES);
while (limit > 1) { while (limit > 1) {
custom_fgets(buffer, (int) limit, file->handle); custom_fgets(buffer, (int) limit, file->handle);
chars += printf("%s", buffer); chars += printf("%s", buffer);
@ -168,13 +170,13 @@ void print_diagnostic(ModuleFile *file, TokenLocation *location, Message kind, c
} }
printf(" | "); printf(" | ");
for (size_t i = 1; i < location->col_start; i++) { for (unsigned long int i = 1; i < location->col_start; i++) {
printf(" "); printf(" ");
} }
printf("%s", accent_color); printf("%s", accent_color);
printf("^"); printf("^");
for (size_t i = 0; i < location->col_end - location->col_start; i++) { for (unsigned long int i = 0; i < location->col_end - location->col_start; i++) {
printf("~"); printf("~");
} }
@ -320,7 +322,7 @@ const char *get_absolute_path(const char *path) {
#elif defined(_WIN32) || defined(WIN32) #elif defined(_WIN32) || defined(WIN32)
// use Windows CRT specific function // use Windows CRT specific function
char absolute_path[MAX_PATH_BYTES]; char absolute_path[MAX_PATH_BYTES];
_fullpath(path, absolute_path, _MAX_PATH); _fullpath((char*) path, absolute_path, _MAX_PATH);
#endif #endif
return strdup(absolute_path); return strdup(absolute_path);

View File

@ -15,9 +15,9 @@
#endif #endif
typedef struct FileDiagnosticStatistics_t { typedef struct FileDiagnosticStatistics_t {
size_t error_count; unsigned long int error_count;
size_t warning_count; unsigned long int warning_count;
size_t info_count; unsigned long int info_count;
} FileDiagnosticStatistics; } FileDiagnosticStatistics;
typedef struct ModuleFile_t { typedef struct ModuleFile_t {