Commit: f9affb5ae9ea32a572e6be1d073486ddb2d4df18 Author: krakjoe <joe.watk...@live.co.uk> Sun, 22 Dec 2013 13:00:51 +0000 Committer: Anatol Belski <a...@php.net> Mon, 23 Dec 2013 12:24:11 +0100 Parents: aaca4ede153f9cf26277164d14f3499f76d0e69d Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f9affb5ae9ea32a572e6be1d073486ddb2d4df18 Log: stop warnings from unused opcode map Changed paths: M Zend/zend_vm_gen.php M Zend/zend_vm_opcodes.c M Zend/zend_vm_opcodes.h Diff: diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index 9996541..2088bf8 100644 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -1208,8 +1208,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); @@ -1225,14 +1225,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"; diff --git a/Zend/zend_vm_opcodes.c b/Zend/zend_vm_opcodes.c index 04af26c..177c3fd 100644 --- a/Zend/zend_vm_opcodes.c +++ b/Zend/zend_vm_opcodes.c @@ -19,6 +19,7 @@ */ #include <stdio.h> +#include <zend.h> const char *zend_vm_opcodes_map[165] = { "ZEND_NOP", @@ -187,3 +188,7 @@ const char *zend_vm_opcodes_map[165] = { "ZEND_FAST_RET", "ZEND_RECV_VARIADIC", }; + +ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) { + return zend_vm_opcodes_map[opcode]; +} diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index ad0d881..ed02663 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -21,7 +21,7 @@ #ifndef ZEND_VM_OPCODES_H #define ZEND_VM_OPCODES_H -extern ZEND_API const char *zend_vm_opcodes_map[165]; +ZEND_API const char *zend_get_opcode_name(zend_uchar opcode); #define ZEND_NOP 0 #define ZEND_ADD 1 @@ -171,4 +171,4 @@ extern ZEND_API const char *zend_vm_opcodes_map[165]; #define ZEND_FAST_RET 163 #define ZEND_RECV_VARIADIC 164 -#endif \ No newline at end of file +#endif -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php