warning in I.h from gcc 4.6.3 with -Wall

Bug #999743 reported by Brian St. Pierre
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
nana (Ubuntu)
New
Undecided
Unassigned

Bug Description

Description: Ubuntu 12.04 LTS
Release: 12.04
nana:
  Installed: 2.5-12
  Candidate: 2.5-12
  Version table:
 *** 2.5-12 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/universe amd64 Packages
        100 /var/lib/dpkg/status

This test file:

--- BEGIN ---
#include "eiffel.h"

int main(int argc, char** argv)
{
  ENSURE(true);
  return 0;
}
--- END ---

when compiled with gcc 4.6.3: `g++ -Wall nana_test.cc`, gets the following warnings:

nana_test.cc: In function ‘int main(int, char**)’:
nana_test.cc:5:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
nana_test.cc:5:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
nana_test.cc:5:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
nana_test.cc:5:3: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

I expect to be able to use ENSURE and related nana macros with -Wall and not get compiler warnings.

These warnings are caused by this declaration in I.h:

void _I_default_handler(char *expr, char *file, int line);

Both expr and file should be of type "const char*". The attached patch fixes the problem by adding a const to both parameters in I.h and I.c.

Tags: patch
Revision history for this message
Brian St. Pierre (bstpierre) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Fix "deprecated conversion from string constant to 'char*'" warning." of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.