Skip to content

Conversation

edgar-bonet
Copy link
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
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