mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
With glibc 2.43 const-ness is preserved for standard library functions and a compiler warning will be issued if this is violated. pai parse_cpulist() receives user input via the parm function parameter. The parameter is defined as 'const char *' and used as input value for strchr(). The target pointer (cp) is defined as mutable 'char *' leading to violation of const correctness and this compiler warning: pai.c: In function ‘parse_cpulist’: pai.c:907:20: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 907 | cp = strchr(parm, ':'); Since the user input is coming from optarg 'non-const char *', it is unnecessary to have the function parameters carrying this data defined as const. Remove the unnecessary const definition in the function call chain to fix the described issue. Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> Suggested-by: Jan Hoeppner <hoeppner@linux.ibm.com> Suggested-by: Juergen Christ <jchrist@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>