Skip to content

Commit

Permalink
Merge branch 'PHP-5.4' into PHP-5.5
Browse files Browse the repository at this point in the history
* PHP-5.4:
  stop warnings from unused opcode map
  - BFN
  • Loading branch information
krakjoe committed Dec 22, 2013
2 parents 8e36d36 + b1df00a commit 247ec0d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 10 deletions.
4 changes: 4 additions & 0 deletions NEWS
Expand Up @@ -30,6 +30,10 @@ PHP NEWS
- GD:
. Fixed bug #64405 (Use freetype-config for determining freetype2 dir(s)).
(Adam)

- PDO_odbc:
. Fixed bug #66311 (Stack smashing protection kills PDO/ODBC queries).
(michael at orlitzky dot com)

- MySQLi:
. Fixed bug #65486 (mysqli_poll() is broken on win x64). (Anatol)
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_language_scanner.c
@@ -1,4 +1,4 @@
/* Generated by re2c 0.13.5 */
/* Generated by re2c 0.13.5 on Sun Dec 22 13:03:33 2013 */
#line 1 "Zend/zend_language_scanner.l"
/*
+----------------------------------------------------------------------+
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_language_scanner_defs.h
@@ -1,4 +1,4 @@
/* Generated by re2c 0.13.5 */
/* Generated by re2c 0.13.5 on Sun Dec 22 13:03:33 2013 */
#line 3 "Zend/zend_language_scanner_defs.h"

enum YYCONDTYPE {
Expand Down
17 changes: 11 additions & 6 deletions Zend/zend_vm_gen.php
Expand Up @@ -1181,8 +1181,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);
Expand All @@ -1198,14 +1198,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";

Expand Down
5 changes: 5 additions & 0 deletions Zend/zend_vm_opcodes.c
Expand Up @@ -19,6 +19,7 @@
*/

#include <stdio.h>
#include <zend.h>

const char *zend_vm_opcodes_map[164] = {
"ZEND_NOP",
Expand Down Expand Up @@ -186,3 +187,7 @@ const char *zend_vm_opcodes_map[164] = {
"ZEND_FAST_CALL",
"ZEND_FAST_RET",
};

ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) {
return zend_vm_opcodes_map[opcode];
}
4 changes: 2 additions & 2 deletions Zend/zend_vm_opcodes.h
Expand Up @@ -21,7 +21,7 @@
#ifndef ZEND_VM_OPCODES_H
#define ZEND_VM_OPCODES_H

extern ZEND_API const char *zend_vm_opcodes_map[164];
ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);

#define ZEND_NOP 0
#define ZEND_ADD 1
Expand Down Expand Up @@ -170,4 +170,4 @@ extern ZEND_API const char *zend_vm_opcodes_map[164];
#define ZEND_FAST_CALL 162
#define ZEND_FAST_RET 163

#endif
#endif

0 comments on commit 247ec0d

Please sign in to comment.