mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00: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:
parent
7fe82a1cda
commit
c62240aa80
Notes:
sideshowbarker
2024-07-18 08:27:14 +09:00
Author: https://github.com/BertalanD
Commit: c62240aa80
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/626
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/trflynn89
24 changed files with 146 additions and 97 deletions
|
|
@ -8,6 +8,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "IDLGenerators.h"
|
||||
#include "Namespaces.h"
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
|
|
@ -16,21 +17,6 @@
|
|||
#include <LibIDL/IDLParser.h>
|
||||
#include <LibIDL/Types.h>
|
||||
|
||||
extern Vector<StringView> s_header_search_paths;
|
||||
|
||||
namespace IDL {
|
||||
void generate_namespace_header(IDL::Interface const&, StringBuilder&);
|
||||
void generate_namespace_implementation(IDL::Interface const&, StringBuilder&);
|
||||
void generate_constructor_header(IDL::Interface const&, StringBuilder&);
|
||||
void generate_constructor_implementation(IDL::Interface const&, StringBuilder&);
|
||||
void generate_prototype_header(IDL::Interface const&, StringBuilder&);
|
||||
void generate_prototype_implementation(IDL::Interface const&, StringBuilder&);
|
||||
void generate_iterator_prototype_header(IDL::Interface const&, StringBuilder&);
|
||||
void generate_iterator_prototype_implementation(IDL::Interface const&, StringBuilder&);
|
||||
void generate_global_mixin_header(IDL::Interface const&, StringBuilder&);
|
||||
void generate_global_mixin_implementation(IDL::Interface const&, StringBuilder&);
|
||||
}
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
Core::ArgsParser args_parser;
|
||||
|
|
@ -47,7 +33,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
.short_name = 'i',
|
||||
.value_name = "path",
|
||||
.accept_value = [&](StringView s) {
|
||||
s_header_search_paths.append(s);
|
||||
IDL::g_header_search_paths.append(s);
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue