================
@@ -0,0 +1,30 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=unix.StdCLibraryFunctions \
+// RUN: -analyzer-config unix.StdCLibraryFunctions:ModelPOSIX=true \
+// RUN: -triple arm64-apple-darwin -verify=darwin %s
+// RUN: %clang_analyze_cc1 -analyzer-checker=unix.StdCLibraryFunctions \
+// RUN: -analyzer-config unix.StdCLibraryFunctions:ModelPOSIX=true \
+// RUN: -triple x86_64-unknown-linux-gnu -verify=linux %s
+
+typedef unsigned long size_t;
+typedef long off_t;
+void *mmap(void *, size_t, int, int, int, off_t);
+
+#define MAP_PRIVATE 0x0002
+#define MAP_ANON 0x1000
+
+// VM_MAKE_TAG on Darwin encodes a Mach VM memory tag in the top 8 bits.
+// For tags >= 128 the result is a large negative signed integer.
+#define VM_MAKE_TAG(tag) ((int)((unsigned)(tag) << 24))
+#define VM_MEMORY_APPLICATION_SPECIFIC_1 240
+
+void test_mmap_vm_make_tag_no_false_positive(void) {
+ void *p = mmap(0, 4096, 0, MAP_ANON | MAP_PRIVATE,
+ VM_MAKE_TAG(VM_MEMORY_APPLICATION_SPECIFIC_1), 0);
+ // linux-warning@-2 {{should be >= -1}}
----------------
steakhal wrote:
Please match the full warning messages here and in the other expectations.
The analyzer convention is to denote the places like that with: `// no-warning:
<why>` If you grep for, you will find plenty of examples. You can also
underline places with carets ^^^
https://github.com/llvm/llvm-project/pull/219568
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits