From 5a3a215b0ed39c6672a643240f01712b35ea3a2b Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Sun, 17 Dec 2023 11:42:07 -0500 Subject: [PATCH] Don't delete script.cpp after building (#1272) Ensure consistency in linker script parser interface Make the declaration and definition visible when compiling so that the compiler can warn about inconsistencies. Co-authored-by: ISSOtm --- Makefile | 4 ++++ include/link/script.hpp | 16 ---------------- src/link/main.cpp | 2 +- src/link/script.y | 2 ++ 4 files changed, 7 insertions(+), 17 deletions(-) delete mode 100644 include/link/script.hpp diff --git a/Makefile b/Makefile index 97052ad3..a4f95c64 100644 --- a/Makefile +++ b/Makefile @@ -94,6 +94,8 @@ rgblink_obj := \ src/opmath.o \ src/util.o +src/link/main.o: src/link/script.hpp + rgbfix_obj := \ src/fix/main.o \ src/extern/getopt.o \ @@ -140,6 +142,8 @@ test/gfx/rgbgfx_test: test/gfx/rgbgfx_test.cpp # Bison-generated C++ files have an accompanying header src/asm/parser.hpp: src/asm/parser.cpp $Qtouch $@ +src/link/script.hpp: src/link/script.cpp + $Qtouch $@ # Only RGBGFX uses libpng (POSIX make doesn't support pattern rules to cover all these) src/gfx/main.o: src/gfx/main.cpp diff --git a/include/link/script.hpp b/include/link/script.hpp deleted file mode 100644 index 2cd9b32c..00000000 --- a/include/link/script.hpp +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: MIT */ - -// Parsing a linker script -#ifndef RGBDS_LINK_SCRIPT_H -#define RGBDS_LINK_SCRIPT_H - -#include - -#include "linkdefs.hpp" - -/* - * Parses the linker script, and modifies the sections mentioned within appropriately. - */ -void script_ProcessScript(char const *path); - -#endif // RGBDS_LINK_SCRIPT_H diff --git a/src/link/main.cpp b/src/link/main.cpp index 519ad99a..968444e4 100644 --- a/src/link/main.cpp +++ b/src/link/main.cpp @@ -17,7 +17,7 @@ #include "link/output.hpp" #include "link/patch.hpp" #include "link/section.hpp" -#include "link/script.hpp" +#include "script.hpp" #include "link/symbol.hpp" #include "extern/getopt.hpp" diff --git a/src/link/script.y b/src/link/script.y index 5a8f719b..5a015c87 100644 --- a/src/link/script.y +++ b/src/link/script.y @@ -7,6 +7,8 @@ #include #include "linkdefs.hpp" + + void script_ProcessScript(char const *path); } %code { #include