* gcc.c warning cleanup
@ 1998-02-06 0:57 Robert Lipe
1998-02-07 23:10 ` Jeffrey A Law
0 siblings, 1 reply; 4+ messages in thread
From: Robert Lipe @ 1998-02-06 0:57 UTC (permalink / raw)
To: egcs
A few remain in this file, but I think that most of them are due to
the flow analysis thing (if/then/else) that somone (rth?) mentioned
recently.
Fri Feb 6 01:21:03 1998 Robert Lipe <robertl@dgii.com>
* gcc.c Include <strings.h>, <stdlib.h>, <unistd.h>, <fcntl.h>.
(free_path_suffix): Remove unreferenced static function.
(process_command): Remove unused variable temp.
(default_arg): Remove unused variable i.
(do_spec_1): Add parens for assignment used as truth value.
(main): Likewise.
(validate_all_switches): Likewise.
(main): Remove unused variables i, first_time>
Index: gcc.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/gcc.c,v
retrieving revision 1.11
diff -u -p -r1.11 gcc.c
--- gcc.c 1998/01/26 22:59:49 1.11
+++ gcc.c 1998/02/06 07:19:48
@@ -53,6 +53,22 @@ compilation is specified by a string cal
#endif
#include <stdio.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
#ifndef R_OK
#define R_OK 4
#define W_OK 2
@@ -2101,25 +2117,6 @@ unused_prefix_warnings (pprefix)
}
}
-/* Get rid of all prefixes built up so far in *PLISTP. */
-
-static void
-free_path_prefix (pprefix)
- struct path_prefix *pprefix;
-{
- struct prefix_list *pl = pprefix->plist;
- struct prefix_list *temp;
-
- while (pl)
- {
- temp = pl;
- pl = pl->next;
- free (temp->prefix);
- free ((char *) temp);
- }
-
- pprefix->plist = (struct prefix_list *) 0;
-}
\f
/* Execute the command specified by the arguments on the current line of spec.
When using pipes, this includes several piped-together commands
@@ -2697,7 +2694,6 @@ process_command (argc, argv)
case 'B':
{
- int *temp = (int *) xmalloc (sizeof (int));
char *value;
if (p[1] == 0 && i + 1 == argc)
fatal ("argument to `-B' is missing");
@@ -3136,7 +3132,7 @@ do_spec_1 (spec, inswitch, soft_matched_
char *string;
int value;
- while (c = *p++)
+ while ((c = *p++))
/* If substituting a switch, treat all chars like letters.
Otherwise, NL, SPC, TAB and % are special. */
switch (inswitch ? 'a' : c)
@@ -4450,7 +4446,7 @@ main (argc, argv)
first_time = FALSE;
obstack_grow (&collect_obstack, "'-", 2);
q = switches[i].part1;
- while (p = (char *) index (q,'\''))
+ while ((p = (char *) index (q,'\'')))
{
obstack_grow (&collect_obstack, q, p-q);
obstack_grow (&collect_obstack, "'\\''", 4);
@@ -4463,7 +4459,7 @@ main (argc, argv)
{
obstack_grow (&collect_obstack, " '", 2);
q = *args;
- while (p = (char *) index (q,'\''))
+ while ((p = (char *) index (q,'\'')))
{
obstack_grow (&collect_obstack, q, p-q);
obstack_grow (&collect_obstack, "'\\''", 4);
@@ -4774,8 +4770,6 @@ main (argc, argv)
if (error_count == 0)
{
int tmp = execution_count;
- int i;
- int first_time;
/* Rebuild the COMPILER_PATH and LIBRARY_PATH environment variables
for collect. */
@@ -5090,7 +5084,7 @@ validate_all_switches ()
for (i = 0; i < sizeof comp->spec / sizeof comp->spec[0] && comp->spec[i]; i++)
{
p = comp->spec[i];
- while (c = *p++)
+ while ((c = *p++))
if (c == '%' && *p == '{')
/* We have a switch spec. */
validate_switches (p + 1);
@@ -5101,14 +5095,14 @@ validate_all_switches ()
for (spec = specs; spec ; spec = spec->next)
{
p = *(spec->ptr_spec);
- while (c = *p++)
+ while ((c = *p++))
if (c == '%' && *p == '{')
/* We have a switch spec. */
validate_switches (p + 1);
}
p = link_command_spec;
- while (c = *p++)
+ while ((c = *p++))
if (c == '%' && *p == '{')
/* We have a switch spec. */
validate_switches (p + 1);
@@ -5257,7 +5251,6 @@ default_arg (p, len)
int len;
{
char *start, *end;
- int i;
for (start = multilib_defaults; *start != '\0'; start = end+1)
{
--
Robert Lipe http://www.dgii.com/people/robertl robertl@dgii.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gcc.c warning cleanup
1998-02-06 0:57 gcc.c warning cleanup Robert Lipe
@ 1998-02-07 23:10 ` Jeffrey A Law
0 siblings, 0 replies; 4+ messages in thread
From: Jeffrey A Law @ 1998-02-07 23:10 UTC (permalink / raw)
To: Robert Lipe; +Cc: egcs
In message < 19980206012704.07567@dgii.com >you write:
> A few remain in this file, but I think that most of them are due to
> the flow analysis thing (if/then/else) that somone (rth?) mentioned
> recently.
>
>
> Fri Feb 6 01:21:03 1998 Robert Lipe <robertl@dgii.com>
>
> * gcc.c Include <strings.h>, <stdlib.h>, <unistd.h>, <fcntl.h>.
> (free_path_suffix): Remove unreferenced static function.
> (process_command): Remove unused variable temp.
> (default_arg): Remove unused variable i.
> (do_spec_1): Add parens for assignment used as truth value.
> (main): Likewise.
> (validate_all_switches): Likewise.
> (main): Remove unused variables i, first_time>
I fixed up the strings/string issue and installed this patch.
jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gcc.c warning cleanup
1998-02-07 11:58 Kaveh R. Ghazi
@ 1998-02-07 12:43 ` Robert Lipe
0 siblings, 0 replies; 4+ messages in thread
From: Robert Lipe @ 1998-02-07 12:43 UTC (permalink / raw)
To: Kaveh R. Ghazi, egcs
> Thanks for helping out. Your patch looks great, it looks like
Thank you...on both counts.
> The only suggestion I have is that for strings.h you follow
> the convention of including string.h first and only get strings.h if
> string.h doesn't exist. Ie,
>
> > #ifdef HAVE_STRING_H
> > # include <string.h>
> > #else
> > # ifdef HAVE_STRINGS_H
> > # include <strings.h>
> > # endif
> > #endif
I'm not real fond of that, but if that's the preferred approach, it's
easy enough to resubmit them.
Why? At least on OpenServer, the protos for things like bcopy, bcmp,
and bzero are in <strings.h> and definitely not in <string.h>. With
the logic you list, the protos for those functions will never be seen.
--
Robert Lipe http://www.dgii.com/people/robertl robertl@dgii.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gcc.c warning cleanup
@ 1998-02-07 11:58 Kaveh R. Ghazi
1998-02-07 12:43 ` Robert Lipe
0 siblings, 1 reply; 4+ messages in thread
From: Kaveh R. Ghazi @ 1998-02-07 11:58 UTC (permalink / raw)
To: egcs, robertl
> From: Robert Lipe <robertl@dgii.com>
>
> A few remain in this file, but I think that most of them are due to
> the flow analysis thing (if/then/else) that somone (rth?) mentioned
> recently.
>
>
> Fri Feb 6 01:21:03 1998 Robert Lipe <robertl@dgii.com>
>
> * gcc.c Include <strings.h>, <stdlib.h>, <unistd.h>, <fcntl.h>.
> (free_path_suffix): Remove unreferenced static function.
> (process_command): Remove unused variable temp.
> (default_arg): Remove unused variable i.
> (do_spec_1): Add parens for assignment used as truth value.
> (main): Likewise.
> (validate_all_switches): Likewise.
> (main): Remove unused variables i, first_time>
Hi Robert,
Thanks for helping out. Your patch looks great, it looks like
you also plugged a tiny memory leak when you got rid of variable
`temp' in process_command().
The only suggestion I have is that for strings.h you follow
the convention of including string.h first and only get strings.h if
string.h doesn't exist. Ie,
> #ifdef HAVE_STRING_H
> # include <string.h>
> #else
> # ifdef HAVE_STRINGS_H
> # include <strings.h>
> # endif
> #endif
Great work.
--Kaveh
--
Kaveh R. Ghazi Project Manager / Custom Development
ghazi@caip.rutgers.edu ICon CMT Corp.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1998-02-07 23:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-06 0:57 gcc.c warning cleanup Robert Lipe
1998-02-07 23:10 ` Jeffrey A Law
1998-02-07 11:58 Kaveh R. Ghazi
1998-02-07 12:43 ` Robert Lipe
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 read-only IMAP folder(s) and NNTP newsgroup(s).