Skip to content

gen_stub: various simplifications and clean up (5) #18665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
gen_stub: simplify generateFunctionEntries()
  • Loading branch information
DanielEScherzer committed May 29, 2025
commit 88fb45bdc6c45cc506fb3e8efe5db750bcfbb846
10 changes: 2 additions & 8 deletions build/gen_stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -5260,27 +5260,21 @@ function generateFunctionEntries(?Name $className, array $funcInfos, ?string $co
return '';
}

$code = "\n";

if ($cond) {
$code .= "#if {$cond}\n";
}

$functionEntryName = "ext_functions";
if ($className) {
$underscoreName = implode("_", $className->getParts());
$functionEntryName = "class_{$underscoreName}_methods";
}

$code .= "static const zend_function_entry {$functionEntryName}[] = {\n";
$code = "\nstatic const zend_function_entry {$functionEntryName}[] = {\n";
$code .= generateCodeWithConditions($funcInfos, "", static function (FuncInfo $funcInfo) {
return $funcInfo->getFunctionEntry();
}, $cond);
$code .= "\tZEND_FE_END\n";
$code .= "};\n";

if ($cond) {
$code .= "#endif\n";
$code = "\n#if {$cond}{$code}#endif\n";
}

return $code;
Expand Down