CPP: Add a test cases that uses restrict.

This commit is contained in:
Geoffrey White
2019-04-16 09:35:43 +01:00
parent a749b5b6d1
commit 1ee28fa15b
3 changed files with 14 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
| format.h:16:59:16:61 | str | This argument should be of type 'int' but is of type 'char *' |
| format.h:16:64:16:64 | i | This argument should be of type 'double' but is of type 'int' |
| format.h:16:67:16:67 | d | This argument should be of type 'char *' but is of type 'double' |
| linux_c.c:11:15:11:18 | str3 | This argument should be of type 'char *' but is of type 'short *' |
| pri_macros.h:15:35:15:40 | my_u64 | This argument should be of type 'unsigned int' but is of type 'unsigned long long' |
| printf1.h:12:27:12:27 | i | This argument should be of type 'double' but is of type 'int' |
| printf1.h:18:18:18:18 | i | This argument should be of type 'void *' but is of type 'int' |

View File

@@ -0,0 +1,12 @@
/** standard printf functions */
int printf(const char *format, ...);
/** test program */
void restrict_cases(char * restrict str1, const char * restrict str2, short * restrict str3)
{
printf("%s", str1); // GOOD
printf("%s", str2); // GOOD
printf("%s", str3); // BAD
}

View File

@@ -1 +1 @@
semmle-extractor-options: --edg --signed_chars
semmle-extractor-options: --clang --edg --signed_chars