GNU bug report logs - #23758
25.1.50; Bogus warning from -Wwrite-strings

Previous Next

Package: emacs;

Reported by: Ken Brown <kbrown <at> cornell.edu>

Date: Sun, 12 Jun 2016 19:57:02 UTC

Severity: normal

Found in version 25.1.50

Done: Ken Brown <kbrown <at> cornell.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23758 in the body.
You can then email your comments to 23758 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#23758; Package emacs. (Sun, 12 Jun 2016 19:57:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ken Brown <kbrown <at> cornell.edu>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 12 Jun 2016 19:57:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ken Brown <kbrown <at> cornell.edu>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.1.50; Bogus warning from -Wwrite-strings
Date: Sun, 12 Jun 2016 15:56:32 -0400
I'm getting an "assignment discards ‘const’ qualifier from pointer
target type" warning in the Cygwin-w32 build because of the following
code in w32fns.c:

char *type_CtrlAlt = NULL;
[...]
type_CtrlAlt = "bB";

This warning goes away if I remove -Wwrite-strings from the enabled 
compiler warnings.  Is this a compiler bug, or is there really something 
wrong with the code above that should warrant a warning?


In GNU Emacs 25.1.50.11 (x86_64-unknown-cygwin)
 of 2016-06-12 built on moufang
Repository revision: eacdc9eb6c89346fb72535632a1c65f6483b639f
Windowing system distributor 'Microsoft Corp.', version 10.0.10586

Configured using:
 'configure 'CFLAGS=-g3 -O0' --with-w32'





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23758; Package emacs. (Sun, 12 Jun 2016 20:02:00 GMT) Full text and rfc822 format available.

Message #8 received at 23758 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Ken Brown <kbrown <at> cornell.edu>
Cc: 23758 <at> debbugs.gnu.org
Subject: Re: bug#23758: 25.1.50; Bogus warning from -Wwrite-strings
Date: Sun, 12 Jun 2016 16:01:15 -0400
On Sun, Jun 12, 2016 at 3:56 PM, Ken Brown <kbrown <at> cornell.edu> wrote:
> I'm getting an "assignment discards ‘const’ qualifier from pointer
> target type" warning in the Cygwin-w32 build because of the following
> code in w32fns.c:
>
> char *type_CtrlAlt = NULL;
> [...]
> type_CtrlAlt = "bB";
>
> This warning goes away if I remove -Wwrite-strings from the enabled compiler
> warnings.  Is this a compiler bug, or is there really something wrong with
> the code above that should warrant a warning?

I think the warning is correct, and the code shoud use const char *type_CtrlAlt




Reply sent to Ken Brown <kbrown <at> cornell.edu>:
You have taken responsibility. (Sun, 12 Jun 2016 21:46:01 GMT) Full text and rfc822 format available.

Notification sent to Ken Brown <kbrown <at> cornell.edu>:
bug acknowledged by developer. (Sun, 12 Jun 2016 21:46:02 GMT) Full text and rfc822 format available.

Message #13 received at 23758-done <at> debbugs.gnu.org (full text, mbox):

From: Ken Brown <kbrown <at> cornell.edu>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: 23758-done <at> debbugs.gnu.org
Subject: Re: bug#23758: 25.1.50; Bogus warning from -Wwrite-strings
Date: Sun, 12 Jun 2016 17:45:09 -0400
On 6/12/2016 4:01 PM, Noam Postavsky wrote:
> On Sun, Jun 12, 2016 at 3:56 PM, Ken Brown <kbrown <at> cornell.edu> wrote:
>> I'm getting an "assignment discards ‘const’ qualifier from pointer
>> target type" warning in the Cygwin-w32 build because of the following
>> code in w32fns.c:
>>
>> char *type_CtrlAlt = NULL;
>> [...]
>> type_CtrlAlt = "bB";
>>
>> This warning goes away if I remove -Wwrite-strings from the enabled compiler
>> warnings.  Is this a compiler bug, or is there really something wrong with
>> the code above that should warrant a warning?
>
> I think the warning is correct, and the code shoud use const char *type_CtrlAlt

Thank you.  I was confused by the wording of the warning, but now I 
understand the issue.

Closing.

Ken





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 11 Jul 2016 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 43 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.