Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion tools/mksyscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ static void generate_stub(int nfixed, int nparms)
g_parm[0]);
fprintf(stream, "#include <nuttx/config.h>\n");
fprintf(stream, "#include <stdint.h>\n");
fprintf(stream, "#include <string.h>\n");

if (strlen(g_parm[HEADER_INDEX]) > 0)
{
Expand Down Expand Up @@ -461,6 +462,26 @@ static void generate_stub(int nfixed, int nparms)

fprintf(stream, ")\n{\n");

/* Fixed union illegal type for cast */

for (i = 0; i < nparms; i++)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add compiler check

{
get_formalparmtype(g_parm[PARM1_INDEX + i], formal);

/* Treat the first argument in the list differently from the others..
* It does not need a comma before it.
*/

if (is_union(formal))
{
fprintf(stream, " %s _parm%d;\n", formal, i + 1);
fprintf(stream, " memcpy((FAR void *)&_parm%d, "
"(FAR void *)&parm%d,\n"
" sizeof(uintptr_t));\n",
i + 1, i + 1);
}
}

/* Then call the proxied function. Functions that have no return value are
* a special case.
*/
Expand Down Expand Up @@ -503,7 +524,7 @@ static void generate_stub(int nfixed, int nparms)

if (is_union(formal))
{
fprintf(stream, "(%s)((%s)parm%d)", formal, actual, i + 1);
fprintf(stream, "_parm%d", i + 1);
}
else
{
Expand Down
Loading