From: Thomas E. Dickey Date: Sun, 2 Jan 2011 01:08:28 +0000 (+0000) Subject: ncurses 5.7 - patch 20110101 X-Git-Tag: v5.8~7 X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff_plain;h=b87ec59eb4557919fe1f8cec1c367cd81f061ed9 ncurses 5.7 - patch 20110101 + fix remaining strict compiler warnings in ncurses library ABI=5, except those dealing with function pointers, etc. --- diff --git a/NEWS b/NEWS index 2842dafb..468dbf07 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.1624 2010/12/25 23:56:36 tom Exp $ +-- $Id: NEWS,v 1.1626 2011/01/01 23:11:55 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,10 @@ See the AUTHORS file for the corresponding full names. Changes through 1.9.9e did not credit all contributions; it is not possible to add this information. +20110101 + + fix remaining strict compiler warnings in ncurses library ABI=5, + except those dealing with function pointers, etc. + 20101225 + modify nc_tparm.h, adding guards against repeated inclusion, and allowing TPARM_ARG to be overridden. diff --git a/dist.mk b/dist.mk index dc6fe080..c3d09ae3 100644 --- a/dist.mk +++ b/dist.mk @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.787 2010/12/25 23:56:22 tom Exp $ +# $Id: dist.mk,v 1.788 2011/01/01 16:29:59 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -37,7 +37,7 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 5 NCURSES_MINOR = 7 -NCURSES_PATCH = 20101225 +NCURSES_PATCH = 20110101 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/include/curses.h.in b/include/curses.h.in index fc714f67..e140d10b 100644 --- a/include/curses.h.in +++ b/include/curses.h.in @@ -32,7 +32,7 @@ * and: Thomas E. Dickey 1996-on * ****************************************************************************/ -/* $Id: curses.h.in,v 1.218 2010/12/25 23:39:07 tom Exp $ */ +/* $Id: curses.h.in,v 1.219 2011/01/01 21:52:45 tom Exp $ */ #ifndef __NCURSES_H #define __NCURSES_H @@ -1268,12 +1268,12 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /* (win)->_color = (p), \ OK) #define wattr_get(win,a,p,opts) ((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \ - (void)((p) != (void *)0 && (*(p) = (win)->_color)), \ + (void)((p) != (void *)0 && (*(p) = (short)(win)->_color)), \ OK) #else -#define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK) +#define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | (attr_t)COLOR_PAIR(p)), OK) #define wattr_get(win,a,p,opts) ((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \ - (void)((p) != (void *)0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \ + (void)((p) != (void *)0 && (*(p) = (short)PAIR_NUMBER((win)->_attrs))), \ OK) #endif #endif /* NCURSES_OPAQUE */ diff --git a/ncurses/base/MKlib_gen.sh b/ncurses/base/MKlib_gen.sh index decf3c6a..c4319bf0 100755 --- a/ncurses/base/MKlib_gen.sh +++ b/ncurses/base/MKlib_gen.sh @@ -2,7 +2,7 @@ # # MKlib_gen.sh -- generate sources from curses.h macro definitions # -# ($Id: MKlib_gen.sh,v 1.41 2010/12/19 00:39:24 tom Exp $) +# ($Id: MKlib_gen.sh,v 1.42 2011/01/01 22:06:52 tom Exp $) # ############################################################################## # Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. # @@ -200,6 +200,7 @@ $0 !~ /^P_/ { } } second = first + 1; + returnCast = ""; if ( $first == "chtype" ) { returnType = "Chtype"; } else if ( $first == "SCREEN" ) { @@ -207,7 +208,8 @@ $0 !~ /^P_/ { } else if ( $first == "WINDOW" ) { returnType = "Win"; } else if ( $first == "attr_t" || $second == "attrset" || $second == "standout" || $second == "standend" || $second == "wattrset" || $second == "wstandout" || $second == "wstandend" ) { - returnType = "Attr"; + returnType = "IntAttr"; + returnCast = "(attr_t)"; } else if ( $first == "bool" || $first == "NCURSES_BOOL" ) { returnType = "Bool"; } else if ( $second == "*" ) { @@ -283,6 +285,7 @@ $0 !~ /^P_/ { } if ( ch == "," || ch == ")" ) { + argcast = ""; if (va_list) { call = call "%s" } else if (varargs) { @@ -303,6 +306,9 @@ $0 !~ /^P_/ { } else if ( argtype != "" ) { call = call "%s" comma = comma "_trace" argtype "2(" num "," + if (argtype == "attr") { + argcast = "(chtype)"; + } } else { call = call "%#lx" comma = comma "(long)" @@ -316,7 +322,7 @@ $0 !~ /^P_/ { } else if ( varargs ) { args = args comma "\"...\"" } else { - args = args comma "z" + args = args comma argcast "z" } } call = call ch @@ -338,12 +344,16 @@ $0 !~ /^P_/ { if (dotrace) printf "%s", call - if (match($0, "^void")) + if (match($0, "^void")) { call = "" - else if (dotrace) + } else if (dotrace) { call = sprintf("return%s( ", returnType); - else + if (returnCast != "") { + call = call returnCast; + } + } else { call = "@@return "; + } call = call $myfunc "("; for (i = 1; i < argcount; i++) { @@ -358,8 +368,9 @@ $0 !~ /^P_/ { } if (!match($0, "^void")) call = call ") "; - if (dotrace) + if (dotrace) { call = call ")"; + } print call ";" if (match($0, "^void")) diff --git a/ncurses/base/lib_bkgd.c b/ncurses/base/lib_bkgd.c index 784da197..d07d8111 100644 --- a/ncurses/base/lib_bkgd.c +++ b/ncurses/base/lib_bkgd.c @@ -36,7 +36,7 @@ #include -MODULE_ID("$Id: lib_bkgd.c,v 1.41 2010/05/01 22:16:21 tom Exp $") +MODULE_ID("$Id: lib_bkgd.c,v 1.42 2011/01/01 17:18:52 tom Exp $") /* * Set the window's background information. @@ -90,7 +90,7 @@ wbkgrndset(WINDOW *win, const ARG_CH_T ch) win->_bkgd = (((tmp == EOF) ? ' ' : (chtype) tmp) | (AttrOf(wch) & ALL_BUT_COLOR) - | ColorPair(GET_WINDOW_PAIR(win))); + | (chtype) ColorPair(GET_WINDOW_PAIR(win))); } #endif } diff --git a/ncurses/base/lib_mouse.c b/ncurses/base/lib_mouse.c index 0ab894af..621f8f70 100644 --- a/ncurses/base/lib_mouse.c +++ b/ncurses/base/lib_mouse.c @@ -84,7 +84,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_mouse.c,v 1.119 2010/05/22 20:00:55 tom Exp $") +MODULE_ID("$Id: lib_mouse.c,v 1.120 2011/01/01 22:25:49 tom Exp $") #include @@ -1450,7 +1450,7 @@ NCURSES_SP_NAME(mousemask) (NCURSES_SP_DCLx mmask_t newmask, mmask_t * oldmask) } } } - returnBits(result); + returnMMask(result); } #if NCURSES_SP_FUNCS diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h index 3d357777..0db05ddf 100644 --- a/ncurses/curses.priv.h +++ b/ncurses/curses.priv.h @@ -34,7 +34,7 @@ ****************************************************************************/ /* - * $Id: curses.priv.h,v 1.470 2010/12/25 23:45:09 tom Exp $ + * $Id: curses.priv.h,v 1.472 2011/01/01 23:01:40 tom Exp $ * * curses.priv.h * @@ -1505,7 +1505,9 @@ extern NCURSES_EXPORT(void) _nc_locked_tracef (const char *, ...) GCC_PRINTFLIKE #define TR(n, a) if (USE_TRACEF(n)) _nc_locked_tracef a #define T(a) TR(TRACE_CALLS, a) -#define TRACE_RETURN(value,type) return _nc_retrace_##type(value) +#define TRACE_RETURN(value,type) return _nc_retrace_##type(value) +#define TRACE_RETURN2(value,dst,src) return _nc_retrace_##dst##_##src(value) +#define TRACE_RETURN_SP(value,type) return _nc_retrace_##type(SP_PARM, value) #define NonNull(s) ((s) != 0 ? s : "") @@ -1517,6 +1519,8 @@ extern NCURSES_EXPORT(void) _nc_locked_tracef (const char *, ...) GCC_PRINTFLIKE #define returnChar(code) TRACE_RETURN(code,char) #define returnChtype(code) TRACE_RETURN(code,chtype) #define returnCode(code) TRACE_RETURN(code,int) +#define returnIntAttr(code) TRACE_RETURN2(code,int,attr_t) +#define returnMMask(code) TRACE_RETURN_SP(code,mmask_t) #define returnPtr(code) TRACE_RETURN(code,ptr) #define returnSP(code) TRACE_RETURN(code,sp) #define returnVoid T((T_RETURN(""))); return @@ -1536,6 +1540,8 @@ extern NCURSES_EXPORT(const char *) _nc_altcharset_name(attr_t, chtype); extern NCURSES_EXPORT(const char *) _nc_retrace_cptr (const char *); extern NCURSES_EXPORT(char) _nc_retrace_char (char); extern NCURSES_EXPORT(int) _nc_retrace_int (int); +extern NCURSES_EXPORT(int) _nc_retrace_int_attr_t (attr_t); +extern NCURSES_EXPORT(mmask_t) _nc_retrace_mmask_t (SCREEN *, mmask_t); extern NCURSES_EXPORT(unsigned) _nc_retrace_unsigned (unsigned); extern NCURSES_EXPORT(void *) _nc_retrace_void_ptr (void *); extern NCURSES_EXPORT(void) _nc_fifo_dump (SCREEN *); @@ -1578,6 +1584,8 @@ extern NCURSES_EXPORT(const char *) _nc_viscbuf (const NCURSES_CH_T *, int); #define returnChar(code) return ((char) code) #define returnChtype(code) return code #define returnCode(code) return code +#define returnIntAttr(code) return code +#define returnMMask(code) return code #define returnPtr(code) return code #define returnSP(code) return code #define returnVoid return diff --git a/ncurses/trace/lib_traceatr.c b/ncurses/trace/lib_traceatr.c index 0f2c681e..86147c1d 100644 --- a/ncurses/trace/lib_traceatr.c +++ b/ncurses/trace/lib_traceatr.c @@ -43,7 +43,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_traceatr.c,v 1.72 2010/12/19 00:51:35 tom Exp $") +MODULE_ID("$Id: lib_traceatr.c,v 1.73 2011/01/01 22:01:11 tom Exp $") #define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name)) @@ -176,6 +176,14 @@ _traceattr(attr_t newmode) } /* Trace 'int' return-values */ +NCURSES_EXPORT(int) +_nc_retrace_int_attr_t(attr_t code) +{ + T((T_RETURN("%s"), _traceattr(code))); + return (int) code; +} + +/* Trace 'attr_t' return-values */ NCURSES_EXPORT(attr_t) _nc_retrace_attr_t(attr_t code) { diff --git a/ncurses/trace/lib_tracemse.c b/ncurses/trace/lib_tracemse.c index cf7539e8..aa74fb1f 100644 --- a/ncurses/trace/lib_tracemse.c +++ b/ncurses/trace/lib_tracemse.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * + * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -38,23 +38,16 @@ #include -MODULE_ID("$Id: lib_tracemse.c,v 1.16 2008/11/16 00:19:59 juergen Exp $") +MODULE_ID("$Id: lib_tracemse.c,v 1.17 2011/01/01 22:31:53 tom Exp $") #ifdef TRACE #define my_buffer sp->tracemse_buf -NCURSES_EXPORT(char *) -_nc_tracemouse(SCREEN *sp, MEVENT const *ep) +static char * +_trace_mmask_t(SCREEN *sp, mmask_t code) { - (void) sprintf(my_buffer, TRACEMSE_FMT, - ep->id, - ep->x, - ep->y, - ep->z, - (unsigned long) ep->bstate); - -#define SHOW(m, s) if ((ep->bstate & m) == m) strcat(strcat(my_buffer, s), ", ") +#define SHOW(m, s) if ((code & m) == m) strcat(strcat(my_buffer, s), ", ") SHOW(BUTTON1_RELEASED, "release-1"); SHOW(BUTTON1_PRESSED, "press-1"); @@ -110,10 +103,33 @@ _nc_tracemouse(SCREEN *sp, MEVENT const *ep) if (my_buffer[strlen(my_buffer) - 1] == ' ') my_buffer[strlen(my_buffer) - 2] = '\0'; + + return (my_buffer); +} + +NCURSES_EXPORT(char *) +_nc_tracemouse(SCREEN *sp, MEVENT const *ep) +{ + (void) sprintf(my_buffer, TRACEMSE_FMT, + ep->id, + ep->x, + ep->y, + ep->z, + (unsigned long) ep->bstate); + + (void) _trace_mmask_t(sp, ep->bstate); (void) strcat(my_buffer, "}"); return (my_buffer); } +NCURSES_EXPORT(mmask_t) +_nc_retrace_mmask_t(SCREEN *sp, mmask_t code) +{ + *my_buffer = '\0'; + T((T_RETURN("{%s}"), _trace_mmask_t(sp, code))); + return code; +} + NCURSES_EXPORT(char *) _tracemouse(MEVENT const *ep) {