Skip to content

-itypes-for-extern rewrites itype parameters even when they don't need to be changed #715

Open
@john-h-kastner

Description

@john-h-kastner

For example:

void test(int *a : itype(_Ptr<int>)) {}

When converted with 3c -itypes-for-extern, the function is rewritten even though it hasn't changed.

This can break idempotence in some situations:

#define foo int
void test(foo *a) {}

converts (3c -itypes-for-extern) to

#define foo int
void test(int *a : itype(_Ptr<foo>)) {}

but a further pass through 3c gives

#define foo int
void test(int *a : itype(_Ptr<int>)) {}

A fix should be fairly straight forward. The condition for rewriting with an itype under -itypes-for-extern just needs to have a srcHasItype check. Alternatively, a fix could come via the change suggested by matt here (update: now filed as #740). If the internal constraint solves to WILD, and the special casing in the rewriter is removed, the main itype rewriting logic will correctly notice the existing itype and not rewrite.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions