summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2020-08-10 23:45:11 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-12 20:40:59 +0200
commit5574d45edabed5b5d7f1a29455bdd5c495a30ae8 (patch)
tree0e81098035cec9dbdfbe2042c5c78cee34abca48
parent84e112be6b967bc9b987ea3f66b5ed8b60faefea (diff)
downloadserenity-5574d45edabed5b5d7f1a29455bdd5c495a30ae8.zip
DevTools: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code. Also, in case of signal_trampoline_dummy, marking it external (non-static) prevents it from being 'optimized away', which would lead to surprising and weird linker errors.
-rw-r--r--DevTools/Profiler/main.cpp2
-rw-r--r--DevTools/UserspaceEmulator/Emulator.cpp4
2 files changed, 4 insertions, 2 deletions
diff --git a/DevTools/Profiler/main.cpp b/DevTools/Profiler/main.cpp
index 1478f6d592..7480122303 100644
--- a/DevTools/Profiler/main.cpp
+++ b/DevTools/Profiler/main.cpp
@@ -132,7 +132,7 @@ int main(int argc, char** argv)
return app->exec();
}
-bool prompt_to_stop_profiling()
+static bool prompt_to_stop_profiling()
{
auto window = GUI::Window::construct();
window->set_title("Profiling");
diff --git a/DevTools/UserspaceEmulator/Emulator.cpp b/DevTools/UserspaceEmulator/Emulator.cpp
index 33f956900a..3878f2854c 100644
--- a/DevTools/UserspaceEmulator/Emulator.cpp
+++ b/DevTools/UserspaceEmulator/Emulator.cpp
@@ -1124,7 +1124,7 @@ enum class DefaultSignalAction {
Continue,
};
-DefaultSignalAction default_signal_action(int signal)
+static DefaultSignalAction default_signal_action(int signal)
{
ASSERT(signal && signal < NSIG);
@@ -1235,6 +1235,8 @@ void report(const char* format, ...)
va_end(ap);
}
+// Make sure the compiler doesn't "optimize away" this function:
+extern void signal_trampoline_dummy(void);
void signal_trampoline_dummy(void)
{
// The trampoline preserves the current eax, pushes the signal code and