Skip to content

e_smi: fix const correctness for string literal arrays#31

Open
sivapt12 wants to merge 1 commit intoamd:masterfrom
sivapt12:fix-const-qualifiers
Open

e_smi: fix const correctness for string literal arrays#31
sivapt12 wants to merge 1 commit intoamd:masterfrom
sivapt12:fix-const-qualifiers

Conversation

@sivapt12
Copy link
Copy Markdown

String literals in C are of type const char *, but the arrays freqlimitsrcnames and svi3_rail_index_names were declared as char * const, which implies mutable data. This results in compiler warnings:

warning: initialization discards ‘const’ qualifier

Update both arrays to const char * const to correctly reflect that:

  • the string data is immutable
  • the array pointers are not reassigned

This fixes -Wdiscarded-qualifiers warnings and improves const-correctness.

String literals in C are of type `const char *`, but the arrays
`freqlimitsrcnames` and `svi3_rail_index_names` were declared as
`char * const`, which implies mutable data. This results in
compiler warnings:

  warning: initialization discards ‘const’ qualifier

Update both arrays to `const char * const` to correctly reflect that:
- the string data is immutable
- the array pointers are not reassigned

This fixes -Wdiscarded-qualifiers warnings and improves
const-correctness.

Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
@muthusAMD
Copy link
Copy Markdown
Contributor

Hi Siva, looks good for me, I will test once and then will Merge.

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