mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
Everywhere: Warn on function definitions without prototypes
If no header includes the prototype of a function, then it cannot be used from outside the translation unit it was defined in. In that case, it should be marked as `static`, in order to avoid possible ODR problems, unnecessary exported symbols, and allow the compiler to better optimize those. If this warning triggers in a function defined in a header, `inline` needs to be added, otherwise if the header is included in more than one TU, it will fail to link with a duplicate definition error. The reason this diff got so big is that Lagom-only code wasn't built with this flag even in Serenity times.
This commit is contained in:
Notes:
sideshowbarker
2024-07-18 08:27:14 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/LadybirdBrowser/ladybird/commit/c62240aa80d Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/626 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/trflynn89
@@ -16,6 +16,7 @@
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
namespace {
|
||||
struct Parameter {
|
||||
Vector<ByteString> attributes;
|
||||
ByteString type;
|
||||
@@ -823,6 +824,7 @@ void build(StringBuilder& builder, Vector<Endpoint> const& endpoints)
|
||||
for (auto const& endpoint : endpoints)
|
||||
build_endpoint(generator.fork(), endpoint);
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user