Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: silencing compiler warnings from gcc 4

Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx> wrote:
> Gcc 4 outputs a bunch of compiler warnings about string pointers that
> differ in signedness.  The warnings in a zsh build are limited to the
> zle string functions defined in zle.h.  I came up with 2 solutions:
> (1) change the ZS_str* macros to cast their args to (char*), or (2)
> introduce some static inline functions to handle the casts.  The
> advantage of the latter is that it doesn't hide pointer-conversion
> errors behind forced casts.  For instance, after I compiled the inline
> version it showed several places in the code that were using ZWC() on
> strings instead of ZWS() (which I already fixed and checked in).

I was wondering about these.  I'm a bit loath either to cast away any
typesafety quite so blithely as the first change would do, but I'm not that
keen on putting too much work into non-standard features (which will
reduce to the first case where inline isn't available).  I believe even C99
doesn't allow every use of inline that gcc does.  However, given that we're
stuck with casts of some sort, and we do a lot of the development with gcc,
possibly the second option is the best way to go.

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.


Messages sorted by: Reverse Date, Date, Thread, Author