[lttng-dev] [PATCH babeltrace] Fix: Static build on OS X

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Wed May 4 15:57:20 UTC 2016


----- On May 4, 2016, at 10:54 AM, Michael Jeanson mjeanson at efficios.com wrote:

> The OS X linker fails to resolve common symbols in a static
> library for some unexplained reason. Initializing the variables
> to zero makes the symbol become uninitialized data and fixes
> the linking.

We don't initialize static/global variables to 0/NULL ever in our
coding style, presuming they are zeroed (similarly to the kernel
coding style).

Why should we diverge from this coding style in this specific instance ?
Why not elsewhere ?

Thanks,

Mathieu

> 
> Signed-off-by: Michael Jeanson <mjeanson at efficios.com>
> ---
> lib/babeltrace.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/babeltrace.c b/lib/babeltrace.c
> index 0bcfd1d..f05808d 100644
> --- a/lib/babeltrace.c
> +++ b/lib/babeltrace.c
> @@ -31,7 +31,7 @@
> #include <babeltrace/ctf-text/types.h>
> #include <stdlib.h>
> 
> -int babeltrace_verbose, babeltrace_debug;
> +int babeltrace_verbose = 0, babeltrace_debug = 0;
> 
> static
> void __attribute__((constructor)) init_babeltrace_lib(void)
> --
> 2.7.4
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com


More information about the lttng-dev mailing list