aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-18 00:43:13 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-18 00:43:13 -0400
commit7e0b1a321466e89e43b9b23463530141355ff87d (patch)
tree8e43ea1987666179fc13cbeebdefad317dc46112
parent8e3c871f27bdf0fbc6ca347efc6d38bb81287115 (diff)
Deprecate linker directives
-rw-r--r--ast.c1
-rw-r--r--ast.h4
-rw-r--r--compile.c1
-rw-r--r--parse.c13
-rw-r--r--typecheck.c2
5 files changed, 1 insertions, 20 deletions
diff --git a/ast.c b/ast.c
index 0d2d6e5b..5ac5a325 100644
--- a/ast.c
+++ b/ast.c
@@ -157,7 +157,6 @@ CORD ast_to_xml(ast_t *ast)
T(NonOptional, "<NonOptional>%r</NonOptional>", ast_to_xml(data.value))
T(DocTest, "<DocTest>%r<output>%r</output></DocTest>", optional_tagged("expression", data.expr), xml_escape(data.output))
T(Use, "<Use>%r</Use>", xml_escape(data.path))
- T(LinkerDirective, "<LinkerDirective>%r</LinkerDirective>", xml_escape(data.directive))
T(InlineCCode, "<InlineCode>%r</InlineCode>", xml_escape(data.code))
default: return "???";
#undef T
diff --git a/ast.h b/ast.h
index 7ff6f539..a186f576 100644
--- a/ast.h
+++ b/ast.h
@@ -129,7 +129,6 @@ typedef enum {
Index, FieldAccess, Optional, NonOptional,
DocTest,
Use,
- LinkerDirective,
InlineCCode,
} ast_e;
@@ -301,9 +300,6 @@ struct ast_s {
enum { USE_LOCAL, USE_MODULE, USE_SHARED_OBJECT, USE_HEADER } what;
} Use;
struct {
- const char *directive;
- } LinkerDirective;
- struct {
CORD code;
struct type_s *type;
type_ast_t *type_ast;
diff --git a/compile.c b/compile.c
index 4ffdb0ab..d769bcb2 100644
--- a/compile.c
+++ b/compile.c
@@ -3243,7 +3243,6 @@ CORD compile(env_t *env, ast_t *ast)
}
case Use: code_err(ast, "Compiling 'use' as expression!");
case Defer: code_err(ast, "Compiling 'defer' as expression!");
- case LinkerDirective: code_err(ast, "Linker directives are not supported yet");
case Extern: code_err(ast, "Externs are not supported as expressions");
case TableEntry: code_err(ast, "Table entries should not be compiled directly");
case Declare: case Assign: case UpdateAssign: case For: case While: case StructDef: case LangDef:
diff --git a/parse.c b/parse.c
index d473942a..b72df361 100644
--- a/parse.c
+++ b/parse.c
@@ -98,7 +98,6 @@ static PARSER(parse_func_def);
static PARSER(parse_if);
static PARSER(parse_inline_c);
static PARSER(parse_lang_def);
-static PARSER(parse_linker);
static PARSER(parse_namespace);
static PARSER(parse_path);
static PARSER(parse_say);
@@ -1916,7 +1915,6 @@ PARSER(parse_namespace) {
||(stmt=optional(ctx, &pos, parse_lang_def))
||(stmt=optional(ctx, &pos, parse_func_def))
||(stmt=optional(ctx, &pos, parse_use))
- ||(stmt=optional(ctx, &pos, parse_linker))
||(stmt=optional(ctx, &pos, parse_extern))
||(stmt=optional(ctx, &pos, parse_inline_c))
||(stmt=optional(ctx, &pos, parse_declaration)))
@@ -1952,7 +1950,6 @@ PARSER(parse_file_body) {
||(stmt=optional(ctx, &pos, parse_lang_def))
||(stmt=optional(ctx, &pos, parse_func_def))
||(stmt=optional(ctx, &pos, parse_use))
- ||(stmt=optional(ctx, &pos, parse_linker))
||(stmt=optional(ctx, &pos, parse_extern))
||(stmt=optional(ctx, &pos, parse_inline_c))
||(stmt=optional(ctx, &pos, parse_top_declaration)))
@@ -2343,16 +2340,6 @@ PARSER(parse_use) {
return NewAST(ctx->file, start, pos, Use, .path=name, .what=what);
}
-PARSER(parse_linker) {
- const char *start = pos;
- if (!match_word(&pos, "!link")) return NULL;
- spaces(&pos);
- size_t len = strcspn(pos, "\r\n");
- const char *directive = GC_strndup(pos, len);
- pos += len;
- return NewAST(ctx->file, start, pos, LinkerDirective, .directive=directive);
-}
-
ast_t *parse_file(const char *path, jmp_buf *on_err) {
const char *resolved = resolve_path(path, ".", ".");
if (!resolved)
diff --git a/typecheck.c b/typecheck.c
index 576007a3..8f1e5e81 100644
--- a/typecheck.c
+++ b/typecheck.c
@@ -875,7 +875,7 @@ type_t *get_type(env_t *env, ast_t *ast)
case Extern: {
return parse_type_ast(env, Match(ast, Extern)->type);
}
- case Declare: case Assign: case DocTest: case LinkerDirective: {
+ case Declare: case Assign: case DocTest: {
return Type(VoidType);
}
case Use: {