struct lttng_ust_type_common parent;
uint32_t struct_size;
unsigned int nr_fields;
- const struct lttng_ust_event_field **fields; /* Array of pointers to fields. */
- unsigned int alignment; /* Minimum alignment for this type. */
+ const struct lttng_ust_event_field * const *fields; /* Array of pointers to fields. */
+ unsigned int alignment; /* Minimum alignment for this type. */
};
/*
uint32_t struct_size;
const char *name;
- const struct lttng_ust_enum_entry **entries;
+ const struct lttng_ust_enum_entry * const *entries;
unsigned int nr_entries;
/* End of base ABI. Fields below should be used after checking struct_size. */
const char *event_name;
const struct lttng_ust_probe_desc *probe_desc;
void (*probe_callback)(void);
- const struct lttng_ust_event_field **fields; /* event payload */
+ const struct lttng_ust_event_field * const *fields; /* event payload */
unsigned int nr_fields;
const int **loglevel;
const char *signature; /* Argument types/names received */
uint32_t struct_size; /* Size of this structure. */
const char *provider_name;
- const struct lttng_ust_event_desc **event_desc;
+ const struct lttng_ust_event_desc * const *event_desc;
unsigned int nr_events;
uint32_t major;
uint32_t minor;
#undef TRACEPOINT_ENUM
#define TRACEPOINT_ENUM(_provider, _name, _values) \
- const struct lttng_ust_enum_entry *__enum_values__##_provider##_##_name[] = { \
+ const struct lttng_ust_enum_entry * const __enum_values__##_provider##_##_name[] = { \
_values \
ctf_enum_value("", 0) /* Dummy, 0-len array forbidden by C99. */ \
};
#undef _TRACEPOINT_EVENT_CLASS
#define _TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
- static const struct lttng_ust_event_field *__event_fields___##_provider##___##_name[] = { \
+ static const struct lttng_ust_event_field * const __event_fields___##_provider##___##_name[] = { \
_fields \
ctf_integer(int, dummy, 0) /* Dummy, C99 forbids 0-len array. */ \
};
#endif
#undef TRACEPOINT_LOGLEVEL
-#define TRACEPOINT_LOGLEVEL(__provider, __name, __loglevel) \
-static const int _loglevel_value___##__provider##___##__name = __loglevel; \
-LTTNG_UST_TP_EXTERN_C const int *_loglevel___##__provider##___##__name \
- __attribute__((visibility("hidden"))) = \
+#define TRACEPOINT_LOGLEVEL(__provider, __name, __loglevel) \
+static const int _loglevel_value___##__provider##___##__name = __loglevel; \
+LTTNG_UST_TP_EXTERN_C const int * const _loglevel___##__provider##___##__name \
+ __attribute__((visibility("hidden"))) = \
&_loglevel_value___##__provider##___##__name;
#include TRACEPOINT_INCLUDE
#undef TRACEPOINT_MODEL_EMF_URI
#define TRACEPOINT_MODEL_EMF_URI(__provider, __name, __uri) \
-LTTNG_UST_TP_EXTERN_C const char *_model_emf_uri___##__provider##___##__name \
+LTTNG_UST_TP_EXTERN_C const char * const _model_emf_uri___##__provider##___##__name \
__attribute__((visibility("hidden"))) = __uri; \
#include TRACEPOINT_INCLUDE
* Stage 7.1 of tracepoint event generation.
*
* Create events description structures. We use a weakref because
- * loglevels are optional. If not declared, the event will point to the
+ * loglevels are optional. If not declared, the event will point to
* a loglevel that contains NULL.
+ *
+ * C++ requires that const objects have a user-declared default
+ * constructor. However, in both C++ and C, weakref cannot be
+ * initialized because it causes the weakref attribute to be ignored.
+ * Therefore, the loglevel and model_emf_uri pointers are not const
+ * to ensure C++ compilers default-initialize them.
*/
/* Reset all macros within TRACEPOINT_EVENT */
#define _TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
&__event_desc___##_provider##_##_name,
-static const struct lttng_ust_event_desc *_TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER)[] = {
+static const struct lttng_ust_event_desc * const _TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER)[] = {
#include TRACEPOINT_INCLUDE
NULL, /* Dummy, C99 forbids 0-len array. */
};
};
int lttng_ust_dynamic_type_choices(size_t *nr_choices,
- const struct lttng_ust_event_field ***choices)
+ const struct lttng_ust_event_field * const **choices)
__attribute__((visibility("hidden")));
const struct lttng_ust_event_field *lttng_ust_dynamic_type_field(int64_t value)
static
ssize_t count_fields_recursive(size_t nr_fields,
- const struct lttng_ust_event_field **lttng_fields);
+ const struct lttng_ust_event_field * const *lttng_fields);
static
int serialize_one_field(struct lttng_ust_session *session,
struct ustctl_field *fields, size_t *iter_output,
int serialize_fields(struct lttng_ust_session *session,
struct ustctl_field *ustctl_fields,
size_t *iter_output, size_t nr_lttng_fields,
- const struct lttng_ust_event_field **lttng_fields);
+ const struct lttng_ust_event_field * const *lttng_fields);
/*
* Human readable error message.
case lttng_ust_type_dynamic:
{
- const struct lttng_ust_event_field **choices;
+ const struct lttng_ust_event_field * const *choices;
size_t nr_choices;
int ret;
static
ssize_t count_fields_recursive(size_t nr_fields,
- const struct lttng_ust_event_field **lttng_fields)
+ const struct lttng_ust_event_field * const *lttng_fields)
{
int i;
ssize_t ret, count = 0;
struct ustctl_field *fields, size_t *iter_output,
const char *field_name)
{
- const struct lttng_ust_event_field **choices;
+ const struct lttng_ust_event_field * const *choices;
char tag_field_name[LTTNG_UST_ABI_SYM_NAME_LEN];
const struct lttng_ust_type_common *tag_type;
const struct lttng_ust_event_field *tag_field_generic;
int serialize_fields(struct lttng_ust_session *session,
struct ustctl_field *ustctl_fields,
size_t *iter_output, size_t nr_lttng_fields,
- const struct lttng_ust_event_field **lttng_fields)
+ const struct lttng_ust_event_field * const *lttng_fields)
{
int ret;
size_t i;
size_t *_nr_write_fields,
struct ustctl_field **ustctl_fields,
size_t nr_fields,
- const struct lttng_ust_event_field **lttng_fields)
+ const struct lttng_ust_event_field * const *lttng_fields)
{
struct ustctl_field *fields;
int ret;
static
int serialize_entries(struct ustctl_enum_entry **_entries,
size_t nr_entries,
- const struct lttng_ust_enum_entry **lttng_entries)
+ const struct lttng_ust_enum_entry * const *lttng_entries)
{
struct ustctl_enum_entry *entries;
int i;
int loglevel,
const char *signature, /* event signature (input) */
size_t nr_fields, /* fields */
- const struct lttng_ust_event_field **lttng_fields,
+ const struct lttng_ust_event_field * const *lttng_fields,
const char *model_emf_uri,
uint32_t *id) /* event id (output) */
{
int session_objd, /* session descriptor */
const char *enum_name, /* enum name (input) */
size_t nr_entries, /* entries */
- const struct lttng_ust_enum_entry **lttng_entries,
+ const struct lttng_ust_enum_entry * const *lttng_entries,
uint64_t *id)
{
ssize_t len;
int loglevel,
const char *signature, /* event signature (input) */
size_t nr_fields, /* fields */
- const struct lttng_ust_event_field **fields,
+ const struct lttng_ust_event_field * const *fields,
const char *model_emf_uri,
uint32_t *id) /* event id (output) */
__attribute__((visibility("hidden")));
int session_objd, /* session descriptor */
const char *enum_name, /* enum name (input) */
size_t nr_entries, /* entries */
- const struct lttng_ust_enum_entry **entries,
+ const struct lttng_ust_enum_entry * const *entries,
uint64_t *id) /* enum id (output) */
__attribute__((visibility("hidden")));
const char *field_name,
enum bytecode_op bytecode_op)
{
- const struct lttng_ust_event_field **fields, *field = NULL;
+ const struct lttng_ust_event_field * const *fields, *field = NULL;
unsigned int nr_fields, i;
struct load_op *op;
uint32_t field_offset = 0;
static
int lttng_create_all_event_enums(size_t nr_fields,
- const struct lttng_ust_event_field **event_fields,
+ const struct lttng_ust_event_field * const *event_fields,
struct lttng_ust_session *session)
{
size_t i;
return dt_var_fields[value];
}
-int lttng_ust_dynamic_type_choices(size_t *nr_choices, const struct lttng_ust_event_field ***choices)
+int lttng_ust_dynamic_type_choices(size_t *nr_choices, const struct lttng_ust_event_field * const **choices)
{
*nr_choices = _NR_LTTNG_UST_DYNAMIC_TYPES;
*choices = dt_var_fields;