[pacman-dev] [PATCH] Declare all local functions static
Allan McRae
allan at archlinux.org
Sat Dec 18 20:31:29 EST 2010
On 19/12/10 04:08, Dan McGee wrote:
> On Sat, Dec 18, 2010 at 9:58 AM, Allan McRae<allan at archlinux.org> wrote:
>> All functions that are limited to the local translation unit are
>> declared static. This exposed that the _pkg_get_deltas declaration
>> in be_local.c was being satified by the function in packages.c which
>> when declared static caused linker failures.
>
> Hmm. All of these were left this way on purpose, and the deltas thing
> was obviously done on purpose too.
I understand that the delta thing was done on purpose, but why are all
these functions not declared static?
>> Fixes all warnings with -Wmissing-{declarations,prototypes}.
>
> What do these warnings look like? Did the gold linker expose these,
> I'm assuming?
This was me looking into various compiler warnings available in gcc.
The warnings look like:
be_local.c:70:13: warning: no previous prototype for
'_cache_get_filename' [-Wmissing-prototypes]
-Wmissing-prototypes aims to detect global functions that fail to be
declared in header files. Given we probably do not want to declare
those in a header file and they are restricted to that one translation
unit, I figured they should all be declared static...
That resulted in:
../../lib/libalpm/.libs/libalpm.so: undefined reference to `_pkg_get_deltas'
as the _pkg_get_deltas declaration in be_local.c no longer gets
satisfied by the implementation in package.c (as it is statically
declared there).
Allan
More information about the pacman-dev
mailing list