Skip to content

Reduce Warnings#95

Open
Lightning11wins wants to merge 8 commits into
masterfrom
reduce-warnings
Open

Reduce Warnings#95
Lightning11wins wants to merge 8 commits into
masterfrom
reduce-warnings

Conversation

@Lightning11wins
Copy link
Copy Markdown
Contributor

This PR greatly reduces / nearly eliminates warnings when building centrallix, centrallix-lib, and their associated test suites with default configuration flags. This will reduce the number of bugs that make it to production in the future by making legitimate warnings far more obvious when building the project.

Ignore uninitialized warnings in mtask that are intended behavior.
Fix discards const warning in qpf_internal_hexdecode().
Clean up.
…for functions that expected chars with no cast.

Clean up.
Remove unused n variable from test_mtlexer_07.c.
Remove unused commonnames variable from test_mtlexer_15.c and test_mtlexer_16.c.
Remove iter variable from test_02baseline.c that's initialized but never used.
Add initialization code for the array variable in test_00baseline.c and test_03baseline.c.

Clean up.
Fix aposSetLimits() recording the return value of aposSetLimits_r(), but then always returning 0.
Remove rval variable from nht_i_GET() because it was never read.
Comment out code that isn't used anymore due to nearby code being commented out.
Clean up.
Add typecasts to function pointers to explicitly change the type.
Add typecasts to hexify tests.
@Lightning11wins Lightning11wins self-assigned this Apr 7, 2026
@Lightning11wins Lightning11wins added enhancement ai-review Request AI review for PRs. labels Apr 7, 2026
@Lightning11wins
Copy link
Copy Markdown
Contributor Author

@greptileai Please review this code anyway.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 7, 2026

Greptile Summary

This PR removes unused variables, dead global structs (idcnt counters), and adds GCC diagnostic pragmas across 109 files to reduce build warnings. The most substantive logic change is fixing aposSetLimits in apos.c to properly propagate its return value from aposSetLimits_r (previously always returned 0).

Confidence Score: 5/5

This PR is safe to merge; all remaining findings are minor style suggestions with no impact on runtime correctness.

All findings are P2 style suggestions. The unused-variable and global struct removals are correct. The aposSetLimits bug fix is a genuine improvement. The puterr cast and the FirstCross/LastCross declarations are minor cleanup opportunities that do not affect behavior.

centrallix/tests/t_driver.c and centrallix/wgtr/apos.c have minor cleanup opportunities noted in inline comments.

Vulnerabilities

No security concerns identified.

Important Files Changed

Filename Overview
centrallix-lib/src/mtask.c Adds GCC diagnostic pragmas to suppress -Wuninitialized for intentional uninitialized buffer reads in stack setup routines
centrallix-lib/src/qprintf.c Correctly changes char* to const char* for orig_src to fix discarded-qualifier warning
centrallix/wgtr/apos.c Fixes aposSetLimits to propagate return value; removes unused changed variable; FirstCross/LastCross declarations remain with all assignments commented out
centrallix/netdrivers/net_http.c Removes unused rval variable; nht_i_RestGet return value was assigned but never checked in original code
centrallix/tests/t_driver.c Uses (int(*)(int))puterr cast to suppress type mismatch warning with tputs; proper fix is to change puterr parameter from char to int
centrallix/htmlgen/htdrv_alerter.c Removes unused HTALRT global struct and id variable that was assigned but never referenced in the render function
centrallix/htmlgen/htdrv_form.c Removes unused HTFORM global struct and id variable; clean dead-code removal
centrallix/multiquery/multiq_orderby.c Removes unused pParamObjects objlist variable declaration from mqobFinish
centrallix/osdrivers/objdrv_qytree.c Removes unused pStructInf find_inf and char* ptr variable declarations from qytQueryFetch
centrallix/htmlgen/htdrv_connector.c Removes unused id variable and HTCONN global struct; idcnt was incremented but its value was never used

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[PR: Reduce Warnings] --> B[Remove unused variables]
    A --> C[Remove unused idcnt globals]
    A --> D[GCC diagnostic pragmas]
    A --> E[Bug fix: propagate return value]
    B --> B1[multiq_orderby.c: objlist]
    B --> B2[objdrv_qytree.c: find_inf, ptr]
    B --> B3[net_http.c: rval]
    B --> B4[12x htmlgen drivers: id vars]
    C --> C1[Remove idcnt struct from htmlgen drivers]
    D --> D1[mtask.c: suppress -Wuninitialized for stack bufs]
    E --> E1[apos.c: aposSetLimits returns rval not hardcoded 0]
Loading

Reviews (1): Last reviewed commit: "Fix warnings in centrallix test-obj test..." | Re-trigger Greptile

@Lightning11wins
Copy link
Copy Markdown
Contributor Author

Wow, sounds great.

This PR is cleared for human review.

@Lightning11wins Lightning11wins added the size: medium Might be hard to review, usually less than ~5000 lines. label Apr 27, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 27, 2026

Too many files changed for review. (109 files found, 100 file limit)

@Lightning11wins
Copy link
Copy Markdown
Contributor Author

The conversation is getting a little cluttered, so I think I should repost this.

This PR is cleared for human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request AI review for PRs. size: medium Might be hard to review, usually less than ~5000 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant