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 or suppresses compiler warnings across 114 files in centrallix and centrallix-lib, with changes ranging from removing genuinely dead variables and unused global structs to adding
Confidence Score: 5/5Safe to merge — the changes are overwhelmingly dead-code removal with no behaviour change, plus one genuine bug fix in aposSetLimits. The vast majority of changes remove variables that were assigned but never read, or delete unused global counters. The pragma-based suppression in mtask.c is the right tool for intentionally unsafe stack code. The const-casting in cxss_credentials_mgr.c obscures an API design smell but does not introduce new misbehaviour. The aposSetLimits return-value fix is a correct improvement. centrallix/cxss/cxss_credentials_mgr.c (const-casting) and centrallix/utility/json_util.c (empty else-if branches) are worth a second look for long-term cleanliness, but neither poses a runtime risk.
|
| Filename | Overview |
|---|---|
| centrallix-lib/src/mtask.c | Added #pragma GCC diagnostic push/pop to suppress intentional uninitialized stack reads used for MTASK's stack-allocation trick across three functions. |
| centrallix/wgtr/apos.c | Removed unused variables; also fixes aposSetLimits to return the actual rval from aposSetLimits_r rather than always returning 0. |
| centrallix/utility/json_util.c | Commented-out has_hour/minute/second/tz tracking variables replaced with empty else if (cond); no-op branches; functionally identical but leaves confusing dead code. |
| centrallix/cxss/cxss_credentials_mgr.c | Added (char*) casts throughout to suppress discarded-const warnings when passing caller-provided keys to cxssShred; masks an API const-correctness issue. |
| centrallix/multiquery/multiq_equijoin.c | Removed is_outer variable which was assigned but never read anywhere in the function. |
| centrallix/htmlgen/htdrv_window.c | Commented out bx/by/bw/bh geometry block — those variables were computed but never consumed; no functional change. |
| centrallix/netdrivers/net_http.c | Dropped unused rval variable that stored nht_i_RestGet's return value without ever being checked. |
| centrallix/htmlgen/htdrv_connector.c | Removed idcnt-based global struct and the id local variable derived from it, which were computed but unused. |
| centrallix/cxss/cxss_crypto.c | Changed seed buffer from char[256] to unsigned char[256] to match the expected type of cxss_internal_GetBytes. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Warning Sources] --> B[Unused variables]
A --> C[Intentional uninitialized stack reads]
A --> D[Signed vs unsigned mismatch]
A --> E[Discarded const qualifier]
B --> B1[Delete variable and assignment]
C --> C1[pragma GCC diagnostic push/pop]
D --> D1[char to unsigned char]
E --> E1[Cast away const with char-ptr]
B1 --> F[No behaviour change]
C1 --> F
D1 --> F
E1 --> G[Warning silenced but const API issue remains]
style G fill:#ffcccc
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[Warning Sources] --> B[Unused variables]
A --> C[Intentional uninitialized stack reads]
A --> D[Signed vs unsigned mismatch]
A --> E[Discarded const qualifier]
B --> B1[Delete variable and assignment]
C --> C1[pragma GCC diagnostic push/pop]
D --> D1[char to unsigned char]
E --> E1[Cast away const with char-ptr]
B1 --> F[No behaviour change]
C1 --> F
D1 --> F
E1 --> G[Warning silenced but const API issue remains]
style G fill:#ffcccc
Reviews (2): Last reviewed commit: "Add explicit casts to remove const in we..." | Re-trigger Greptile
|
Wow, sounds great. This PR is cleared for human review. |
|
The conversation is getting a little cluttered, so I think I should repost this. This PR is cleared for human review. |
Note: This is probably the wrong solution, but it works for now. We'll replace it when Greg decides on the right solution.
|
With those commits, I think I've successfully eliminated all warnings on the latest current |
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.