* A few compiler warnings
@ 2001-08-07 23:51 Wayne Davison
2001-08-08 7:26 ` Sven Wischnowsky
0 siblings, 1 reply; 2+ messages in thread
From: Wayne Davison @ 2001-08-07 23:51 UTC (permalink / raw)
To: Zsh Workers
The following patch silences a few compiler warnings.
The first hunk sets "n" to NULL in bld_parts(). This isn't required
by the code, but gcc isn't smart enough to figure out that "n" can't
be used uninitialized.
The second hunk removes 3 unused variables.
The third hunk silences 3 "might be used uninitialized" warnings, but
someone who knows the code in cd_get() should look at it and see if
there is a better fix (such as making one of the other switch-case
sections the "default:", or returning an error).
I haven't committed any of this yet, though the second hunk is really
a no-brainer. Comments?
..wayne..
---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
Index: Src/Zle/compmatch.c
--- Src/Zle/compmatch.c 2001/06/27 13:18:39 1.36
+++ Src/Zle/compmatch.c 2001/08/07 19:33:00
@@ -1129,7 +1129,7 @@
Cline
bld_parts(char *str, int len, int plen, Cline *lp)
{
- Cline ret = NULL, *q = &ret, n;
+ Cline ret = NULL, *q = &ret, n = NULL;
Cmlist ms;
Cmatcher mp;
int t, op = plen;
Index: Src/Zle/compresult.c
--- Src/Zle/compresult.c 2001/07/27 12:56:57 1.40
+++ Src/Zle/compresult.c 2001/08/07 19:33:01
@@ -1520,7 +1520,7 @@
}
if (!onlyexpl) {
char **pp;
- int *ws, tlines, tline, tcols, maxlen, nth, width, glines;
+ int *ws, tlines, tcols, width, glines;
for (g = amatches; g; g = g->next) {
add = 2 + !!(g->flags & CGF_FILES);
Index: Src/Zle/computil.c
--- Src/Zle/computil.c 2001/07/30 08:42:56 1.71
+++ Src/Zle/computil.c 2001/08/07 19:33:03
@@ -640,6 +640,11 @@
csl = "packed";
}
break;
+
+ default:
+ /* Complain here? Is this impossible? */
+ opts = mats = dpys = NULL;
+ break;
}
setsparam(params[0], ztrdup(csl));
setaparam(params[1], opts);
---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: A few compiler warnings
2001-08-07 23:51 A few compiler warnings Wayne Davison
@ 2001-08-08 7:26 ` Sven Wischnowsky
0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2001-08-08 7:26 UTC (permalink / raw)
To: zsh-workers
Wayne Davison wrote:
> The following patch silences a few compiler warnings.
I'm terribly sorry -- compiling with optimisation is so slow that I
normally don't do it (only once in a while and before releases) and
without optimisations gcc doesn't report things like these.
> The first hunk sets "n" to NULL in bld_parts(). This isn't required
> by the code, but gcc isn't smart enough to figure out that "n" can't
> be used uninitialized.
Yep.
> The second hunk removes 3 unused variables.
Hmhm, the improved calculation.
> The third hunk silences 3 "might be used uninitialized" warnings, but
> someone who knows the code in cd_get() should look at it and see if
> there is a better fix (such as making one of the other switch-case
> sections the "default:", or returning an error).
Yes, run->type can only ever be of one of the CRT_* values, so we could
alternatively just turn any of the other `case's into `default'.
> I haven't committed any of this yet, though the second hunk is really
> a no-brainer. Comments?
Please go ahead and commit it.
Thanks!
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-08-08 7:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-07 23:51 A few compiler warnings Wayne Davison
2001-08-08 7:26 ` Sven Wischnowsky
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).