This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] Beginner projects: warning patrol


Hi,

This patch eliminates about 15 bootstrap warnings of various types.  It
passes make bootstrap and testing without regressions.

Most warnings that are silenced with this patch are of this type:

`???' might be used uninitialized in this function.

The variables that are now initialized, do not necessarily have to be: the
eliminated warnings are clearly false positives.  I assumed that
initializing the variables is ok in this case, since fixing the diagnostic
message would be unneccesary complex.  Another thing we could do is add
some test cases for the failing diagnostics. I'm not sure what is most
wanted here.

For some of the remaining warnings of the 'uninitialized' type it is not
clear to me whether they are false positives, I'll ask some feedback in a
separate message.


The other warnings that are silenced with this patch are:

../gcc/gcc/final.c:4095: warning: function declaration isn't a prototype
../../gcc/gcc/config/i386/i386.c:4101: warning: implicit declaration of
function `final_forward_branch_p'

These were silenced by adding a declaration of `final_forward_branch_p' in
output.h


insn-output.c: In function `output_141':
insn-output.c:1497: warning: control reaches end of non-void function

This was silenced by adding a default case in (*truncdfsf2_2) of i386.md


../../gcc/gcc/java/jcf-io.c:173: warning: implicit declaration of function
`read_zip_member'
../../gcc/gcc/java/jcf-io.c:184: warning: no previous prototype for
`read_zip_member'
../../gcc/gcc/java/jcf-parse.c:620: warning: implicit declaration of
function `read_zip_member'

In the recent change to consistent (GCC_*) include guards, one instance was
overlooked. Changing JCF_H to GCC_JCF_H eliminates the warnings.


../../gcc/gcc/reload.c:1050: warning: passing arg 4 of `push_reload' from
incompatible pointer type

In the offending statement (rtx*)0 needs to be used instead of NULL_RTX.

jan


