This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch] gcc/gcc.c remove missing initializer warnings
- To: gcc-patches at gcc dot gnu dot org
- Subject: [Patch] gcc/gcc.c remove missing initializer warnings
- From: Peter Schmid <schmid at snake dot iap dot physik dot tu-darmstadt dot de>
- Date: Wed, 28 Feb 2001 18:36:19 +0100 (CET)
While bootstrapping the gcc compiler many warning are generated while
gcc/gcc.c is compiled. There are multiple warnings since the third
element of the struct compiler (cpp_spec) is not initialised.
The excerpt from the logfile shows only some of these warnings:
gcc -DIN_GCC -g -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/config -I../../gcc/gcc/../include \
-DSTANDARD_STARTFILE_PREFIX=\"../../../\" -DSTANDARD_EXEC_PREFIX=\"/usr/local/lib/gcc-lib/\" -DDEFAULT_TARGET_VERSION=\"3.0\" -DDEFAULT_TARGET_MACHINE=\"i686-pc-linux-gnu\" -DSTANDARD_BINDIR_PREFIX=\"/usr/local/bin/\" -DTOOLDIR_BASE_PREFIX=\"../../../../\" `test "${SHLIB_LINK}" -a "yes" = "yes" && echo "-DENABLE_SHARED_LIBGCC"` `test "${SHLIB_MULTILIB}" && echo "-DNO_SHARED_LIBGCC_MULTILIB"` \
-c ../../gcc/gcc/gcc.c)
../../gcc/gcc/gcc.c:611: warning: string length `893' is greater than the length `509' ISO C89 compilers are required to support
../../gcc/gcc/gcc.c:732: warning: missing initializer
../../gcc/gcc/gcc.c:732: warning: (near initialization for `default_compilers[0].cpp_spec')
../../gcc/gcc/gcc.c:732: warning: missing initializer
../../gcc/gcc/gcc.c:732: warning: (near initialization for `default_compilers[1].cpp_spec')
../../gcc/gcc/gcc.c:733: warning: missing initializer
../../gcc/gcc/gcc.c:733: warning: (near initialization for `default_compilers[2].cpp_spec')
../../gcc/gcc/gcc.c:733: warning: missing initializer
../../gcc/gcc/gcc.c:733: warning: (near initialization for `default_compilers[3].cpp_spec')
../../gcc/gcc/gcc.c:733: warning: missing initializer
../../gcc/gcc/gcc.c:733: warning: (near initialization for `default_compilers[4].cpp_spec')
../../gcc/gcc/gcc.c:733: warning: missing initializer
../../gcc/gcc/gcc.c:733: warning: (near initialization for `default_compilers[5].cpp_spec')
../../gcc/gcc/gcc.c:734: warning: missing initializer
../../gcc/gcc/gcc.c:734: warning: (near initialization for `default_compilers[6].cpp_spec')
../../gcc/gcc/gcc.c:734: warning: missing initializer
../../gcc/gcc/gcc.c:734: warning: (near initialization for `default_compilers[7].cpp_spec')
../../gcc/gcc/gcc.c:734: warning: missing initializer
../../gcc/gcc/gcc.c:734: warning: (near initialization for `default_compilers[8].cpp_spec')
../../gcc/gcc/gcc.c:735: warning: missing initializer
../../gcc/gcc/gcc.c:735: warning: (near initialization for `default_compilers[9].cpp_spec')
../../gcc/gcc/gcc.c:735: warning: missing initializer
../../gcc/gcc/gcc.c:735: warning: (near initialization for `default_compilers[10].cpp_spec')
../../gcc/gcc/gcc.c:735: warning: missing initializer
../../gcc/gcc/gcc.c:735: warning: (near initialization for `default_compilers[11].cpp_spec')
../../gcc/gcc/gcc.c:736: warning: missing initializer
../../gcc/gcc/gcc.c:736: warning: (near initialization for `default_compilers[12].cpp_spec')
../../gcc/gcc/gcc.c:736: warning: missing initializer
../../gcc/gcc/gcc.c:736: warning: (near initialization for `default_compilers[13].cpp_spec')
../../gcc/gcc/gcc.c:736: warning: missing initializer
../../gcc/gcc/gcc.c:736: warning: (near initialization for `default_compilers[14].cpp_spec')
../../gcc/gcc/gcc.c:737: warning: missing initializer
../../gcc/gcc/gcc.c:737: warning: (near initialization for `default_compilers[15].cpp_spec')
../../gcc/gcc/gcc.c:737: warning: missing initializer
../../gcc/gcc/gcc.c:737: warning: (near initialization for `default_compilers[16].cpp_spec')
../../gcc/gcc/gcc.c:737: warning: missing initializer
../../gcc/gcc/gcc.c:737: warning: (near initialization for `default_compilers[17].cpp_spec')
The attached patch removes these warnings by explicitly initializing
this element to zero. After applying these changes I bootstrapped the
compiler again from scratch and ran the testsuites. There were no
regression.
Peter Schmid
Changelog
2001-02-28 Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de>
* gcc.c (default compilers[]): Initialize cpp_spec
* cp/lang-specs.h: likewise
* f/lang-specs.h: likewise
* objc/lang-spec.h: likewise
*** gcc/gcc.c.orig Tue Feb 27 21:53:19 2001
--- gcc/gcc.c Tue Feb 27 22:38:13 2001
*************** static struct compiler default_compilers
*** 729,747 ****
were not present when we built the driver, we will hit these copies
and be given a more meaningful error than "file not used since
linking is not done". */
! {".m", "#Objective-C"}, {".mi", "#Objective-C"},
! {".cc", "#C++"}, {".cxx", "#C++"}, {".cpp", "#C++"}, {".cp", "#C++"},
! {".c++", "#C++"}, {".C", "#C++"}, {".ii", "#C++"},
! {".ads", "#Ada"}, {".adb", "#Ada"}, {".ada", "#Ada"},
! {".f", "#Fortran"}, {".for", "#Fortran"}, {".fpp", "#Fortran"},
! {".F", "#Fortran"}, {".FOR", "#Fortran"}, {".FPP", "#Fortran"},
! {".r", "#Ratfor"},
! {".p", "#Pascal"}, {".pas", "#Pascal"},
! {".ch", "#Chill"}, {".chi", "#Chill"},
! {".java", "#Java"}, {".class", "#Java"},
! {".zip", "#Java"}, {".jar", "#Java"},
/* Next come the entries for C. */
! {".c", "@c"},
{"@c",
/* cc1 has an integrated ISO C preprocessor. We should invoke the
external preprocessor if -save-temps or -traditional is given. */
--- 729,746 ----
were not present when we built the driver, we will hit these copies
and be given a more meaningful error than "file not used since
linking is not done". */
! {".m", "#Objective-C", 0}, {".mi", "#Objective-C", 0},
! {".cc", "#C++", 0}, {".cxx", "#C++", 0}, {".cpp", "#C++", 0},
! {".cp", "#C++", 0}, {".c++", "#C++", 0}, {".C", "#C++", 0},
! {".ii", "#C++", 0}, {".ads", "#Ada", 0}, {".adb", "#Ada", 0},
! {".ada", "#Ada", 0}, {".f", "#Fortran", 0}, {".for", "#Fortran", 0},
! {".fpp", "#Fortran", 0}, {".F", "#Fortran", 0}, {".FOR", "#Fortran", 0},
! {".FPP", "#Fortran", 0}, {".r", "#Ratfor", 0}, {".p", "#Pascal", 0},
! {".pas", "#Pascal", 0}, {".ch", "#Chill", 0}, {".chi", "#Chill", 0},
! {".java", "#Java", 0}, {".class", "#Java", 0},
! {".zip", "#Java", 0}, {".jar", "#Java", 0},
/* Next come the entries for C. */
! {".c", "@c", 0},
{"@c",
/* cc1 has an integrated ISO C preprocessor. We should invoke the
external preprocessor if -save-temps or -traditional is given. */
*************** static struct compiler default_compilers
*** 759,782 ****
%{!fsyntax-only:%(invoke_as)}}}}"},
{"-",
"%{!E:%e-E required when input is from standard input}\
! %(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options)"},
! {".h", "@c-header"},
{"@c-header",
"%{!E:%eCompilation of header file requested} \
! %(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options)"},
! {".i", "@cpp-output"},
{"@cpp-output",
! "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}"},
! {".s", "@assembler"},
{"@assembler",
! "%{!M:%{!MM:%{!E:%{!S:as %(asm_options) %i %A }}}}"},
! {".S", "@assembler-with-cpp"},
{"@assembler-with-cpp",
"%(trad_capable_cpp) -lang-asm %(cpp_options)\
! %{!M:%{!MM:%{!E:%(invoke_as)}}}"},
#include "specs.h"
/* Mark end of table */
! {0, 0}
};
/* Number of elements in default_compilers, not counting the terminator. */
--- 758,781 ----
%{!fsyntax-only:%(invoke_as)}}}}"},
{"-",
"%{!E:%e-E required when input is from standard input}\
! %(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options)", 0},
! {".h", "@c-header", 0},
{"@c-header",
"%{!E:%eCompilation of header file requested} \
! %(trad_capable_cpp) -lang-c %{ansi:-std=c89} %(cpp_options)", 0},
! {".i", "@cpp-output", 0},
{"@cpp-output",
! "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0},
! {".s", "@assembler", 0},
{"@assembler",
! "%{!M:%{!MM:%{!E:%{!S:as %(asm_options) %i %A }}}}", 0},
! {".S", "@assembler-with-cpp", 0},
{"@assembler-with-cpp",
"%(trad_capable_cpp) -lang-asm %(cpp_options)\
! %{!M:%{!MM:%{!E:%(invoke_as)}}}", 0},
#include "specs.h"
/* Mark end of table */
! {0, 0, 0}
};
/* Number of elements in default_compilers, not counting the terminator. */
*** ./gcc/cp/lang-specs.h.orig Tue Feb 27 22:35:18 2001
--- ./gcc/cp/lang-specs.h Tue Feb 27 22:46:28 2001
*************** Boston, MA 02111-1307, USA. */
*** 22,33 ****
/* This is the contribution to the `default_compilers' array in gcc.c for
g++. */
! {".cc", "@c++"},
! {".cp", "@c++"},
! {".cxx", "@c++"},
! {".cpp", "@c++"},
! {".c++", "@c++"},
! {".C", "@c++"},
{"@c++",
/* cc1plus has an integrated ISO C preprocessor. We should invoke
the external preprocessor if -save-temps is given. */
--- 22,33 ----
/* This is the contribution to the `default_compilers' array in gcc.c for
g++. */
! {".cc", "@c++", 0},
! {".cp", "@c++", 0},
! {".cxx", "@c++", 0},
! {".cpp", "@c++", 0},
! {".c++", "@c++", 0},
! {".C", "@c++", 0},
{"@c++",
/* cc1plus has an integrated ISO C preprocessor. We should invoke
the external preprocessor if -save-temps is given. */
*************** Boston, MA 02111-1307, USA. */
*** 55,62 ****
, CPLUSPLUS_CPP_SPEC
#endif
},
! {".ii", "@c++-cpp-output"},
{"@c++-cpp-output",
"%{!M:%{!MM:%{!E:\
cc1plus -fpreprocessed %i %(cc1_options) %2 %{+e*}\
! %{!fsyntax-only:%(invoke_as)}}}}"},
--- 55,62 ----
, CPLUSPLUS_CPP_SPEC
#endif
},
! {".ii", "@c++-cpp-output", 0},
{"@c++-cpp-output",
"%{!M:%{!MM:%{!E:\
cc1plus -fpreprocessed %i %(cc1_options) %2 %{+e*}\
! %{!fsyntax-only:%(invoke_as)}}}}", 0},
*** ./gcc/f/lang-specs.h.orig Tue Feb 27 22:34:37 2001
--- ./gcc/f/lang-specs.h Tue Feb 27 22:39:20 2001
*************** the Free Software Foundation, 59 Temple
*** 24,46 ****
/* This is the contribution to the `default_compilers' array in gcc.c for
g77. */
! {".F", "@f77-cpp-input"},
! {".fpp", "@f77-cpp-input"},
! {".FPP", "@f77-cpp-input"},
{"@f77-cpp-input",
"tradcpp0 -lang-fortran %(cpp_options) %{!M:%{!MM:%{!E:%{!pipe:%g.f |\n\
! f771 %{!pipe:%g.f} %(cc1_options) %{I*} %{!fsyntax-only:%(invoke_as)}}}}}"},
! {".r", "@ratfor"},
{"@ratfor",
"%{C:%{!E:%eGNU C does not support -C without using -E}}\
ratfor %{C} %{v} %i %{E:%W{o*}} %{!E: %{!pipe:-o %g.f} |\n\
! f771 %{!pipe:%g.f} %(cc1_options) %{I*} %{!fsyntax-only:%(invoke_as)}}"},
! {".f", "@f77"},
! {".for", "@f77"},
! {".FOR", "@f77"},
{"@f77",
"%{!M:%{!MM:%{!E:f771 %i %(cc1_options) %{I*}\
! %{!fsyntax-only:%(invoke_as)}}}}"},
/* XXX This is perverse and should not be necessary. */
{"@f77-version",
"tradcpp0 -lang-fortran %(cpp_options) %j \n\
--- 24,46 ----
/* This is the contribution to the `default_compilers' array in gcc.c for
g77. */
! {".F", "@f77-cpp-input", 0},
! {".fpp", "@f77-cpp-input", 0},
! {".FPP", "@f77-cpp-input", 0},
{"@f77-cpp-input",
"tradcpp0 -lang-fortran %(cpp_options) %{!M:%{!MM:%{!E:%{!pipe:%g.f |\n\
! f771 %{!pipe:%g.f} %(cc1_options) %{I*} %{!fsyntax-only:%(invoke_as)}}}}}", 0},
! {".r", "@ratfor", 0},
{"@ratfor",
"%{C:%{!E:%eGNU C does not support -C without using -E}}\
ratfor %{C} %{v} %i %{E:%W{o*}} %{!E: %{!pipe:-o %g.f} |\n\
! f771 %{!pipe:%g.f} %(cc1_options) %{I*} %{!fsyntax-only:%(invoke_as)}}", 0},
! {".f", "@f77", 0},
! {".for", "@f77", 0},
! {".FOR", "@f77", 0},
{"@f77",
"%{!M:%{!MM:%{!E:f771 %i %(cc1_options) %{I*}\
! %{!fsyntax-only:%(invoke_as)}}}}", 0},
/* XXX This is perverse and should not be necessary. */
{"@f77-version",
"tradcpp0 -lang-fortran %(cpp_options) %j \n\
*** ./gcc/objc/lang-specs.h.orig Tue Feb 27 22:37:30 2001
--- ./gcc/objc/lang-specs.h Tue Feb 27 22:48:55 2001
*************** Boston, MA 02111-1307, USA. */
*** 21,27 ****
/* This is the contribution to the `default_compilers' array in gcc.c for
objc. */
! {".m", "@objective-c"},
{"@objective-c",
/* cc1obj has an integrated ISO C preprocessor. We should invoke the
external preprocessor if -save-temps or -traditional is given. */
--- 21,27 ----
/* This is the contribution to the `default_compilers' array in gcc.c for
objc. */
! {".m", "@objective-c", 0},
{"@objective-c",
/* cc1obj has an integrated ISO C preprocessor. We should invoke the
external preprocessor if -save-temps or -traditional is given. */
*************** Boston, MA 02111-1307, USA. */
*** 37,43 ****
%{!traditional:%{!ftraditional:%{!traditional-cpp:\
cc1obj %{ansi:-std=c89} %(cpp_options) %(cc1_options) %{gen-decls}}}}}\
%{!fsyntax-only:%(invoke_as)}}}}"},
! {".mi", "@objc-cpp-output"},
{"@objc-cpp-output",
"%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{gen-decls}\
! %{!fsyntax-only:%(invoke_as)}}}}"},
--- 37,43 ----
%{!traditional:%{!ftraditional:%{!traditional-cpp:\
cc1obj %{ansi:-std=c89} %(cpp_options) %(cc1_options) %{gen-decls}}}}}\
%{!fsyntax-only:%(invoke_as)}}}}"},
! {".mi", "@objc-cpp-output", 0},
{"@objc-cpp-output",
"%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{gen-decls}\
! %{!fsyntax-only:%(invoke_as)}}}}", 0},