Skip to content

Preprocessor constants not properly handled. #650

@Machiry

Description

@Machiry

[This is a BUG]

Looks like checkedc-clang does not support preprocessor constants:

Consider the following code:

#include<stdio_checked.h>
void log_write(_Ptr<const char> func) {
    char pre[256];
    snprintf(pre, sizeof(pre), "%s", func);
    printf("%s", pre);
}
int main(void) {
   log_write("This Works");
   log_write(__func__);
}
$ clang -c pre.c 
pre.c:9:14: error: expression has unknown bounds, cast to ptr<T> expects source to have bounds
   log_write(__func__);
             ^~~~~~~~
1 error generated.

Note that, log_write("This Works"); checks out.

Metadata

Metadata

Assignees

Labels

bugThis labels issues that are bugs.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions