Closed PappasBrent closed 2 months ago
Maki does not check if an expansion references a locally-defined type via a sizeof() or cast expression.
sizeof()
For example, for the following code:
#define SIZE_OF_MY_STRUCT() (sizeof(struct my_struct)) #define SIZE_OF_MY_TYPEDEFD_STRUCT() (sizeof(my_typedefd_struct)) #define CAST_TO_MY_STRUCT(X) ((struct my_struct) X) #define CAST_TO_MY_TYPEDEFD_STRUCT(X) ((my_typedefd_struct) X) int main(void) { struct my_struct { int x; }; typedef struct my_typedefd_struct { int y; } my_typedefd_struct; SIZE_OF_MY_STRUCT(); SIZE_OF_MY_TYPEDEFD_STRUCT(); CAST_TO_MY_STRUCT({}); CAST_TO_MY_TYPEDEFD_STRUCT({}); return 0; }
Maki would set DoesSubexpressionExpandedFromBodyHaveLocalType to false for all the above expansions, when it should be set to true because the argument to each of the sizeof() and cast expressions is a locally-defined type.
DoesSubexpressionExpandedFromBodyHaveLocalType
false
true
Maki does not check if an expansion references a locally-defined type via a
sizeof()
or cast expression.For example, for the following code:
Maki would set
DoesSubexpressionExpandedFromBodyHaveLocalType
tofalse
for all the above expansions, when it should be set totrue
because the argument to each of thesizeof()
and cast expressions is a locally-defined type.