"Joseph S. Myers" <[EMAIL PROTECTED]> writes:

| On Mon, 6 Feb 2006, Gabriel Dos Reis wrote:
| 
| > Hi,
| > 
| >   One of the thing I've learnt over the week-end is that the option
| > code confusion
| > 
| >      http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00326.html
| > 
| > is partly caused by a conflicting interests between -fconst-strings
| > and -Wwrite-strings.  The former has been deprecated for a long time
| > now.  I would like to remove it.  Objections?
| 
| Note that the variable flag_const_strings (mentioned in your Subject:) and 
| the option -fconst-strings (mentioned in your message body) are two 
| different things - which of course is part of the confusion.

One aspect of the confusion is the following, from c-opts.c:

c-opts.c:228:  flag_const_strings = c_dialect_cxx ();

and

    case OPT_Wwrite_strings:
      if (!c_dialect_cxx ())
        flag_const_strings = value;
      else
        warn_write_strings = value;
      break;

| The variable flag_const_strings is set by -Wwrite-strings for C.  If you 
| remove the variable then the c-common.c logic for building string 
| constants will need to change
| 
|   if (flag_const_strings)
| 
| to
| 
|   if (c_dialect_cxx () || warn_write_strings)

Yes, though I'll also reiterate my objection that a warning flag
should not be changing types.  The C front-end should be able to warn
about potentially overwritten string literals without having to change
the type of the object -- the C++ front-end does that, by watching out
for implicit conversion from literal string to either char* ro wchar_t.

| The option -fno-const-strings (C++ only) could go away without removing 
| the variable, if we no longer want to support that nonstandard dialect of 
| C++.

Yes.

-- Gaby

Reply via email to