Commit 20eec2c2 by Richard Stallman

(default_compilers): Add missing comma between strings, so that traditional…

(default_compilers): Add missing comma between strings, so that traditional compilers can compile gcc.c.

(default_compilers): Add missing comma between strings, so
that traditional compilers can compile gcc.c.
(main): Don't pass strcpy or strlen a NULL pointer if some of the
spec strings in default_compilers are NULL.
(validate_all_switches): Don't dereference a NULL pointer if some of
the spec strings in defalut_compilers are NULL.

From-SVN: r2039
parent c515799c
...@@ -464,7 +464,7 @@ static struct compiler default_compilers[] = ...@@ -464,7 +464,7 @@ static struct compiler default_compilers[] =
%c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\ %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\
%{traditional-cpp:-traditional}\ %{traditional-cpp:-traditional}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\ %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
%i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n" %i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
"%{!M:%{!MM:%{!E:cc1obj %{!pipe:%g.i} %1 \ "%{!M:%{!MM:%{!E:cc1obj %{!pipe:%g.i} %1 \
%{!Q:-quiet} -dumpbase %b.m %{d*} %{m*} %{a}\ %{!Q:-quiet} -dumpbase %b.m %{d*} %{m*} %{a}\
%{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \ %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \
...@@ -500,7 +500,7 @@ static struct compiler default_compilers[] = ...@@ -500,7 +500,7 @@ static struct compiler default_compilers[] =
%c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\ %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\
%{traditional-cpp:-traditional} %{trigraphs}\ %{traditional-cpp:-traditional} %{trigraphs}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\ %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
%i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n" %i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
"%{!M:%{!MM:%{!E:cc1plus %{!pipe:%g.i} %1 %2\ "%{!M:%{!MM:%{!E:cc1plus %{!pipe:%g.i} %1 %2\
%{!Q:-quiet} -dumpbase %b.cc %{d*} %{m*} %{a}\ %{!Q:-quiet} -dumpbase %b.cc %{d*} %{m*} %{a}\
%{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} %{traditional}\ %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} %{traditional}\
...@@ -545,7 +545,7 @@ static struct compiler default_compilers[] = ...@@ -545,7 +545,7 @@ static struct compiler default_compilers[] =
%c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\ %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\
%{traditional-cpp:-traditional}\ %{traditional-cpp:-traditional}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\ %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
%i %{!M:%{!MM:%{!E:%{!pipe:%g.s}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n" %i %{!M:%{!MM:%{!E:%{!pipe:%g.s}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
"%{!M:%{!MM:%{!E:%{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\ "%{!M:%{!MM:%{!E:%{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\
%{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\ %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
%{!pipe:%g.s} %A\n }}}}"}, %{!pipe:%g.s} %A\n }}}}"},
...@@ -3371,13 +3371,13 @@ main (argc, argv) ...@@ -3371,13 +3371,13 @@ main (argc, argv)
input_suffix = ""; input_suffix = "";
len = 0; len = 0;
for (i = 0; i < sizeof cp->spec / sizeof cp->spec[0]; i++) for (i = 0; i < sizeof cp->spec / sizeof cp->spec[0] && cp->spec[i]; i++)
len += strlen (cp->spec[i]); len += strlen (cp->spec[i]);
p = (char *) xmalloc (len + 1); p = (char *) xmalloc (len + 1);
len = 0; len = 0;
for (i = 0; i < sizeof cp->spec / sizeof cp->spec[0]; i++) for (i = 0; i < sizeof cp->spec / sizeof cp->spec[0] && cp->spec[i]; i++)
{ {
strcpy (p + len, cp->spec[i]); strcpy (p + len, cp->spec[i]);
len += strlen (cp->spec[i]); len += strlen (cp->spec[i]);
...@@ -3705,7 +3705,7 @@ validate_all_switches () ...@@ -3705,7 +3705,7 @@ validate_all_switches ()
for (comp = compilers; comp->spec[0]; comp++) for (comp = compilers; comp->spec[0]; comp++)
{ {
int i; int i;
for (i = 0; i < sizeof comp->spec / sizeof comp->spec[0]; i++) for (i = 0; i < sizeof comp->spec / sizeof comp->spec[0] && comp->spec[i]; i++)
{ {
p = comp->spec[i]; p = comp->spec[i];
while (c = *p++) while (c = *p++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment