This is a mistake because passing a const char* argument to a function that takes a char* parameter violates const-correctness; this would allow you to modify the const object, which could surpass the whole const target.
For example, this C program:
#include <stdio.h> void func(char *s) { puts(s); s[0] = 'J'; } int main(void) { const char message[] = "Hello"; func(message); puts(message); return 0; }
produces the following compile time diagnostics from gcc:
cc: In function 'main': cc:10:5: warning: passing argument 1 of 'func' discards qualifiers from pointer target type cc:3:6: note: expected 'char *' but argument is of type 'const char *'
The final message is marked as a βnoteβ because it refers to the (perfectly legal) declaration of func() , explaining that it is a declaration of the parameter to which the warning applies.
Regarding the C standard, this is a violation of the restrictions, which means that the compiler may treat it as a fatal error. gcc by default simply warns about this and does an implicit conversion from const char* to char* .
When I run the program, the output is:
Hello Jello
which shows that although I declared message as const , the function was able to change it.
Since gcc did not see this as a fatal error, there is no need to suppress either diagnostic messages. It is possible that the code will work in any case (say, if the function does not change anything). But there are warnings for some reason, and you or the developers of the M-SIM architecture simulator should probably take a look at this.
(Passing a string literal to func() will not lead to this diagnostic, since C does not treat string literals as const . (This makes an attempt to change the string literal undefined.) This is for historical reasons. -Wwrite-strings has the -Wwrite-strings option, which forces it to process string literals as const , which actually violates the C standard, but can be a useful check.)
As I mentioned in the comment, it would be helpful if you showed us the code that runs the diagnostics.
I even downloaded and built a simulator of the M-SIM architecture myself, but I did not see this specific message.