From: Mathieu Desnoyers Date: Tue, 26 Mar 2019 16:41:30 +0000 (-0400) Subject: Add LTTNG_PACKED ifdefs to validate that it is defined X-Git-Tag: v2.12.0-rc1~48 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=db56acaff475812dfd774a52b3d54eae5c115315;p=lttng-ust.git Add LTTNG_PACKED ifdefs to validate that it is defined If LTTNG_PACKED is used to specify whether a structure is packed, but we end up forgetting inclusion of lttng/ust-compiler.h (which defines it), we end up silently _not_ packing the data structure, because LTTNG_PACKED will be considered to be an identifier by the compiler, and therefore simply ignored. There are no such instances in lttng-ust, but let's add a ifdef check. Signed-off-by: Mathieu Desnoyers --- diff --git a/include/lttng/ust-abi.h b/include/lttng/ust-abi.h index 4976b1bf..01e9daf4 100644 --- a/include/lttng/ust-abi.h +++ b/include/lttng/ust-abi.h @@ -30,6 +30,10 @@ #include #include +#ifndef LTTNG_PACKED +#error "LTTNG_PACKED should be defined" +#endif + #ifndef __ust_stringify #define __ust_stringify1(x) #x #define __ust_stringify(x) __ust_stringify1(x) diff --git a/include/lttng/ust-ctl.h b/include/lttng/ust-ctl.h index f83124d1..57758edb 100644 --- a/include/lttng/ust-ctl.h +++ b/include/lttng/ust-ctl.h @@ -23,6 +23,10 @@ #include #include +#ifndef LTTNG_PACKED +#error "LTTNG_PACKED should be defined" +#endif + #ifndef LTTNG_UST_UUID_LEN #define LTTNG_UST_UUID_LEN 16 #endif diff --git a/include/lttng/ust-events.h b/include/lttng/ust-events.h index 902f2b2f..fefb8585 100644 --- a/include/lttng/ust-events.h +++ b/include/lttng/ust-events.h @@ -39,6 +39,10 @@ #include #include +#ifndef LTTNG_PACKED +#error "LTTNG_PACKED should be defined" +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/include/ust-comm.h b/include/ust-comm.h index 6a08b306..10dbca21 100644 --- a/include/ust-comm.h +++ b/include/ust-comm.h @@ -34,6 +34,10 @@ #include #include +#ifndef LTTNG_PACKED +#error "LTTNG_PACKED should be defined" +#endif + /* * Default timeout the application waits for the sessiond to send its * "register done" command. Can be overridden with the environment diff --git a/liblttng-ust/filter-bytecode.h b/liblttng-ust/filter-bytecode.h index 9a2d4c0a..7df0288a 100644 --- a/liblttng-ust/filter-bytecode.h +++ b/liblttng-ust/filter-bytecode.h @@ -29,6 +29,10 @@ #include +#ifndef LTTNG_PACKED +#error "LTTNG_PACKED should be defined" +#endif + /* * offsets are absolute from start of bytecode. */