Regression with .gitkeep in project init. List.init incorrectly didn't have the first argument the allocator. Added .init to priority queue. Created mem thread allocator alias. Correctly handle ident aliases. Allow ident on builtin aliases.

This commit is contained in:
Christoffer Lerno
2025-02-21 21:34:48 +01:00
parent e674deb486
commit 855be92881
10 changed files with 35 additions and 21 deletions

View File

@@ -406,6 +406,7 @@ bool decl_needs_prefix(Decl *decl)
switch (decl->decl_kind)
{
case DECL_VAR:
case DECL_DEFINE:
case DECL_FUNC:
case DECL_MACRO:
return !decl->is_autoimport;

View File

@@ -2109,10 +2109,12 @@ static inline Decl *parse_def_attribute(ParseContext *c)
CONSUME_OR_RET(TOKEN_LBRACE, poisoned_decl);
bool is_cond;
if (!parse_attributes(c, &attributes, NULL, NULL, &is_cond)) return poisoned_decl;
bool is_builtin;
if (!parse_attributes(c, &attributes, NULL, decl_needs_prefix(decl) ? &is_builtin : NULL, &is_cond)) return poisoned_decl;
CONSUME_OR_RET(TOKEN_RBRACE, poisoned_decl);
decl->attr_decl.attrs = attributes;
decl->is_cond = is_cond;
decl->is_autoimport = is_builtin;
if (!parse_attributes_for_global(c, decl)) return poisoned_decl;
CONSUME_EOS_OR_RET(poisoned_decl);
return decl;

View File

@@ -1093,6 +1093,9 @@ static inline bool sema_expr_analyse_identifier(SemaContext *context, Type *to,
case DECL_MACRO:
message = "Macros from other modules must be prefixed with the module name.";
break;
case DECL_DEFINE:
message = "Aliases from other modules must be prefixed with the module name.";
break;
default:
UNREACHABLE
}

View File

@@ -509,7 +509,7 @@ const char *file_append_path_temp(const char *path, const char *name)
#endif
// format the string safely
bool insert_separator = path[path_len - 1] == '/' || path[path_len - 1] == separator;
bool insert_separator = path[path_len - 1] != '/' && path[path_len - 1] != separator;
int written = insert_separator
? snprintf(path_buffer, PATH_BUFFER_SIZE, "%s%c%s", path, separator, name)
: snprintf(path_buffer, PATH_BUFFER_SIZE, "%s%s", path, name);