Skip to content
Merged
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
4 changes: 2 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ int main(int argc, char** argv)
std::vector<std::string> inputFilenames;
OutputFormat outputFormat = OutputFormat::Human;

AnalysisConfig cfg; // mode = IR, stackLimit = 8 MiB default
AnalysisConfig cfg{}; // mode = IR, stackLimit = 8 MiB default
cfg.quiet = false;
cfg.warningsOnly = false;
std::string compileCommandsPath;
Expand Down Expand Up @@ -771,7 +771,7 @@ int main(int argc, char** argv)
}
else
{
AnalysisResult merged;
AnalysisResult merged{};
merged.config = cfg;
for (const auto& entry : results)
{
Expand Down
32 changes: 32 additions & 0 deletions run_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,36 @@ def check_cli_parsing_and_filters() -> bool:
return ok


def check_only_func_uninitialized() -> bool:
"""
Regression: --only-func must keep interprocedural uninitialized warnings.
"""
print("=== Testing --only-func for uninitialized analysis ===")
sample = TEST_DIR / "uninitialized-variable/uninitialized-local-interproc-struct-partial.cpp"
result = run_analyzer([str(sample), "--only-func=main", "--warnings-only"])
output = (result.stdout or "") + (result.stderr or "")

if result.returncode != 0:
print(f" ❌ analyzer failed (code {result.returncode})")
print(output)
print()
return False

must_contain = [
"Function: main",
"potential read of uninitialized local variable 'cfg'",
]
for needle in must_contain:
if needle not in output:
print(f" ❌ missing expected output: {needle}")
print(output)
print()
return False

print(" ✅ --only-func preserves warning\n")
return True


def check_file(c_path: Path):
"""
Check that, for this file, all expectations are present in the analyzer output.
Expand Down Expand Up @@ -799,6 +829,8 @@ def record_ok(ok: bool):
global_ok = False
if not record_ok(check_cli_parsing_and_filters()):
global_ok = False
if not record_ok(check_only_func_uninitialized()):
global_ok = False
if not record_ok(check_human_vs_json_parity()):
global_ok = False

Expand Down
2 changes: 1 addition & 1 deletion scripts/git/commit_msg_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"test",
)

MAX_SUBJECT_LEN = 72
MAX_SUBJECT_LEN = 84

CONVENTIONAL_RE = re.compile(
r"^(?P<type>" + "|".join(ALLOWED_TYPES) + r")"
Expand Down
Loading
Loading