You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support src.cpp and src.c in the same rules dir (#92)
For C string functions, C++ defines const overloads. For example, in C,
strchr is defined as:
```c
char *strchr(const char *s, int c);
```
In C++, it's overloaded as:
```cpp
const char *strchr(const char *s, int c);
char *strchr(char *s, int c);
```
Writing `char *f5(const char *a0, int a1) { return strchr(a0, a1); }`
would result in the following error:
```
error: cannot initialize return object of type 'char *' with an rvalue of type 'const char *'
6 | char *f6(const char *a0, int a1) { return strchr(a0, a1); }
```
For this reason, parse both `src.cpp` and `src.c` in a rules dir.
`src.c` keeps C specific rules and `src.cpp` keeps C++ specific rules.
The function names in the 2 functions cannot collide,
cpp-rule-preprocessor checks against colliding names.
0 commit comments