1
0
mirror of https://github.com/php/php-src.git synced 2026-04-07 08:02:49 +02:00

stop warnings from unused opcode map

This commit is contained in:
krakjoe
2013-12-22 13:00:51 +00:00
parent c14388d63f
commit b1df00a7c9
3 changed files with 17 additions and 7 deletions

View File

@@ -1202,8 +1202,8 @@ function gen_vm($def, $skel) {
out($f, $GLOBALS['header_text']);
fputs($f, "#ifndef ZEND_VM_OPCODES_H\n#define ZEND_VM_OPCODES_H\n\n");
fputs($f, "extern ZEND_API const char *zend_vm_opcodes_map[".($max_opcode + 1)."];\n\n");
fputs($f, "ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);\n\n");
foreach ($opcodes as $code => $dsc) {
$code = str_pad((string)$code,$code_len," ",STR_PAD_LEFT);
$op = str_pad($dsc["op"],$max_opcode_len);
@@ -1219,14 +1219,19 @@ function gen_vm($def, $skel) {
// Insert header
out($f, $GLOBALS['header_text']);
fputs($f,"#include <stdio.h>\n\n");
fputs($f,"#include <stdio.h>\n");
fputs($f,"#include <zend.h>\n\n");
fputs($f,"const char *zend_vm_opcodes_map[".($max_opcode + 1)."] = {\n");
for ($i = 0; $i <= $max_opcode; $i++) {
fputs($f,"\t".(isset($opcodes[$i]["op"])?'"'.$opcodes[$i]["op"].'"':"NULL").",\n");
}
fputs($f, "};\n");
fputs($f, "};\n\n");
fputs($f, "ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) {\n");
fputs($f, "\treturn zend_vm_opcodes_map[opcode];\n");
fputs($f, "}\n");
fclose($f);
echo "zend_vm_opcodes.c generated successfully.\n";

View File

@@ -19,6 +19,7 @@
*/
#include <stdio.h>
#include <zend.h>
const char *zend_vm_opcodes_map[159] = {
"ZEND_NOP",
@@ -181,3 +182,7 @@ const char *zend_vm_opcodes_map[159] = {
"ZEND_QM_ASSIGN_VAR",
"ZEND_JMP_SET_VAR",
};
ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) {
return zend_vm_opcodes_map[opcode];
}

View File

@@ -21,7 +21,7 @@
#ifndef ZEND_VM_OPCODES_H
#define ZEND_VM_OPCODES_H
extern ZEND_API const char *zend_vm_opcodes_map[159];
ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);
#define ZEND_NOP 0
#define ZEND_ADD 1