Reduce Warnings#95
Conversation
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.
|
@greptileai Please review this code anyway. |
Greptile SummaryThis PR removes unused variables, dead global structs ( Confidence Score: 5/5This 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.
|
| 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]
Reviews (1): Last reviewed commit: "Fix warnings in centrallix test-obj test..." | Re-trigger Greptile
|
Wow, sounds great. This PR is cleared for human review. |
|
Too many files changed for review. ( |
|
The conversation is getting a little cluttered, so I think I should repost this. This PR is cleared for human review. |
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.