Date: Sat, 09 Jun 2001 09:48:42 +0300 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: Martin Str|mberg Message-Id: <7263-Sat09Jun2001094842+0300-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9 CC: djgpp-workers AT delorie DOT com In-reply-to: <200106082135.XAA13989@mother.ludd.luth.se> (message from Martin Str|mberg on Fri, 8 Jun 2001 23:35:39 +0200 (MEST)) Subject: Re: Compiler options for djdev build References: <200106082135 DOT XAA13989 AT mother DOT ludd DOT luth DOT se> Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: Martin Str|mberg > Date: Fri, 8 Jun 2001 23:35:39 +0200 (MEST) > > > > -Wundef > > -Wcast-align > > -Wconversion > > -Wsign-compare > > > > I didn't yet try to build the library with these; perhaps someone > > could try that. > > I did. Thanks! > We get a lot of warnings. Here's some diffs reflecting changes > necessary (hand-pasted in): > > Index: src/libc/ansi/locale/mbstowcs.c > =================================================================== > RCS file: /cvs/djgpp/djgpp/src/libc/ansi/locale/mbstowcs.c,v > retrieving revision 1.1 > diff -p -u -r1.1 mbstowcs.c > --- src/libc/ansi/locale/mbstowcs.c 1994/11/29 09:18:20 1.1 > +++ src/libc/ansi/locale/mbstowcs.c 2001/06/08 21:19:36 > @@ -4,8 +4,8 @@ > size_t > mbstowcs(wchar_t *wcs, const char *s, size_t n) > { > - int i; > - for (i=0; s[i] && (i + size_t i; > + for (i=0; s[i] && (i+1 wcs[i] = s[i]; This sounds like a kind of change that indeed should have been made. Mixing signed and unsigned is not a good idea. > > Finally, do we still need -fno-strength-reduce? I'd think we could > > remove that now. If we are not sure, perhaps someone could ask on the > > GCC mailing list. > > I'm trying with that one removed. Thanks. I think that -fno-strength-reduce was introduced because some old versions of GCC would sometimes produce incorrect code if this optimization were not removed. We should probably ask the GCC maintainers whether that problem is gone on x86 in GCC 2.9x series. > Some warnings I don't understand and can't get to go away (I only > tried to remove the todigit ones and gave up): > > make -C ansi/stdio > gcc ... -c doprnt.c > cc1.exe: warnings being treated as errors > doprnt.c: In function `_doprnt': > doprnt.c:167: warning: passing arg 1 of `todigit' with different width due to prototype Change `todigit' (near the beginning of doprnt.c) to accept an int instead of a char, and the warning will go away. DJ, is there any particular reason that you defined todigit as accepting a char? If the issue is efficiency, we could examine the machine code produced by GCC now; I'd guess it won't change, if GCC gets its optimizations right. > doprnt.c:277: warning: passing arg 5 of `cvtl' with different width due to prototype Similar probl;em: `cvtl's prototype says its 5th argument is a char. Basically, this warning alerts you to any function whose prototype modifies the default promotion of arguments. This flags functions whose prototypes include char, short, and float arguments. IMHO, these practices are unsafe and should be avoided. > Finally an observation. Look at doscan.c above. We have variables > declared as register. As I understand this this make optimisation by > the compiler difficult. Shouldn't we change to not use "register"? There shouldn't be a reason to do that. The `register' qualifier is just a hint to the compiler as to what variables the programmer would like to be in registers in the first priority. The compiler is free to do whatever it wants with that, including ignore them altogether.