Skip to content

Commit 716fc80

Browse files
committed
Suppress static analyzer warnings in specialized executor
As things like if(0) will be removed by the compiler, no need to see that tons of warnings with static analyzer enabled.
1 parent 38f9c51 commit 716fc80

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

Zend/zend_vm_execute.h

+7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020

2121
#ifdef ZEND_WIN32
2222
# pragma warning(once : 4101)
23+
# pragma warning(once : 6235)
24+
# pragma warning(once : 6237)
25+
# pragma warning(once : 6239)
26+
# pragma warning(once : 6240)
27+
# pragma warning(once : 6285)
28+
# pragma warning(once : 6286)
29+
# pragma warning(once : 6326)
2330
#endif
2431
static user_opcode_handler_t zend_user_opcode_handlers[256] = {
2532
(user_opcode_handler_t)NULL,

Zend/zend_vm_gen.php

+19-1
Original file line numberDiff line numberDiff line change
@@ -1189,8 +1189,26 @@ function gen_vm($def, $skel) {
11891189
// Insert header
11901190
out($f, $GLOBALS['header_text']);
11911191

1192+
out($f, "#ifdef ZEND_WIN32\n");
11921193
// Suppress free_op1 warnings on Windows
1193-
out($f, "#ifdef ZEND_WIN32\n# pragma warning(once : 4101)\n#endif\n");
1194+
out($f, "# pragma warning(once : 4101)\n");
1195+
if (ZEND_VM_SPEC) {
1196+
// Suppress (<non-zero constant> || <expression>) warnings on windows
1197+
out($f, "# pragma warning(once : 6235)\n");
1198+
// Suppress (<zero> && <expression>) warnings on windows
1199+
out($f, "# pragma warning(once : 6237)\n");
1200+
// Suppress (<non-zero constant> && <expression>) warnings on windows
1201+
out($f, "# pragma warning(once : 6239)\n");
1202+
// Suppress (<expression> && <non-zero constant>) warnings on windows
1203+
out($f, "# pragma warning(once : 6240)\n");
1204+
// Suppress (<non-zero constant> || <non-zero constant>) warnings on windows
1205+
out($f, "# pragma warning(once : 6285)\n");
1206+
// Suppress (<non-zero constant> || <expression>) warnings on windows
1207+
out($f, "# pragma warning(once : 6286)\n");
1208+
// Suppress constant with constant comparsion warnings on windows
1209+
out($f, "# pragma warning(once : 6326)\n");
1210+
}
1211+
out($f, "#endif\n");
11941212

11951213
// Support for ZEND_USER_OPCODE
11961214
out($f, "static user_opcode_handler_t zend_user_opcode_handlers[256] = {\n");

0 commit comments

Comments
 (0)