Skip to content

Generated arginfo headers: combine preprocessor conditional blocks (2) #18667

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 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions build/gen_stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2742,23 +2742,15 @@ public function getDeclaration(array $allConstInfos): string
throw new Exception("Constant " . $this->name->__toString() . " must have a @cvalue annotation");
}

$code = "";

if ($this->cond) {
$code .= "#if {$this->cond}\n";
}
// Condition will be added by generateCodeWithConditions()

if ($this->name->isClassConst()) {
$code .= $this->getClassConstDeclaration($value, $allConstInfos);
$code = $this->getClassConstDeclaration($value, $allConstInfos);
} else {
$code .= $this->getGlobalConstDeclaration($value);
$code = $this->getGlobalConstDeclaration($value);
}
$code .= $this->getValueAssertion($value);

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

return $code;
}

Expand Down Expand Up @@ -3553,9 +3545,11 @@ function (Name $item) {
$code .= "\tzend_register_class_alias(\"" . str_replace("\\", "\\\\", $this->alias) . "\", class_entry);\n";
}

foreach ($this->constInfos as $const) {
$code .= $const->getDeclaration($allConstInfos);
}
$code .= generateCodeWithConditions(
$this->constInfos,
'',
static fn ( $const ) => $const->getDeclaration($allConstInfos)
);

foreach ($this->enumCaseInfos as $enumCase) {
$code .= $enumCase->getDeclaration($allConstInfos);
Expand Down Expand Up @@ -5187,9 +5181,11 @@ static function (FuncInfo $funcInfo) use ($fileInfo, &$generatedFunctionDeclarat
$code .= "\nstatic void register_{$stubFilenameWithoutExtension}_symbols(int module_number)\n";
$code .= "{\n";

foreach ($fileInfo->constInfos as $constInfo) {
$code .= $constInfo->getDeclaration($allConstInfos);
}
$code .= generateCodeWithConditions(
$fileInfo->constInfos,
'',
static fn ( $constInfo ) => $constInfo->getDeclaration($allConstInfos)
);

if ($attributeInitializationCode !== "" && $fileInfo->constInfos) {
$code .= "\n";
Expand Down
2 changes: 0 additions & 2 deletions ext/com_dotnet/com_extension_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

158 changes: 0 additions & 158 deletions ext/curl/curl_arginfo.h

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions ext/dba/dba_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 0 additions & 18 deletions ext/gd/gd_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions ext/intl/listformatter/listformatter_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions ext/intl/spoofchecker/spoofchecker_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions ext/intl/uchar/uchar_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading