fix: move SystemCoreClock extern "C" declarations to file scope for G… - #80
Conversation
…CC 15 compatibility GCC 15 changed the behavior of extern "C" declarations inside anonymous namespaces (CWG2788): the anonymous namespace now takes precedence, giving the variable internal linkage instead of external linkage. This causes a linker error when building a final executable: undefined reference to '(anonymous namespace)::SystemCoreClock' Fix: move extern "C" uint32_t SystemCoreClock; to file scope (before any namespace) in all 6 affected files: - hal_tiva/tiva/Pwm.cpp - hal_tiva/tiva/SpiMaster.cpp - hal_tiva/tiva/UartBase.cpp - hal_tiva/synchronous_tiva/SynchronousPwm.cpp - hal_tiva/synchronous_tiva/SynchronousSpiMaster.cpp - hal_tiva/synchronous_tiva/SynchronousQuadratureEncoder.cpp
✅
|
| Descriptor | Linter | Files | Fixed | Errors | Warnings | Elapsed time |
|---|---|---|---|---|---|---|
| ✅ ACTION | actionlint | 5 | 0 | 0 | 0.08s | |
| ✅ CPP | clang-format | 6 | 0 | 0 | 0 | 0.15s |
| ✅ CPP | cppcheck | 6 | 0 | 0 | 0.34s | |
| ✅ DOCKERFILE | hadolint | 1 | 0 | 0 | 0.04s | |
| ✅ JSON | jsonlint | 9 | 0 | 0 | 0.36s | |
| ✅ JSON | prettier | 9 | 6 | 0 | 0 | 0.59s |
| markdownlint | 11 | 0 | 6 | 0 | 1.42s | |
| ✅ MARKDOWN | markdown-table-formatter | 11 | 0 | 0 | 0 | 0.35s |
| ✅ REPOSITORY | checkov | yes | no | no | 23.52s | |
| ✅ REPOSITORY | git_diff | yes | no | no | 0.4s | |
| ✅ REPOSITORY | grype | yes | no | no | 49.78s | |
| ✅ REPOSITORY | ls-lint | yes | no | no | 0.01s | |
| ✅ REPOSITORY | secretlint | yes | no | no | 2.64s | |
| ✅ REPOSITORY | syft | yes | no | no | 4.09s | |
| ✅ REPOSITORY | trivy | yes | no | no | 12.32s | |
| ✅ REPOSITORY | trivy-sbom | yes | no | no | 0.14s | |
| ✅ REPOSITORY | trufflehog | yes | no | no | 4.23s | |
| lychee | 39 | 5 | 0 | 1.69s | ||
| ✅ YAML | prettier | 11 | 2 | 0 | 0 | 0.81s |
| ✅ YAML | v8r | 11 | 0 | 0 | 8.63s | |
| ✅ YAML | yamllint | 11 | 0 | 0 | 0.68s |
Detailed Issues
⚠️ SPELL / lychee - 5 errors
📝 Summary
---------------------
🔍 Total...........47
🔗 Unique..........33
✅ Successful......34
⏳ Timeouts.........0
🔀 Redirected.......9
👻 Excluded.........8
❓ Unknown..........0
🚫 Errors...........5
⛔ Unsupported......5
Errors in .gitlab-ci.yml
[ERROR] https://gitlab-ci-token/ (at 7:30) | Connection failed. Check network connectivity and firewall settings
[ERROR] https://gitlab-ci-token/ (at 8:30) | Connection failed. Check network connectivity and firewall settings
[403] https://gitlab.com/embedded-library/infrastructure/embedded-infra-lib.git (at 8:143) | Rejected status code: 403 Forbidden | Followed 1 redirect. Redirects: https://gitlab.com/embedded-library/infrastructure/embedded-infra-lib.git --[302]--> https://gitlab.com/users/sign_in
Errors in CONTRIBUTING.md
[ERROR] file://.github/CODEOWNERS (at 38:78) | File not found. Check if file exists and path is correct
Errors in README.md
[ERROR] file://.github/CODEOWNERS (at 57:212) | File not found. Check if file exists and path is correct
Hint: Followed 9 redirects. You might want to consider replacing redirecting URLs with the resolved URLs. Use verbose mode (`-v`/`-vv`) to see redirection details.
Hint: You can configure accepted/rejected response codes with `-a` or `--accept`
⚠️ MARKDOWN / markdownlint - 6 errors
.github/agents/executor.agent.md:11 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "You are the executor agent for..."]
.github/agents/orchestrator.agent.md:18 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "You are the orchestrator agent..."]
.github/agents/planner.agent.md:11 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "You are the planner agent for ..."]
.github/agents/reviewer.agent.md:14 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "You are the reviewer agent for..."]
.github/prompts/orchestrate.prompt.md:8:401 error MD013/line-length Line length [Expected: 400; Actual: 592]
.github/prompts/orchestrate.prompt.md:8 error MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "Analyze the following task for..."]
Notices
📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)
See detailed reports in MegaLinter artifacts
Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)
- Documentation: Custom Flavors
- Command:
npx mega-linter-runner@9.5.0 --custom-flavor-setup --custom-flavor-linters ACTION_ACTIONLINT,CPP_CPPCHECK,CPP_CLANG_FORMAT,DOCKERFILE_HADOLINT,JSON_JSONLINT,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_GRYPE,REPOSITORY_LS_LINT,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,SPELL_LYCHEE,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

Show us your support by starring ⭐ the repository
There was a problem hiding this comment.
Pull request overview
Fixes a GCC 15 compatibility issue (CWG2788) where extern "C" declarations inside anonymous namespaces now get internal linkage, causing undefined references to SystemCoreClock at link time. The fix moves the declaration out of the anonymous namespace to file scope across six Tiva HAL source files.
Changes:
- Move
extern "C" uint32_t SystemCoreClock;to file scope in 6 affected.cppfiles. - Remove the previous anonymous-namespace declarations.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| hal_tiva/tiva/Pwm.cpp | Move SystemCoreClock extern to file scope |
| hal_tiva/tiva/SpiMaster.cpp | Move SystemCoreClock extern to file scope |
| hal_tiva/tiva/UartBase.cpp | Move SystemCoreClock extern to file scope |
| hal_tiva/synchronous_tiva/SynchronousPwm.cpp | Move SystemCoreClock extern to file scope |
| hal_tiva/synchronous_tiva/SynchronousSpiMaster.cpp | Move SystemCoreClock extern to file scope |
| hal_tiva/synchronous_tiva/SynchronousQuadratureEncoder.cpp | Move SystemCoreClock extern to file scope |
…CC 15 compatibility
GCC 15 changed the behavior of extern "C" declarations inside anonymous namespaces (CWG2788): the anonymous namespace now takes precedence, giving the variable internal linkage instead of external linkage. This causes a linker error when building a final executable:
undefined reference to '(anonymous namespace)::SystemCoreClock'
Fix: move extern "C" uint32_t SystemCoreClock; to file scope (before any namespace) in all 6 affected files: