diff options
author | Frank Kühndel <frank.kuehndel@embedded-brains.de> | 2020-10-05 16:20:44 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-10-10 15:02:56 +0200 |
commit | 59d0e6aed1efea068cea13651dc1d2b7c2809fc0 (patch) | |
tree | 0c4de89138ff6dee9978a0bfd0307b0a6421245c /cpukit/libmisc/capture/capture_support.c | |
parent | build: Add test excludes for RTEMS_PROFILING (diff) | |
download | rtems-59d0e6aed1efea068cea13651dc1d2b7c2809fc0.tar.bz2 |
capture: Fix unaligned pointer value warning
rtems_name is a four byte integer.
Giving an rtems_name as value instead of a pointer to ctrace_task_name_add()
fixes not only the compiler warning but it is also a bit more safe
For those who have asked for the warning:
../../../cpukit/libmisc/capture/capture_support.c:352:49: warning:
taking address of packed member of 'struct rtems_capture_task_record'
may result in an unaligned pointer value [-Waddress-of-packed-member]
352 | ctrace_task_name_add (rec_out->task_id, &task_rec.name);
| ^~~~~~~~~~~~~~
Diffstat (limited to 'cpukit/libmisc/capture/capture_support.c')
-rw-r--r-- | cpukit/libmisc/capture/capture_support.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cpukit/libmisc/capture/capture_support.c b/cpukit/libmisc/capture/capture_support.c index 4af8822c79..e2438fb23b 100644 --- a/cpukit/libmisc/capture/capture_support.c +++ b/cpukit/libmisc/capture/capture_support.c @@ -81,7 +81,7 @@ static ctrace_tasks tasks; * Add a name. */ static void -ctrace_task_name_add (rtems_id id, const rtems_name* name) +ctrace_task_name_add (rtems_id id, const rtems_name name) { if (tasks.tasks == NULL) { @@ -97,7 +97,7 @@ ctrace_task_name_add (rtems_id id, const rtems_name* name) { if (tasks.tasks[t].id == id) { - tasks.tasks[t].name = *name; + tasks.tasks[t].name = name; break; } } @@ -111,7 +111,7 @@ ctrace_task_name_add (rtems_id id, const rtems_name* name) } if (tasks.tasks != NULL) { - tasks.tasks[tasks.count].name = *name; + tasks.tasks[tasks.count].name = name; tasks.tasks[tasks.count].id = id; ++tasks.count; } @@ -349,7 +349,7 @@ rtems_capture_print_trace_records (int total, bool csv) cpu->recs = rtems_capture_record_extract (cpu->recs, &task_rec, sizeof (task_rec)); - ctrace_task_name_add (rec_out->task_id, &task_rec.name); + ctrace_task_name_add (rec_out->task_id, task_rec.name); rtems_capture_print_record_task (cpu_out, rec_out, &task_rec); } else |