X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com X-Authenticated: #27081556 X-Provags-ID: V01U2FsdGVkX1/BSPofTJjBtFJFySUpXsxwgGhhsEyQMUmpl+jcl5 Tq8kheq9Wx82B7 Message-ID: <50BE6FD2.7090300@gmx.de> Date: Tue, 04 Dec 2012 22:49:06 +0100 From: Juan Manuel Guerrero User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121025 Thunderbird/16.0.2 MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com CC: Eli Zaretskii , Ozkan Sezer Subject: Re: src/debug/fsdb/fullscr.c r1.12 References: <50BE474B DOT 9000204 AT gmx DOT de> <83ip8hr51z DOT fsf AT gnu DOT org> <83d2ypr2dw DOT fsf AT gnu DOT org> In-Reply-To: <83d2ypr2dw.fsf@gnu.org> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Reply-To: djgpp-workers AT delorie DOT com Am 04.12.2012 21:25, schrieb Eli Zaretskii: >> Date: Tue, 4 Dec 2012 22:11:30 +0200 >> From: Ozkan Sezer >> >>> Why is it better to do this: >>> >>> inst = unassemble_proper (j, &len); >>> (void) inst; /* set, but not used. */ >>> >>> instead of this: >>> >>> unassemble_proper (j, &len); >>> >>> Is it "verboten" to discard the return value of a function, for some >>> reason? Some exciting new "feature" of the latest GCC versions or >>> something? >>> >> I kept the unused var only because it is referenced in the if 0'ed >> out block. Otherwise, yours is just fine too. If your version is to >> be preferred, then it is advisable to remove that if 0'ed out block >> as well. > IMO, if we want to ignore the return value, let's do that in the most > natural way, which is not assign it to any variable. Like we do with > printf, for example, when we don't need its return value. > A new patch ignoring the return value of the function. diff -aprNU5 djgpp.orig/src/debug/fsdb/fullscr.c djgpp/src/debug/fsdb/fullscr.c --- djgpp.orig/src/debug/fsdb/fullscr.c 2012-12-01 04:29:46 +0000 +++ djgpp/src/debug/fsdb/fullscr.c 2012-12-04 22:21:24 +0000 @@ -855,11 +855,11 @@ select_source_file (char *file) static int code_skip (int origin, int count) { int len, *next, i, j, k, instcount, done, leave; - char *state, *source /* , *inst */; + char *state, *source; if (count >= 0) { while (count-- > 0) if (valid_instaddr (origin)) @@ -887,13 +887,11 @@ code_skip (int origin, int count) { done++; j = origin - done; if (valid_instaddr (j)) { -#if 0 - inst = unassemble_proper (j, &len); -#endif + unassemble_proper (j, &len); source = unassemble_source (j); next[done] = j + len; if (source) { leave = 0; @@ -907,13 +905,13 @@ code_skip (int origin, int count) code we don't need this. */ #if 0 leave = (strncmp (inst, "jmp", 3) == 0 || strncmp (inst, "ret", 3) == 0 || strncmp (inst, "iret", 4) == 0); - if (!leave) - inst = unassemble_proper (j, &len); #endif + if (!leave) + unassemble_proper (j, &len); } } } else {