Skip to content

Commit

Permalink
Suppress static analyzer warnings in specialized executor
Browse files Browse the repository at this point in the history
As things like if(0) will be removed by the compiler, no need
to see that tons of warnings with static analyzer enabled.
  • Loading branch information
weltling committed Aug 23, 2013
1 parent 38f9c51 commit 716fc80
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Zend/zend_vm_execute.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@

#ifdef ZEND_WIN32
# pragma warning(once : 4101)
# pragma warning(once : 6235)
# pragma warning(once : 6237)
# pragma warning(once : 6239)
# pragma warning(once : 6240)
# pragma warning(once : 6285)
# pragma warning(once : 6286)
# pragma warning(once : 6326)
#endif
static user_opcode_handler_t zend_user_opcode_handlers[256] = {
(user_opcode_handler_t)NULL,
Expand Down
20 changes: 19 additions & 1 deletion Zend/zend_vm_gen.php
Original file line number Diff line number Diff line change
Expand Up @@ -1189,8 +1189,26 @@ function gen_vm($def, $skel) {
// Insert header
out($f, $GLOBALS['header_text']);

out($f, "#ifdef ZEND_WIN32\n");
// Suppress free_op1 warnings on Windows
out($f, "#ifdef ZEND_WIN32\n# pragma warning(once : 4101)\n#endif\n");
out($f, "# pragma warning(once : 4101)\n");
if (ZEND_VM_SPEC) {
// Suppress (<non-zero constant> || <expression>) warnings on windows
out($f, "# pragma warning(once : 6235)\n");
// Suppress (<zero> && <expression>) warnings on windows
out($f, "# pragma warning(once : 6237)\n");
// Suppress (<non-zero constant> && <expression>) warnings on windows
out($f, "# pragma warning(once : 6239)\n");
// Suppress (<expression> && <non-zero constant>) warnings on windows
out($f, "# pragma warning(once : 6240)\n");
// Suppress (<non-zero constant> || <non-zero constant>) warnings on windows
out($f, "# pragma warning(once : 6285)\n");
// Suppress (<non-zero constant> || <expression>) warnings on windows
out($f, "# pragma warning(once : 6286)\n");
// Suppress constant with constant comparsion warnings on windows
out($f, "# pragma warning(once : 6326)\n");
}
out($f, "#endif\n");

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

0 comments on commit 716fc80

Please sign in to comment.