appleseedlab / maki

A tool for analyzing syntactic and semantic properties of C Preprocessor macros in C programs
10 stars 4 forks source link

Decay array types to pointers #12

Closed SilverMight closed 6 months ago

SilverMight commented 6 months ago

This change changes stack-allocated arrays in macro parameters to decay to pointers in the TypeSignature field.

i.e

#include <stdio.h>
#include <string.h>
#define ZERO_OUT_ARRAY(ptr, size) memset(ptr, 0, sizeof(*(ptr)) * (size))

int main() {
    int arr[10];
    ZERO_OUT_ARRAY(arr, sizeof(arr) / sizeof(arr[0]));
}

Old:

void * ZERO_OUT_ARRAY(int[10] ptr, unsigned long size)

New:

void * ZERO_OUT_ARRAY(int * ptr, unsigned long size)