Author: dyung
Date: Wed Apr 17 17:00:06 2019
New Revision: 358626

URL: http://llvm.org/viewvc/llvm-project?rev=358626&view=rev
Log:
Fix test on PS4 which defaults to gnu99 which does not emit the expected 
warnings.

Modified:
    cfe/trunk/test/Analysis/security-syntax-checks.c

Modified: cfe/trunk/test/Analysis/security-syntax-checks.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/security-syntax-checks.c?rev=358626&r1=358625&r2=358626&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/security-syntax-checks.c (original)
+++ cfe/trunk/test/Analysis/security-syntax-checks.c Wed Apr 17 17:00:06 2019
@@ -1,8 +1,20 @@
 // RUN: %clang_analyze_cc1 %s -verify \
 // RUN:   -analyzer-checker=security.insecureAPI
+// RUN: %clang_analyze_cc1 %s -verify -std=gnu11 \
+// RUN:   -analyzer-checker=security.insecureAPI
+// RUN: %clang_analyze_cc1 %s -verify -std=gnu99 \
+// RUN:   -analyzer-checker=security.insecureAPI
 
 void builtin_function_call_crash_fixes(char *c) {
-  __builtin_strncpy(c, "", 6); // expected-warning{{Call to function 'strncpy' 
is insecure as it does not provide security checks introduced in the C11 
standard.}}
-  __builtin_memset(c, '\0', (0)); // expected-warning{{Call to function 
'memset' is insecure as it does not provide security checks introduced in the 
C11 standard.}}
-  __builtin_memcpy(c, c, 0); // expected-warning{{Call to function 'memcpy' is 
insecure as it does not provide security checks introduced in the C11 
standard.}}
+  __builtin_strncpy(c, "", 6);
+  __builtin_memset(c, '\0', (0));
+  __builtin_memcpy(c, c, 0);
+
+#if __STDC_VERSION__ > 199901
+  // expected-warning@-5{{Call to function 'strncpy' is insecure as it does 
not provide security checks introduced in the C11 standard.}}
+  // expected-warning@-5{{Call to function 'memset' is insecure as it does not 
provide security checks introduced in the C11 standard.}}
+  // expected-warning@-5{{Call to function 'memcpy' is insecure as it does not 
provide security checks introduced in the C11 standard.}}
+#else
+  // expected-no-diagnostics
+#endif
 }


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to