@@ -97,13 +97,27 @@ struct traceeval_data {
(data).member = (val); \
} while (0)
-#define TRACEEVAL_SET_NUMBER(data, val) __TRACEEVAL_SET(data, NUMBER, number, val)
-#define TRACEEVAL_SET_NUMBER_8(data, val) __TRACEEVAL_SET(data, NUMBER_8, number_8, val)
-#define TRACEEVAL_SET_NUMBER_16(data, val) __TRACEEVAL_SET(data, NUMBER_16, number_16, val)
-#define TRACEEVAL_SET_NUMBER_32(data, val) __TRACEEVAL_SET(data, NUMBER_32, number_32, val)
-#define TRACEEVAL_SET_NUMBER_64(data, val) __TRACEEVAL_SET(data, NUMBER_64, number_64, val)
-#define TRACEEVAL_SET_STRING(data, val) __TRACEEVAL_SET(data, STRING, string, val)
-#define TRACEEVAL_SET_CSTRING(data, val) __TRACEEVAL_SET(data, STRING, cstring, val)
+/* Have strings and pointers fail to be set to numbers */
+#define __TRACEEVAL_SET_NUM(data, data_type, member, val) \
+ do { \
+ char *__test__[val] __attribute__((unused)); \
+ __TRACEEVAL_SET(data, data_type, member, val); \
+ } while (0)
+
+/* Have numbers fail to be assigned as strings */
+#define __TRACEEVAL_SET_STR(data, data_type, member, val) \
+ do { \
+ char __test__ __attribute__((unused)) = (val)[0]; \
+ __TRACEEVAL_SET(data, data_type, member, val); \
+ } while (0)
+
+#define TRACEEVAL_SET_NUMBER(data, val) __TRACEEVAL_SET_NUM(data, NUMBER, number, val)
+#define TRACEEVAL_SET_NUMBER_8(data, val) __TRACEEVAL_SET_NUM(data, NUMBER_8, number_8, val)
+#define TRACEEVAL_SET_NUMBER_16(data, val) __TRACEEVAL_SET_NUM(data, NUMBER_16, number_16, val)
+#define TRACEEVAL_SET_NUMBER_32(data, val) __TRACEEVAL_SET_NUM(data, NUMBER_32, number_32, val)
+#define TRACEEVAL_SET_NUMBER_64(data, val) __TRACEEVAL_SET_NUM(data, NUMBER_64, number_64, val)
+#define TRACEEVAL_SET_STRING(data, val) __TRACEEVAL_SET_STR(data, STRING, string, val)
+#define TRACEEVAL_SET_CSTRING(data, val) __TRACEEVAL_SET_STR(data, STRING, cstring, val)
#define TRACEEVAL_SET_POINTER(data, val) __TRACEEVAL_SET(data, POINTER, pointer, val)
struct traceeval_type;
@@ -36,7 +36,7 @@ static int wakeup_callback(struct tracecmd_input *handle, struct tep_event *even
tep_read_number_field(pid_field, record->data, &val);
pid = val;
- TRACEEVAL_SET_CSTRING(keys[0], record->data + comm_field->offset);
+ TRACEEVAL_SET_CSTRING(keys[0], (char *)record->data + comm_field->offset);
TRACEEVAL_SET_NUMBER(keys[1], pid);
traceeval_delta_start(data->tdelta, keys, record->ts);
@@ -62,7 +62,7 @@ static int sched_callback(struct tracecmd_input *handle, struct tep_event *event
tep_read_number_field(next_pid_field, record->data, &val);
pid = val;
- TRACEEVAL_SET_CSTRING(keys[0], record->data + next_comm_field->offset);
+ TRACEEVAL_SET_CSTRING(keys[0], (char *)record->data + next_comm_field->offset);
TRACEEVAL_SET_NUMBER(keys[1], pid);
traceeval_delta_stop(data->tdelta, keys, record->ts);