MPS issue job003629

TitleMPS produces warnings when compiled with -Wwrite-strings
Statusclosed
Prioritynice
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionWhen compiled with clang -Wwrite-strings, the MPS fails to compile:

    arenavm.c:1788:14: error: assigning to 'char *' from 'const char [3]' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
      this->name = "VM";
                 ^ ~~~~

This problem came up when trying to integrate the MPS with Ruby, which compiles with -Wwrite-strings. In order to make integrations go smoothly, the MPS ought to compile under the most stringent compiler options like this.
AnalysisThere are going to be quite a lot of "char *" to "const char *" changes.
How foundmanual_test
EvidenceNone as yet.
Created byGareth Rees
Created on2013-09-30 16:50:54
Last modified byGareth Rees
Last modified on2013-10-01 10:54:29
History2013-09-30 GDR Created.

Fixes

Change Effect Date User Description
183498 closed 2013-10-01 10:52:45 Gareth Rees Avoid warnings when compiling with -Wwrite-strings:
* Use const char * in places where we want to assign string constants.
Avoid warnings when compiling with -Wextra:
* Avoid if statement with empty body in amcsshe.c
* Avoid comparison of unsigned >= 0.
183494 open 2013-09-30 17:18:52 Gareth Rees Turn on -Wextra -Wwrite-strings when compiling with GCC or Clang.
Add missing initializer to mps_args_none.
Change "char *" to "const char *" where necessary.