aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-03-03 15:22:22 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-03-03 15:22:22 -0500
commit5486cdcedb592818f17195d6225ad9711aa21724 (patch)
tree5dcc556dec2b4fa5b3940e8f00dacacec73e6eb8
parentb8640a2c307effcc44d86e51ce63efe349feebb4 (diff)
Only put 'pragma once' in compiled header file
-rw-r--r--compile.c1
-rw-r--r--tomo.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index 48d0a9ea..caca9aa8 100644
--- a/compile.c
+++ b/compile.c
@@ -1095,7 +1095,6 @@ module_code_t compile_file(ast_t *ast)
return (module_code_t){
.module_name=module_name,
.header=CORD_all(
- "#pragma once\n",
// CORD_asprintf("#line 0 %r\n", Str__quoted(ast->file->filename, false)),
env->code->imports, "\n",
env->code->typedefs, "\n",
diff --git a/tomo.c b/tomo.c
index 914d54db..81eb9088 100644
--- a/tomo.c
+++ b/tomo.c
@@ -115,6 +115,7 @@ int main(int argc, char *argv[])
}
case MODE_TRANSPILE: {
FILE *prog = popen(heap_strf("%s > %s.h", autofmt, f->filename), "w");
+ CORD_put("#pragma once\n", prog);
CORD_put(module.header, prog);
int status = pclose(prog);
if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
@@ -131,6 +132,7 @@ int main(int argc, char *argv[])
}
case MODE_EXPANDED_TRANSPILE: {
FILE *prog = popen(heap_strf("%s -x c %s -E - | %s > %s.h", cc, cflags, autofmt, f->filename), "w");
+ CORD_put("#pragma once\n", prog);
CORD_put(module.header, prog);
int status = pclose(prog);
if (WIFEXITED(status) && WEXITSTATUS(status) == 0)