Skip to content

libc: compile with -Werror=missing-prototypes (-Werror=missing-declarations) #149000

@frobtech

Description

@frobtech

libc code (and tests) should be compiled with the GCC -Wmissing-declarations and -Wmissing-variable-declarations switches for both C and C++, the GCC -Wmissing-prototypes switch for C (only); and the Clang -Wmissing-prototypes and -Wmissing-variable-declarations switches for both C and C++. These diagnose global or namespace-scope things being defined without prior declaration. This is a good way to catch things that are defined in a source (.cpp) file at namespace scope but should either be defined inline in a header or should be defined with internal linkage via an anonymous namespace in the source file.

The code today has several such bugs that later manifest as multiple-definition errors. We should make sure that all those get fixed so we can change the cmake configuration to make these blocking errors on the presubmit bots. We can't make the cmake change now because there are several violations. #147408 is fixing some of those, but there are more.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions