Message ID | 1397487134-30090-1-git-send-email-patrick@parcs.ath.cx |
---|---|
State | New |
Headers | show |
On Mon, Apr 14, 2014 at 4:52 PM, Patrick Palka <patrick@parcs.ath.cx> wrote: > Hi everyone, > > Many source files currently define a global function that is not > previously declared within that source file because the source file did > not include the appropriate header file that declares said function. > This patch fixes a number of these occurrences by making sure to include > the appropriate header file within the offending source files. > > Bootstrapped and regtested on x86_64-unknown-linux-gnu. How did you find these? (in the C bootstrap times -Wstrict-prototypes did that) Thanks, Richard. > 2014-04-11 Patrick Palka <patrick@parcs.ath.cx> > > gcc/ > * builtins.c: Include targhooks.h. > * calls.c: Include calls.h. > * cfgexpand.c: Include cfgexpand.h. > * cfgloop.c: Include tree-ssa-loop-niter.h. > * gimple-builder.c: Include gimple-builder.h. > * input.c: Include diagnostic.h. > * print-tree.c: Include print-tree.h. > * stringpool.c: Include stringpool.h. > * tree-cfgcleanup.c: Include tree-cfgcleanup.h. > * tree-nested.c: Include tree-nested.h. > > libiberty/ > * setproctitle.c: Include libiberty.h. > * stack-limit.c: Likewise. > --- > gcc/builtins.c | 1 + > gcc/calls.c | 1 + > gcc/cfgexpand.c | 1 + > gcc/cfgloop.c | 1 + > gcc/gimple-builder.c | 1 + > gcc/input.c | 1 + > gcc/print-tree.c | 1 + > gcc/stmt.c | 1 + > gcc/stringpool.c | 1 + > gcc/tree-cfgcleanup.c | 1 + > gcc/tree-nested.c | 1 + > libiberty/setproctitle.c | 1 + > libiberty/stack-limit.c | 1 + > 13 files changed, 13 insertions(+) > > diff --git a/gcc/builtins.c b/gcc/builtins.c > index dd57b1a..e057554 100644 > --- a/gcc/builtins.c > +++ b/gcc/builtins.c > @@ -59,6 +59,7 @@ along with GCC; see the file COPYING3. If not see > #include "builtins.h" > #include "ubsan.h" > #include "cilk.h" > +#include "targhooks.h" > > > static tree do_mpc_arg1 (tree, tree, int (*)(mpc_ptr, mpc_srcptr, mpc_rnd_t)); > diff --git a/gcc/calls.c b/gcc/calls.c > index f0c92dd..ecb5c00 100644 > --- a/gcc/calls.c > +++ b/gcc/calls.c > @@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see > #include "cgraph.h" > #include "except.h" > #include "dbgcnt.h" > +#include "calls.h" > > /* Like PREFERRED_STACK_BOUNDARY but in units of bytes, not bits. */ > #define STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT) > diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c > index b7f6360..0c5fafb 100644 > --- a/gcc/cfgexpand.c > +++ b/gcc/cfgexpand.c > @@ -73,6 +73,7 @@ along with GCC; see the file COPYING3. If not see > #include "tree-ssa-address.h" > #include "recog.h" > #include "output.h" > +#include "cfgexpand.h" > > /* Some systems use __main in a way incompatible with its use in gcc, in these > cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to > diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c > index 70744d8..63e680f 100644 > --- a/gcc/cfgloop.c > +++ b/gcc/cfgloop.c > @@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see > #include "gimple-iterator.h" > #include "gimple-ssa.h" > #include "dumpfile.h" > +#include "tree-ssa-loop-niter.h" > > static void flow_loops_cfg_dump (FILE *); > > diff --git a/gcc/gimple-builder.c b/gcc/gimple-builder.c > index ba4be26..2f66f0e 100644 > --- a/gcc/gimple-builder.c > +++ b/gcc/gimple-builder.c > @@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see > #include "is-a.h" > #include "gimple.h" > #include "tree-ssanames.h" > +#include "gimple-builder.h" > > > /* Return the expression type to use based on the CODE and type of > diff --git a/gcc/input.c b/gcc/input.c > index 63cd062..3aacb32 100644 > --- a/gcc/input.c > +++ b/gcc/input.c > @@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see > #include "intl.h" > #include "input.h" > #include "vec.h" > +#include "diagnostic.h" > > /* This is a cache used by get_next_line to store the content of a > file to be searched for file lines. */ > diff --git a/gcc/print-tree.c b/gcc/print-tree.c > index 91b696c..6b9f2bd 100644 > --- a/gcc/print-tree.c > +++ b/gcc/print-tree.c > @@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see > #include "tree-cfg.h" > #include "tree-dump.h" > #include "dumpfile.h" > +#include "print-tree.h" > > /* Define the hash table of nodes already seen. > Such nodes are not repeated; brief cross-references are used. */ > diff --git a/gcc/stmt.c b/gcc/stmt.c > index 5d68edb..6bf5f06 100644 > --- a/gcc/stmt.c > +++ b/gcc/stmt.c > @@ -59,6 +59,7 @@ along with GCC; see the file COPYING3. If not see > #include "pretty-print.h" > #include "params.h" > #include "dumpfile.h" > +#include "stmt.h" > > > /* Functions and data structures for expanding case statements. */ > diff --git a/gcc/stringpool.c b/gcc/stringpool.c > index 4b6900c..e94d741 100644 > --- a/gcc/stringpool.c > +++ b/gcc/stringpool.c > @@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see > #include "tree.h" > #include "symtab.h" > #include "cpplib.h" > +#include "stringpool.h" > > /* The "" allocated string. */ > const char empty_string[] = ""; > diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c > index b7882cf..1be73c6 100644 > --- a/gcc/tree-cfgcleanup.c > +++ b/gcc/tree-cfgcleanup.c > @@ -52,6 +52,7 @@ along with GCC; see the file COPYING3. If not see > #include "hashtab.h" > #include "tree-ssa-propagate.h" > #include "tree-scalar-evolution.h" > +#include "tree-cfgcleanup.h" > > /* The set of blocks in that at least one of the following changes happened: > -- the statement at the end of the block was changed > diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c > index df6923f..893f4d7 100644 > --- a/gcc/tree-nested.c > +++ b/gcc/tree-nested.c > @@ -45,6 +45,7 @@ > #include "expr.h" /* FIXME: For STACK_SAVEAREA_MODE and SAVE_NONLOCAL. */ > #include "langhooks.h" > #include "gimple-low.h" > +#include "tree-nested.h" > > > /* The object of this pass is to lower the representation of a set of nested > diff --git a/libiberty/setproctitle.c b/libiberty/setproctitle.c > index 6a2fe8c..288924b 100644 > --- a/libiberty/setproctitle.c > +++ b/libiberty/setproctitle.c > @@ -25,6 +25,7 @@ Boston, MA 02110-1301, USA. */ > #include <sys/prctl.h> > #endif > #include "ansidecl.h" > +#include "libiberty.h" > > /* > > diff --git a/libiberty/stack-limit.c b/libiberty/stack-limit.c > index 82c3d44..54ec7a8 100644 > --- a/libiberty/stack-limit.c > +++ b/libiberty/stack-limit.c > @@ -35,6 +35,7 @@ Attempt to increase stack size limit to @var{pref} bytes if possible. > > #include "config.h" > #include "ansidecl.h" > +#include "libiberty.h" > > #ifdef HAVE_STDINT_H > #include <stdint.h> > -- > 1.9.1 >
On Tue, Apr 15, 2014 at 3:52 AM, Richard Biener <richard.guenther@gmail.com> wrote: > On Mon, Apr 14, 2014 at 4:52 PM, Patrick Palka <patrick@parcs.ath.cx> wrote: >> Hi everyone, >> >> Many source files currently define a global function that is not >> previously declared within that source file because the source file did >> not include the appropriate header file that declares said function. >> This patch fixes a number of these occurrences by making sure to include >> the appropriate header file within the offending source files. >> >> Bootstrapped and regtested on x86_64-unknown-linux-gnu. > > How did you find these? (in the C bootstrap times -Wstrict-prototypes > did that) > > Thanks, > Richard. Like with the other two patches, the changes in this patch address a subset of the warnings emitted by -Wmissing-declarations. In this case the subset is "extern functions that are declared inside a header file but whose defining source file does not include said header file".
On Tue, Apr 15, 2014 at 7:33 PM, Patrick Palka <patrick@parcs.ath.cx> wrote: > On Tue, Apr 15, 2014 at 3:52 AM, Richard Biener > <richard.guenther@gmail.com> wrote: >> On Mon, Apr 14, 2014 at 4:52 PM, Patrick Palka <patrick@parcs.ath.cx> wrote: >>> Hi everyone, >>> >>> Many source files currently define a global function that is not >>> previously declared within that source file because the source file did >>> not include the appropriate header file that declares said function. >>> This patch fixes a number of these occurrences by making sure to include >>> the appropriate header file within the offending source files. >>> >>> Bootstrapped and regtested on x86_64-unknown-linux-gnu. >> >> How did you find these? (in the C bootstrap times -Wstrict-prototypes >> did that) >> >> Thanks, >> Richard. > > Like with the other two patches, the changes in this patch address a > subset of the warnings emitted by -Wmissing-declarations. In this > case the subset is "extern functions that are declared inside a header > file but whose defining source file does not include said header > file". Ok. Then we should enable -Wmissing-declarations to not regress here. The patch is ok. Thanks, Richard.
diff --git a/gcc/builtins.c b/gcc/builtins.c index dd57b1a..e057554 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -59,6 +59,7 @@ along with GCC; see the file COPYING3. If not see #include "builtins.h" #include "ubsan.h" #include "cilk.h" +#include "targhooks.h" static tree do_mpc_arg1 (tree, tree, int (*)(mpc_ptr, mpc_srcptr, mpc_rnd_t)); diff --git a/gcc/calls.c b/gcc/calls.c index f0c92dd..ecb5c00 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see #include "cgraph.h" #include "except.h" #include "dbgcnt.h" +#include "calls.h" /* Like PREFERRED_STACK_BOUNDARY but in units of bytes, not bits. */ #define STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT) diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index b7f6360..0c5fafb 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -73,6 +73,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-address.h" #include "recog.h" #include "output.h" +#include "cfgexpand.h" /* Some systems use __main in a way incompatible with its use in gcc, in these cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c index 70744d8..63e680f 100644 --- a/gcc/cfgloop.c +++ b/gcc/cfgloop.c @@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple-iterator.h" #include "gimple-ssa.h" #include "dumpfile.h" +#include "tree-ssa-loop-niter.h" static void flow_loops_cfg_dump (FILE *); diff --git a/gcc/gimple-builder.c b/gcc/gimple-builder.c index ba4be26..2f66f0e 100644 --- a/gcc/gimple-builder.c +++ b/gcc/gimple-builder.c @@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see #include "is-a.h" #include "gimple.h" #include "tree-ssanames.h" +#include "gimple-builder.h" /* Return the expression type to use based on the CODE and type of diff --git a/gcc/input.c b/gcc/input.c index 63cd062..3aacb32 100644 --- a/gcc/input.c +++ b/gcc/input.c @@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see #include "intl.h" #include "input.h" #include "vec.h" +#include "diagnostic.h" /* This is a cache used by get_next_line to store the content of a file to be searched for file lines. */ diff --git a/gcc/print-tree.c b/gcc/print-tree.c index 91b696c..6b9f2bd 100644 --- a/gcc/print-tree.c +++ b/gcc/print-tree.c @@ -35,6 +35,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-cfg.h" #include "tree-dump.h" #include "dumpfile.h" +#include "print-tree.h" /* Define the hash table of nodes already seen. Such nodes are not repeated; brief cross-references are used. */ diff --git a/gcc/stmt.c b/gcc/stmt.c index 5d68edb..6bf5f06 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -59,6 +59,7 @@ along with GCC; see the file COPYING3. If not see #include "pretty-print.h" #include "params.h" #include "dumpfile.h" +#include "stmt.h" /* Functions and data structures for expanding case statements. */ diff --git a/gcc/stringpool.c b/gcc/stringpool.c index 4b6900c..e94d741 100644 --- a/gcc/stringpool.c +++ b/gcc/stringpool.c @@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see #include "tree.h" #include "symtab.h" #include "cpplib.h" +#include "stringpool.h" /* The "" allocated string. */ const char empty_string[] = ""; diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index b7882cf..1be73c6 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -52,6 +52,7 @@ along with GCC; see the file COPYING3. If not see #include "hashtab.h" #include "tree-ssa-propagate.h" #include "tree-scalar-evolution.h" +#include "tree-cfgcleanup.h" /* The set of blocks in that at least one of the following changes happened: -- the statement at the end of the block was changed diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index df6923f..893f4d7 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -45,6 +45,7 @@ #include "expr.h" /* FIXME: For STACK_SAVEAREA_MODE and SAVE_NONLOCAL. */ #include "langhooks.h" #include "gimple-low.h" +#include "tree-nested.h" /* The object of this pass is to lower the representation of a set of nested diff --git a/libiberty/setproctitle.c b/libiberty/setproctitle.c index 6a2fe8c..288924b 100644 --- a/libiberty/setproctitle.c +++ b/libiberty/setproctitle.c @@ -25,6 +25,7 @@ Boston, MA 02110-1301, USA. */ #include <sys/prctl.h> #endif #include "ansidecl.h" +#include "libiberty.h" /* diff --git a/libiberty/stack-limit.c b/libiberty/stack-limit.c index 82c3d44..54ec7a8 100644 --- a/libiberty/stack-limit.c +++ b/libiberty/stack-limit.c @@ -35,6 +35,7 @@ Attempt to increase stack size limit to @var{pref} bytes if possible. #include "config.h" #include "ansidecl.h" +#include "libiberty.h" #ifdef HAVE_STDINT_H #include <stdint.h>