gcc/ChangeLog:
2001-06-12  Jan van Male  <jan.vanmale@fenk.wau.nl>

        * dwarf2out.c (dwarf2out_finish): Initialize `die'.
        * except.c (resolve_fixup_regions): Initialize `cleanup'.
        (convert_to_eh_region_ranges): Initialize `call_site'.
        * expr.c (move_by_pieces_1): Initialize `to1'.
        * output.h: Declare `final_forward_branch_p'
        * reload.c (push_reload): Use (rtx*)0 instead of NULL_RTX.
        * config/i386/i386.md (*truncdfsf2_2): Add default case.

gcc/cp/ChangeLog:
2001-06-12  Jan van Male  <jan.vanmale@fenk.wau.nl>

        * call.c (build_op_delete_call): Initialize `fn'.
        * call.c (joust): Initialize `*w' and `*l'.
        * init.c (build_java_class_ref): Initialize `name'.

gcc/java/ChangeLog:
2001-06-12  Jan van Male  <jan.vanmale@fenk.wau.nl>

        * zipfile.h: Use GCC_JCF_H instead of JCF_H.


Index: gcc/dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.277
diff -c -3 -p -r1.277 dwarf2out.c
*** dwarf2out.c	2001/06/10 13:47:55	1.277
--- dwarf2out.c	2001/06/12 12:05:58
*************** void
*** 11409,11415 ****
  dwarf2out_finish ()
  {
    limbo_die_node *node, *next_node;
!   dw_die_ref die;

    /* Traverse the limbo die list, and add parent/child links.  The only
       dies without parents that should be here are concrete instances of
--- 11409,11415 ----
  dwarf2out_finish ()
  {
    limbo_die_node *node, *next_node;
!   dw_die_ref die = 0;

    /* Traverse the limbo die list, and add parent/child links.  The only
       dies without parents that should be here are concrete instances of
Index: gcc/except.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/except.c,v
retrieving revision 1.168
diff -c -3 -p -r1.168 except.c
*** except.c	2001/06/08 22:57:21	1.168
--- except.c	2001/06/12 12:05:59
*************** static void
*** 1084,1094 ****
  resolve_fixup_regions ()
  {
    int i, j, n = cfun->eh->last_region_number;

    for (i = 1; i <= n; ++i)
      {
        struct eh_region *fixup = cfun->eh->region_array[i];
-       struct eh_region *cleanup;

        if (! fixup || fixup->type != ERT_FIXUP)
  	continue;
--- 1084,1094 ----
  resolve_fixup_regions ()
  {
    int i, j, n = cfun->eh->last_region_number;
+   struct eh_region *cleanup = 0;

    for (i = 1; i <= n; ++i)
      {
        struct eh_region *fixup = cfun->eh->region_array[i];

        if (! fixup || fixup->type != ERT_FIXUP)
  	continue;
*************** convert_to_eh_region_ranges ()
*** 3239,3245 ****
    rtx last_action_insn = NULL_RTX;
    rtx last_landing_pad = NULL_RTX;
    rtx first_no_action_insn = NULL_RTX;
!   int call_site;

    if (USING_SJLJ_EXCEPTIONS || cfun->eh->region_tree == NULL)
      return;
--- 3239,3245 ----
    rtx last_action_insn = NULL_RTX;
    rtx last_landing_pad = NULL_RTX;
    rtx first_no_action_insn = NULL_RTX;
!   int call_site = 0;

    if (USING_SJLJ_EXCEPTIONS || cfun->eh->region_tree == NULL)
      return;
Index: gcc/expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.326
diff -c -3 -p -r1.326 expr.c
*** expr.c	2001/06/12 11:17:09	1.326
--- expr.c	2001/06/12 12:06:03
*************** move_by_pieces_1 (genfun, mode, data)
*** 1566,1572 ****
       struct move_by_pieces *data;
  {
    unsigned int size = GET_MODE_SIZE (mode);
!   rtx to1, from1;

    while (data->len >= size)
      {
--- 1566,1572 ----
       struct move_by_pieces *data;
  {
    unsigned int size = GET_MODE_SIZE (mode);
!   rtx to1 = NULL_RTX, from1;

    while (data->len >= size)
      {
Index: gcc/output.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/output.h,v
retrieving revision 1.60
diff -c -3 -p -r1.60 output.h
*** output.h	2001/04/18 03:25:37	1.60
--- output.h	2001/06/12 12:06:04
*************** extern void output_operand_lossage  PARA
*** 84,89 ****
--- 84,94 ----
     Defined in final.c.  */
  extern void output_asm_insn	PARAMS ((const char *, rtx *));

+ /* Return 1 if branch is a forward branch.  Uses insn_shuid array, so it
+    works only in the final pass.  May be used by output templates to
+    customary add branch prediction hints.  Defined in final.c.  */
+ extern int final_forward_branch_p PARAMS ((rtx));
+
  /* Compute a worst-case reference address of a branch so that it
     can be safely used in the presence of aligned labels.
     Defined in final.c.  */
Index: gcc/reload.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload.c,v
retrieving revision 1.147
diff -c -3 -p -r1.147 reload.c
*** reload.c	2001/06/04 01:58:24	1.147
--- reload.c	2001/06/12 12:06:06
*************** push_reload (in, out, inloc, outloc, cla
*** 1046,1052 ****
  	 order as the reloads.  Thus if the outer reload is also of type
  	 RELOAD_OTHER, we are guaranteed that this inner reload will be
  	 output before the outer reload.  */
!       push_reload (SUBREG_REG (in), NULL_RTX, &SUBREG_REG (in), NULL_RTX,
  		   in_class, VOIDmode, VOIDmode, 0, 0, opnum, type);
        dont_remove_subreg = 1;
      }
--- 1046,1052 ----
  	 order as the reloads.  Thus if the outer reload is also of type
  	 RELOAD_OTHER, we are guaranteed that this inner reload will be
  	 output before the outer reload.  */
!       push_reload (SUBREG_REG (in), NULL_RTX, &SUBREG_REG (in), (rtx*)0,
  		   in_class, VOIDmode, VOIDmode, 0, 0, opnum, type);
        dont_remove_subreg = 1;
      }
Index: gcc/config/i386/i386.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
retrieving revision 1.274
diff -c -3 -p -r1.274 i386.md
*** i386.md	2001/06/06 12:57:31	1.274
--- i386.md	2001/06/12 12:06:14
***************
*** 4367,4372 ****
--- 4367,4374 ----
  	return \"fstp%z0\\t%y0\";
        else
  	return \"fst%z0\\t%y0\";
+     default:
+       abort();
      }
  }"
    [(set_attr "type" "sse,fmov")
Index: gcc/cp/call.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/call.c,v
retrieving revision 1.273
diff -c -3 -p -r1.273 call.c
*** call.c	2001/06/10 13:48:04	1.273
--- call.c	2001/06/12 12:06:16
*************** build_op_delete_call (code, addr, size,
*** 3555,3561 ****
       tree addr, size, placement;
       int flags;
  {
!   tree fn, fns, fnname, fntype, argtypes, args, type;
    int pass;

    if (addr == error_mark_node)
--- 3555,3562 ----
       tree addr, size, placement;
       int flags;
  {
!   tree fn = NULL_TREE;
!   tree fns, fnname, fntype, argtypes, args, type;
    int pass;

    if (addr == error_mark_node)
*************** tweak:
*** 5425,5431 ****
    if (!pedantic)
      {
        int rank1 = IDENTITY_RANK, rank2 = IDENTITY_RANK;
!       struct z_candidate *w, *l;

        for (i = 0; i < len; ++i)
  	{
--- 5426,5432 ----
    if (!pedantic)
      {
        int rank1 = IDENTITY_RANK, rank2 = IDENTITY_RANK;
!       struct z_candidate *w = 0, *l = 0;

        for (i = 0; i < len; ++i)
  	{
Index: gcc/cp/init.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/init.c,v
retrieving revision 1.244
diff -c -3 -p -r1.244 init.c
*** init.c	2001/05/22 00:31:36	1.244
--- init.c	2001/06/12 12:06:17
*************** tree
*** 2200,2206 ****
  build_java_class_ref (type)
       tree type;
  {
!   tree name, class_decl;
    static tree CL_suffix = NULL_TREE;
    if (CL_suffix == NULL_TREE)
      CL_suffix = get_identifier("class$");
--- 2200,2206 ----
  build_java_class_ref (type)
       tree type;
  {
!   tree name = NULL_TREE, class_decl;
    static tree CL_suffix = NULL_TREE;
    if (CL_suffix == NULL_TREE)
      CL_suffix = get_identifier("class$");
Index: gcc/java/zipfile.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/zipfile.h,v
retrieving revision 1.12
diff -c -3 -p -r1.12 zipfile.h
*** zipfile.h	2001/03/19 21:57:37	1.12
--- zipfile.h	2001/06/12 12:06:17
*************** extern struct ZipFile *SeenZipFiles;
*** 60,66 ****

  extern ZipFile * opendir_in_zip PARAMS ((const char *, int));
  extern int read_zip_archive PARAMS ((ZipFile *));
! #ifdef JCF_H
  extern int read_zip_member PARAMS ((JCF*, ZipDirectory*, ZipFile *));
  extern int open_in_zip PARAMS ((struct JCF *, const char *,
  			       const char *, int));
--- 60,66 ----

  extern ZipFile * opendir_in_zip PARAMS ((const char *, int));
  extern int read_zip_archive PARAMS ((ZipFile *));
! #ifdef GCC_JCF_H
  extern int read_zip_member PARAMS ((JCF*, ZipDirectory*, ZipFile *));
  extern int open_in_zip PARAMS ((struct JCF *, const char *,
  			       const char *, int));



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]