This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
With gcc-3.1 (actually, current gcc from CVS), I get warnings about the divisions by zero in dead code. (That seems like a feature to me.) This patch changes `if' to #if to avoid that. Ok to commit? 2001-12-22 Roland McGrath <roland@frob.com> * iconv/skeleton.c [!RESET_INPUT_BUFFER && !SAVE_RESET_STATE]: Use preprocessor #if conditionals instead of `if' to avoid warnings about divide by zero in dead code. Index: skeleton.c =================================================================== RCS file: /cvs/glibc/libc/iconv/skeleton.c,v retrieving revision 1.53 diff -u -b -p -r1.53 skeleton.c --- skeleton.c 2001/07/06 04:54:47 1.53 +++ skeleton.c 2001/12/23 02:17:53 @@ -195,13 +195,16 @@ static int to_object; # if MIN_NEEDED_FROM == MAX_NEEDED_FROM && MIN_NEEDED_TO == MAX_NEEDED_TO /* We have to use these `if's here since the compiler cannot know that (outbuf - outerr) is always divisible by MIN_NEEDED_TO. */ +# if (MIN_NEEDED_FROM % MIN_NEEDED_TO == 0) # define RESET_INPUT_BUFFER \ - if (MIN_NEEDED_FROM % MIN_NEEDED_TO == 0) \ - *inptrp -= (outbuf - outerr) * (MIN_NEEDED_FROM / MIN_NEEDED_TO); \ - else if (MIN_NEEDED_TO % MIN_NEEDED_FROM == 0) \ - *inptrp -= (outbuf - outerr) / (MIN_NEEDED_TO / MIN_NEEDED_FROM); \ - else \ + *inptrp -= (outbuf - outerr) * (MIN_NEEDED_FROM / MIN_NEEDED_TO) +# elif (MIN_NEEDED_TO % MIN_NEEDED_FROM == 0) +# define RESET_INPUT_BUFFER \ + *inptrp -= (outbuf - outerr) / (MIN_NEEDED_TO / MIN_NEEDED_FROM) +# else +# define RESET_INPUT_BUFFER \ *inptrp -= ((outbuf - outerr) / MIN_NEEDED_TO) * MIN_NEEDED_FROM +# endif # endif #endif
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |