Skip to content

Fix CI failure on maybe-uninitialized compiler warning - #205

Merged
tenox7 merged 2 commits into
tenox7:masterfrom
edgar-bonet:uninit
Oct 2, 2025
Merged

tenox7 merged 2 commits into
tenox7:masterfrom
edgar-bonet:uninit

Conversation

@edgar-bonet

Copy link
Copy Markdown
Collaborator

Some GCC versions warn:

ttyplot.c:359:16: warning: 'y2_start' may be used uninitialized [-Wmaybe-uninitialized]
[...]
ttyplot.c:359:16: warning: 'y2_end' may be used uninitialized [-Wmaybe-uninitialized]

These are false positives. However, in combination with the -Werror compiler option, they cause a CI failure on GCC 14 / Ubuntu.

Commits 8d8d752 and 714f210 attempted to fix the failure by providing the -Wno-error=maybe-uninitialized compiler option. However, they did not fix the failure on Ubuntu, and they caused another failure on clang 18 on macOS:

error: unknown warning option '-Werror=maybe-uninitialized';
did you mean '-Werror=uninitialized'? [-Werror,-Wunknown-warning-option]

This pull request solves the issue in a different way: by moving the initialization of y2_start and y2_end closer to where they are used (within the same if statement), the warning goes away. Then, the compiler option -Wno-error=maybe-uninitialized is not needed anymore.

Some GCC versions say:

    ttyplot.c:359:16: error:
    ‘y2_start’ may be used uninitialized [-Werror=maybe-uninitialized]

and a similar warning (promoted to error) for y2_end. These are false
positives: the variables are initialized if they ever get used. It is,
however, easy to restructure the code in order to get the initialization
and usage of the variables under the same ‘if’ test, so let's silence
the warning this way.

Fixes: https://github.com/tenox7/ttyplot/actions/runs/17030161145/job/48271411839
This option is not needed anymore. Furthermore, it is not supported by
clang.

This reverts commits 8d8d752 ("fix gh actions") and 714f210 ("fix
retarded flags").

Fixes: https://github.com/tenox7/ttyplot/actions/runs/17030161145/job/48271411825
@tenox7
tenox7 merged commit 947bec7 into tenox7:master Oct 2, 2025
8 checks passed
@edgar-bonet
edgar-bonet deleted the uninit branch October 3, 2025 07:40
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
ttyplot 1.7.5

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## What's Changed
* Fix CI failure on maybe-uninitialized compiler warning by @edgar-bonet in tenox7/ttyplot#205
* CI: upgrade macOS runners by @edgar-bonet in tenox7/ttyplot#206
* Actions(deps): Bump codespell-project/actions-codespell from 2.1 to 2.2 by @dependabot[bot] in tenox7/ttyplot#208
* Avoid division by zero on small windows by @edgar-bonet in tenox7/ttyplot#214
* `ttyplot.c`: Fix in-code comment by @hartwork in tenox7/ttyplot#217
* Work on smaller windows with no clock display by @edgar-bonet in tenox7/ttyplot#215


**Full Changelog**: https://github.com/tenox7/ttyplot/compare/1.7.4...1.7.5</pre>
  <p>View the full release notes at <a href="https://github.com/tenox7/ttyplot/releases/tag/1.7.5">https://github.com/tenox7/ttyplot/releases/tag/1.7.5</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!12187
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants