RE: [avr-gcc-list] New GCC warning - how to silence?

From:

Eric Weddington

Subject:

RE: [avr-gcc-list] New GCC warning - how to silence?

Date:

Fri, 06 Apr 2007 16:38:04 -0600

> -----Original Message-----
> From: Joerg Wunsch [mailto:address@hidden
> Sent: Friday, April 06, 2007 3:56 PM
> To: Eric Weddington
> Cc: address@hidden; 'Denis Chertykov'; 'Dmitry K.';
> 'Anatoly Sokolov'; 'Bjorn Haase'; 'Marek Michalkiewicz'
> Subject: Re: [avr-gcc-list] New GCC warning - how to silence?
>
> As Eric Weddington wrote:
>
> > The makefile template that has been shipping with WinAVR since 2002
> > has consistently had -funsigned-char and -fshort-enums in the
> > compiler flags.
>
> So what? WinAVR users will neither be affected nor benefit in any way
> from your suggested changes. Moot point. Please leave it as it is
> then.
>
> > What I don't understand is why -funsigned-char doesn't seem to work
> > like it did in 3.4.x.
>
> It does.
Counter-example: See attached test program and Makefile, compile with AVR
GCC 4.1.1. The makefile explicitly compiles with -funsigned-chars, yet this
produces a warning. Note that the issue seems to be when it is a pointer to
a char. I would think that when -funsigned-char is used, a pointer to a char
would be equivalent to a pointer to an unsigned char. AVR GCC 4.1.1 doesn't
seem to think so. This is the same issue that a lot of users are complaining
about.
> From: Rolf Magnus
>
> On Freitag, 6. April 2007, Eric Weddington wrote:
>
> > I found it in avr.h of the port:
> >
> > #define DEFAULT_SIGNED_CHAR 1
> >
> > So this means that the AVR defaults to a signed char. Can
> we change this to
> > be unsigned?:
>
> Why?
Because a signed char is rarely used on the AVR and unsigned char is used
almost all the time. It would be nice if char had the same representation as
unsigned char without having to resort to the end-user remembering to use
the -funsigned-char flag in their command line. It would also be nice if
char * and unsigned char * could be compared without warnings, but
admittedly I don't know if changing the above will fix that or not.
Eric