c-decl.c (c_decode_option): Remove support of -Wmissing-noreturn.
authorAndreas Jaeger <aj@gcc.gnu.org>
Tue, 2 Jan 2001 07:00:49 +0000 (08:00 +0100)
committerAndreas Jaeger <aj@gcc.gnu.org>
Tue, 2 Jan 2001 07:00:49 +0000 (08:00 +0100)
* c-decl.c (c_decode_option): Remove support of
-Wmissing-noreturn.

* toplev.c (documented_lang_options): Remove -Wmissing-noreturn.
(W_options): Add -Wmissing-noreturn here.

* flow.c: Define lang_missing_noreturn_ok_p.
(check_function_return_warnings): Use it.

* c-common.h: Declare lang_missing_noreturn_ok_p.

* c-lang.c (c_missing_noreturn_ok_p): New function.
(lang_init): Set lang_missing_noreturn_ok_p.

* invoke.texi (Warning Options): Document this.

From-SVN: r38612

gcc/ChangeLog
gcc/c-common.h
gcc/c-decl.c
gcc/c-lang.c
gcc/flow.c
gcc/invoke.texi
gcc/toplev.c

index fa3263062464888eaabf42f4c5e2293209dbe297..317a469bfe96df65740b21e6ab4dddbf3b07a0ea 100644 (file)
@@ -1,3 +1,21 @@
+2001-01-02  Andreas Jaeger  <aj@suse.de>
+
+       * c-decl.c (c_decode_option): Remove support of
+       -Wmissing-noreturn.
+
+       * toplev.c (documented_lang_options): Remove -Wmissing-noreturn.
+       (W_options): Add -Wmissing-noreturn here.
+
+       * flow.c: Define lang_missing_noreturn_ok_p.
+       (check_function_return_warnings): Use it.
+
+       * c-common.h: Declare lang_missing_noreturn_ok_p.
+
+       * c-lang.c (c_missing_noreturn_ok_p): New function.
+       (lang_init): Set lang_missing_noreturn_ok_p.
+
+       * invoke.texi (Warning Options): Document this.
+
 2000-12-27  Phil Edwards  <pme@sources.redhat.com>
 
        * extend.texi (C++ Extensions):  New node for C++ attributes;
@@ -113,13 +131,13 @@ Mon Jan  1 07:38:33 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
        * unroll.c (copy_loop_body, loop_iterations): Likewise.
        (remap_split_bivs): Likewise.
 
-2001-01-01  Michael Hayes  <mhayes@redhat.com> 
+2001-01-01  Michael Hayes  <mhayes@redhat.com>
 
        * loop.c (loop_ivs_free): New function.
        (strength_reduce): Break out from...
 
 2001-01-01  Michael Hayes  <mhayes@redhat.com>
-       
+
        * loop.h (struct iv): New.
        (REG_IV_TYPE, REG_IV_CLASS, REG_INFO): Modify to use 'struct iv'.
        (struct loop_ivs): Replace 'reg_iv_type', 'reg_iv_info',
@@ -139,7 +157,7 @@ Mon Jan  1 07:38:33 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
        * loop.h (REG_IV_CLASS): New accessor macro.
        * loop.c (REG_IV_CLASS): Use it instead of reg_iv_class array.
        * unroll.c (REG_IV_CLASS): Likewise.
-       
+
 Sun Dec 31 19:20:51 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * dwarf2out.c (loc_descriptor_from_tree, case WITH_RECORD_EXPR): New.
@@ -152,14 +170,14 @@ Sun Dec 31 19:20:51 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
        (prescan_loop): Set pre_header_has_call in loop_info.
        * loop.h (struct_iv_class): Add `final_value' and `all_reduced'.
        (struct loop_info): Add `pre_header_has_call'.
-       
+
        * loop.c (loop_bivs_find): Break out from strength_reduce.
        (loop_bivs_init_find, loop_bivs_check, loop_givs_find): Likewise.
        (loop_givs_check, loop_biv_eliminable_p): Likewise.
-       
+
        * loop.c (LOOP_REG_LIFETIME, LOOP_REG_GLOBAL_P): Define.
        (scan_loop, record_giv): Use LOOP_REG_LIFETIME and LOOP_REG_GLOBAL_P.
-       
+
        * loop.h (REGNO_FIRST_LUID, REGNO_LAST_LUID): Define.
        * loop.c (REGNO_FIRST_LUID, REGNO_LAST_LUID): Use in place of
        direct access to uid_luid array.
@@ -198,7 +216,7 @@ Sun Dec 31 19:20:51 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
 2000-12-30  Philip Blundell  <philb@gnu.org>
 
-       * config/arm/arm.c (arm_expand_prologue): Fix typos in error 
+       * config/arm/arm.c (arm_expand_prologue): Fix typos in error
        message and comment.  Note location of testcase for an unhandled
        situation.
 
@@ -236,7 +254,7 @@ Sun Dec 31 19:20:51 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * stmt.c (expand_decl): Don't use assign_stack_temp in error case.
        (add_case_node): No need to copy nodes anymore.
-       
+
 2000-12-30  Alexandre Oliva  <aoliva@redhat.com>
 
        * config/sh/sh.c (split_branches): Don't dereference re-computed
@@ -391,7 +409,7 @@ Sun Dec 31 19:20:51 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * calls.c (store_one_arg):  If parm is passed both in stack and in
         register and offset is greater than reg_parm_stack_space, split
-        the offset and call emit_push_insn(). 
+        the offset and call emit_push_insn().
 
 2000-12-27  Nick Clifton  <nickc@redhat.com>
 
@@ -417,7 +435,7 @@ Sun Dec 31 19:20:51 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
        between conditionally executed insns.
        (sched_analyze_1, sched_analyze_2, sched_analyze_insn): Don't free
        dependency lists if current insn is a COND_EXEC.
+
 2000-12-27  Geoffrey Keating  <geoffk@redhat.com>
 
        * config/rs6000/rs6000.md (define_attr "length"): Correct
@@ -478,7 +496,7 @@ Sun Dec 31 19:20:51 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
        (arm_expand_prologue): If the link register has not been saved set
        lr_save_eliminated and emit a USE to prevent later passes from
        scavenging it.
-       
+
        * dwarf2out_frame_debug_expr: Allow the (scratch) frame
        pointer to be initialised from the stack pointer plus a
        constant.
@@ -513,7 +531,7 @@ Sun Dec 31 19:20:51 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * dwarf2out.c (file_info_cmp): Prototype.
        (dwarf2out_line): Hide variable `old_in_use'.
-       
+
        * objc-act.c (objc_fatal): Delete.
 
        * sched-vis.c (visualize_stall_cycles): Remove unused variable.
@@ -615,7 +633,7 @@ Sun Dec 31 19:20:51 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
        (nop_m, nop_i, nop_f, nop_b, nop_x, cycle_display, cycle_display_1,
        bundle_selector): New patterns.
        (insn_group_barrier): Now has an operand.
-       
+
 2000-12-21  DJ Delorie  <dj@redhat.com>
 
        * dwarf2out.c (simple_decl_align_in_bits): new
@@ -958,9 +976,9 @@ Sun Dec 17 12:41:48 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * config/c4x/c4x-protos.h (c4x_init_builtins): Add tree argument.
 
-       * config/c4x/c4x.c (c4x_init_builtins): Add tree argument.      
+       * config/c4x/c4x.c (c4x_init_builtins): Add tree argument.
        (c4x_output_ascii):  Fix.
-       
+
 2000-12-17  Michael Hayes  <m.hayes@elec.canterbury.ac.nz>
             Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
 
@@ -979,7 +997,7 @@ Sun Dec 17 12:41:48 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
        (*toieee_movqf_clobber, *frieee_movqf_clobber): Likewise.
 
 2000-12-17  Michael Hayes  <m.hayes@elec.canterbury.ac.nz>
-       
+
        * libgcc2.h: Use Wtype for SItype and DWtype for DItype in prototypes.
        * libgcc2.c (__absvsi2): Use Wtype and DWtype.
        (__absvdi2, __addvsi3, __addvdi3, __subvsi3): Likewise.
@@ -1021,8 +1039,8 @@ Sat Dec 16 10:41:11 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
         (do_warning): New function.
         (finclude): Skip past the newline and increase the line number
         before calling output_line_command.
-        (do_line): Skip the new line after output_line_command.  Don't  
-        pre-decrement the line number.   
+        (do_line): Skip the new line after output_line_command.  Don't
+        pre-decrement the line number.
 
 2000-12-15  Diego Novillo  <dnovillo@redhat.com>
 
@@ -1087,7 +1105,7 @@ Fri Dec 15 03:37:51 2000  J"orn Rennecke <amylaar@redhat.com>
        * alias.c (get_alias_set): Call record_component_aliases for
        COMPLEX_TYPE.
        (record_component_aliases): Handle COMPLEX_TYPE.
-       
+
 2000-12-14  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * fixinc/gnu-regex.c: Disable NLS.
@@ -1109,7 +1127,7 @@ Fri Dec 15 03:37:51 2000  J"orn Rennecke <amylaar@redhat.com>
        * gcc.c (cpp_options): Update to use '&'.
        (struct switchstr): Change type of validated to save space.
        New member 'ordering'.
-       (handle_braces, validate_switches): Update to handle '&'.       
+       (handle_braces, validate_switches): Update to handle '&'.
 
 2000-12-13  Laurynas Biveinis  <lauras@softhome.net>
 
@@ -1153,7 +1171,7 @@ Fri Dec 15 03:37:51 2000  J"orn Rennecke <amylaar@redhat.com>
         * tradcpp.c (special_symbol): Improve test for definedness,
         though it is still not perfect.
         (do_define): Don't define illegal macro names.
-       
+
 2000-12-07  Aldy Hernandez  <aldyh@redhat.com>
 
         * config/mips/elf.h (ASM_OUTPUT_SECTION_NAME): emit @nobits
@@ -1262,7 +1280,7 @@ Mon Dec 11 13:51:09 2000  Jeffrey A Law  (law@cygnus.com)
        * cppfiles.c (stack_include_file): Update.
        (_cpp_pop_file_buffer): Update.
        * cpphash.h (struct cpp_buffer): New members
-       include_stack_listed and type.   
+       include_stack_listed and type.
        * cpplib.c (_cpp_handle_directive): Buffer->inc is not null.
        (run_directive): Take buffer type.  cpp_push_buffer cannot fail.
        (_cpp_do__Pragma, cpp_define, _cpp_define_builtin, cpp_undef,
@@ -1296,7 +1314,7 @@ Mon Dec 11 13:51:09 2000  Jeffrey A Law  (law@cygnus.com)
 
 2000-12-09  Richard Henderson  <rth@redhat.com>
 
-       * genrecog.c (validate_pattern): Verify that ZERO_EXTRACT and 
+       * genrecog.c (validate_pattern): Verify that ZERO_EXTRACT and
        STRICT_LOW_PART as SET_DEST have in-out constraints.
 
 2000-12-09  Joseph S. Myers  <jsm28@cam.ac.uk>
@@ -2065,8 +2083,8 @@ Tue Dec  5 20:09:14 2000  Jeffrey A Law  (law@cygnus.com)
 2000-12-02  Geoffrey Keating  <geoffk@redhat.com>
 
        * c-common.c (combine_strings): When the ISO C standard specifies
-       the maximum length of a string, it doesn't include the trailing
-       zero byte.
+       the maximum length of a string, it doesn't include the trailing
+       zero byte.
 
        * cpplib.c (do_ifdef): Add check_eol() call.
        (do_ifndef): Likewise.
@@ -2188,13 +2206,13 @@ Tue Dec  5 20:09:14 2000  Jeffrey A Law  (law@cygnus.com)
 2000-12-01  Jim Blandy  <jimb@redhat.com>
 
        * dbxout.c (dbxout_parms): Correctly describe parameters passed by
-       invisible reference in registers, but then spilled to the stack.
-       Remove code to emit a second stab for such parameters; it attempts
-       to describe the value's location by introducing a synthetic C++
-       `reference' type, and then saying the stack slot has that
-       reference type.  This loses type information (breaking GDB's
-       `ptype' command, among other things) just to describe a location
-       which stabs can represent correctly in other ways.
+       invisible reference in registers, but then spilled to the stack.
+       Remove code to emit a second stab for such parameters; it attempts
+       to describe the value's location by introducing a synthetic C++
+       `reference' type, and then saying the stack slot has that
+       reference type.  This loses type information (breaking GDB's
+       `ptype' command, among other things) just to describe a location
+       which stabs can represent correctly in other ways.
 
 2000-12-01  Alexandre Oliva  <aoliva@redhat.com>
 
@@ -2749,7 +2767,7 @@ Mon Nov 27 17:29:44 2000  kaz Kojima <kkojima@rr.iij4u.or.jp>
        canonicalizes conditional compares.
        (arm_select_cc_mode): Likewise.
        * arm.md: Garbage collect some dead code.
-       (cmp_and, cmp_ior): New patterns.
+       (cmp_and, cmp_ior): New patterns.
        (splitter for conditional move with inverted false): Use cond_exec
        and handle unordered comparisons.
 
@@ -2766,7 +2784,7 @@ Mon Nov 27 17:22:56 MET 2000  Jan Hubicka  <jh@suse.cz>
        arm_subsi3_insn, anddi_zesidi_di, arm_andsi3_insn, anddi_notdi_di,
        anddi_notzesidi_di, anddi_notsesidi_di, arm_iorsi3,
        one_cmpldi2): Merge with splitters to create define_insn_and_split
-       patterns.  Remove redundant splits.
+       patterns.  Remove redundant splits.
        (peephole2 for add:SI of invalid immediate): New.
        (peephole2 for minus:SI of invalid immediate): New.
        (peephole2 for ior:SI of invalid immediate): New.
@@ -7486,7 +7504,7 @@ Mon 25-Sep-2000 23:31:45 BST  Neil Booth  <neilb@earthling.net>
        * dwarf2out.c (UNALIGNED_SHORT_ASM_OP, UNALIGNED_INT_ASM_OP,
        UNALIGNED_DOUBLE_INT_ASM_OP, SECTION_ASM_OP, ASM_BYTE_OP): Here.
        * dwarfout.c (FILE_ASM_OP, VERSION_ASM_OP,
-       UNALIGNED_SHORT_ASM_OP, UNALIGNED_INT_ASM_OP, ASM_BYTE_OP,
+       UNALIGNED_SHORT_ASM_OP, UNALIGNED_INT_ASM_OP, ASM_BYTE_OP,
        PUSHSECTION_ASM_OP, POPSECTION_ASM_OP): Here.
        * defaults.h (ASM_STABD_OP, EH_FRAME_SECTION_ASM_OP): Here.
        * varasm.c (ASM_STABS_OP): Here.
index a23b8715b35171c6e8a73df414d13971f843572a..77c54f37fbe15b09d5238b47f8bf167947d3eb0b 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions for c-common.c.
    Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998,
-   1999, 2000 Free Software Foundation, Inc.
+   1999, 2000, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -222,7 +222,7 @@ typedef enum c_language_kind
                       etc. */
   clk_cplusplus,   /* ANSI/ISO C++ */
   clk_objective_c  /* Objective C */
-} 
+}
 c_language_kind;
 
 /* Information about a statement tree.  */
@@ -244,10 +244,10 @@ struct stmt_tree_s {
      However, in order to represent aggregate initialization code as
      tree structure, we use statement-expressions.  The statements
      within the statement expression should not result in cleanups
-     being run until the entire enclosing statement is complete.  
+     being run until the entire enclosing statement is complete.
 
      This flag has no effect in C.  */
-  int stmts_are_full_exprs_p; 
+  int stmts_are_full_exprs_p;
 };
 
 typedef struct stmt_tree_s *stmt_tree;
@@ -294,10 +294,15 @@ extern void (*lang_expand_stmt)                 PARAMS ((tree));
 extern void (*lang_expand_decl_stmt)            PARAMS ((tree));
 extern void (*lang_expand_function_end)         PARAMS ((void));
 
+/* Callback that determines if it's ok for a function to have no
+   noreturn attribute.  */
+extern int (*lang_missing_noreturn_ok_p)       PARAMS ((tree));
+
+
 /* The type of a function that walks over tree structure.  */
 
-typedef tree (*walk_tree_fn)                    PARAMS ((tree *, 
-                                                        int *, 
+typedef tree (*walk_tree_fn)                    PARAMS ((tree *,
+                                                        int *,
                                                         void *));
 
 extern stmt_tree current_stmt_tree              PARAMS ((void));
@@ -436,7 +441,7 @@ extern int warn_long_long;
    descending through array types.  Note that this macro evaluates its
    arguments mor than once.  */
 #define C_TYPE_QUALS(TYPE)                             \
-  (TYPE_QUALS ((TREE_CODE (TYPE) == ARRAY_TYPE                 \
+  (TYPE_QUALS ((TREE_CODE (TYPE) == ARRAY_TYPE         \
                && c_language == clk_cplusplus)         \
               ? strip_array_types (TYPE) : TYPE))
 
@@ -595,7 +600,7 @@ extern tree strip_array_types                   PARAMS ((tree));
 #define ASM_CLOBBERS(NODE)      TREE_OPERAND (ASM_STMT_CHECK (NODE), 4)
 
 /* DECL_STMT accessor. This gives access to the DECL associated with
-   the given declaration statement. */ 
+   the given declaration statement. */
 #define DECL_STMT_DECL(NODE)    TREE_OPERAND (DECL_STMT_CHECK (NODE), 0)
 
 /* STMT_EXPR accessor. */
@@ -607,7 +612,7 @@ extern tree strip_array_types                   PARAMS ((tree));
 
 /* Nonzero if this SCOPE_STMT is for the beginning of a scope.  */
 #define SCOPE_BEGIN_P(NODE) \
-  (TREE_LANG_FLAG_0 (SCOPE_STMT_CHECK (NODE))) 
+  (TREE_LANG_FLAG_0 (SCOPE_STMT_CHECK (NODE)))
 
 /* Nonzero if this SCOPE_STMT is for the end of a scope.  */
 #define SCOPE_END_P(NODE) \
@@ -629,7 +634,7 @@ extern tree strip_array_types                   PARAMS ((tree));
 
 /* Nonzero for a SCOPE_STMT if this statement is for a partial scope.
    For example, in:
-  
+
      S s;
      l:
      S s2;
@@ -654,12 +659,12 @@ extern tree strip_array_types                   PARAMS ((tree));
 
 /* If non-zero, the STMT_LINENO for NODE is the line at which the
    function ended.  */
-#define STMT_LINENO_FOR_FN_P(NODE)             \
+#define STMT_LINENO_FOR_FN_P(NODE)             \
   (TREE_LANG_FLAG_2 ((NODE)))
 
 /* Nonzero if we want the new ISO rules for pushing a new scope for `for'
    initialization variables. */
-#define NEW_FOR_SCOPE_P(NODE) (TREE_LANG_FLAG_0 (NODE)) 
+#define NEW_FOR_SCOPE_P(NODE) (TREE_LANG_FLAG_0 (NODE))
 
 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
 
@@ -754,7 +759,7 @@ extern void extract_interface_info          PARAMS ((void));
 
 extern void mark_c_language_function            PARAMS ((struct language_function *));
 
-extern int case_compare                         PARAMS ((splay_tree_key, 
+extern int case_compare                         PARAMS ((splay_tree_key,
                                                         splay_tree_key));
 
 extern tree c_add_case_label                    PARAMS ((splay_tree,
@@ -807,5 +812,3 @@ struct c_fileinfo *get_fileinfo                     PARAMS ((const char *));
 extern void dump_time_statistics               PARAMS ((void));
 
 #endif
-
-
index 92d84038ffdcb2ba130804a7afa4bcd9e49fdb21..d4b3a2a62a97103b4321ea3b5fa1655b4ea22ef7 100644 (file)
@@ -1,6 +1,6 @@
 /* Process declarations and variables for C compiler.
-   Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
-   Free Software Foundation, Inc.
+   Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+   2001 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -665,8 +665,6 @@ c_decode_option (argc, argv)
     warn_bad_function_cast = 1;
   else if (!strcmp (p, "-Wno-bad-function-cast"))
     warn_bad_function_cast = 0;
-  else if (!strcmp (p, "-Wmissing-noreturn"))
-    warn_missing_noreturn = 1;
   else if (!strcmp (p, "-Wno-missing-noreturn"))
     warn_missing_noreturn = 0;
   else if (!strcmp (p, "-Wmissing-format-attribute"))
@@ -4487,7 +4485,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
          else if (decl_context == FIELD)
            {
              /* ??? Need to check somewhere that this is a structure
-                and not a union, that this field is last, and that 
+                and not a union, that this field is last, and that
                 this structure has at least one other named member.  */
 
              if (pedantic && !flag_isoc99 && !in_system_header)
@@ -6515,7 +6513,7 @@ store_parm_decls ()
   init_function_start (fndecl, input_filename, lineno);
 
   /* Begin the statement tree for this function.  */
-  DECL_LANG_SPECIFIC (current_function_decl) 
+  DECL_LANG_SPECIFIC (current_function_decl)
     =((struct lang_decl *) ggc_alloc (sizeof (struct lang_decl)));
   begin_stmt_tree (&DECL_SAVED_TREE (current_function_decl));
 
@@ -6903,7 +6901,7 @@ c_expand_body (fndecl, nested_p)
          pop_function_context ();
        }
     }
-      
+
 }
 \f
 /* Check the declarations given in a for-loop for satisfying the C99
@@ -6979,7 +6977,7 @@ push_c_function_context (f)
      struct function *f;
 {
   struct c_language_function *p;
-  p = ((struct c_language_function *) 
+  p = ((struct c_language_function *)
        xmalloc (sizeof (struct c_language_function)));
   f->language = (struct language_function *) p;
 
@@ -7001,7 +6999,7 @@ void
 pop_c_function_context (f)
      struct function *f;
 {
-  struct c_language_function *p 
+  struct c_language_function *p
     = (struct c_language_function *) f->language;
   tree link;
 
@@ -7042,7 +7040,7 @@ void
 mark_c_function_context (f)
      struct function *f;
 {
-  struct c_language_function *p 
+  struct c_language_function *p
     = (struct c_language_function *) f->language;
 
   if (p == 0)
@@ -7158,12 +7156,12 @@ c_begin_compound_stmt ()
   stmt = add_stmt (build_stmt (COMPOUND_STMT, NULL_TREE));
   /* If we haven't already declared __FUNCTION__ and its ilk then this
      is the opening curly brace of the function.  Declare them now.  */
-  if (!c_function_name_declared_p) 
+  if (!c_function_name_declared_p)
     {
       c_function_name_declared_p = 1;
       declare_function_name ();
     }
-  
+
   return stmt;
 }
 
@@ -7175,7 +7173,7 @@ c_expand_decl_stmt (t)
      tree t;
 {
   tree decl = DECL_STMT_DECL (t);
-  
+
   /* Expand nested functions.  */
   if (TREE_CODE (decl) == FUNCTION_DECL
       && DECL_CONTEXT (decl) == current_function_decl
index fb4dbee611639f6b0e0eeb949fc3a0070788d17a..52173917448b2321b6aed0c4f0d2afb4d0db2932 100644 (file)
@@ -1,6 +1,6 @@
 /* Language-specific hook definitions for C front end.
    Copyright (C) 1991, 1995, 1997, 1998,
-   1999, 2000 Free Software Foundation, Inc.
+   1999, 2000, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -37,10 +37,11 @@ Boston, MA 02111-1307, USA.  */
 #include "cpplib.h"
 
 static int c_tree_printer PARAMS ((output_buffer *));
+static int c_missing_noreturn_ok_p PARAMS ((tree));
 
 /* Each of the functions defined here
    is an alternative to a function in objc-actions.c.  */
-   
+
 int
 lang_decode_option (argc, argv)
      int argc;
@@ -81,6 +82,7 @@ lang_init ()
   lang_safe_from_p = &c_safe_from_p;
   lang_printer = &c_tree_printer;
   lang_expand_decl_stmt = &c_expand_decl_stmt;
+  lang_missing_noreturn_ok_p = &c_missing_noreturn_ok_p;
 
   c_parse_init ();
 }
@@ -186,8 +188,8 @@ start_cdtor (method_type)
   tree body;
 
   start_function (void_list_node_1,
-                 build_parse_node (CALL_EXPR, fnname, 
-                                   tree_cons (NULL_TREE, NULL_TREE, 
+                 build_parse_node (CALL_EXPR, fnname,
+                                   tree_cons (NULL_TREE, NULL_TREE,
                                               void_list_node_1),
                                    NULL_TREE),
                  NULL_TREE, NULL_TREE);
@@ -213,11 +215,11 @@ finish_cdtor (body)
   tree block;
 
   scope = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
-  block = poplevel (0, 0, 0); 
+  block = poplevel (0, 0, 0);
   SCOPE_STMT_BLOCK (TREE_PURPOSE (scope)) = block;
   SCOPE_STMT_BLOCK (TREE_VALUE (scope)) = block;
 
-  RECHAIN_STMTS (body, COMPOUND_BODY (body)); 
+  RECHAIN_STMTS (body, COMPOUND_BODY (body));
 
   finish_function (0);
 }
@@ -252,7 +254,7 @@ finish_file ()
       finish_cdtor (body);
     }
 #endif
-  
+
   if (back_end_hook)
     (*back_end_hook) (getdecls ());
 
@@ -294,3 +296,12 @@ c_tree_printer (buffer)
       return 0;
     }
 }
+
+static int
+c_missing_noreturn_ok_p (decl)
+     tree decl;
+{
+  /* A missing noreturn is not ok for freestanding implementations and
+     ok for the `main' function in hosted implementations.  */
+  return flag_hosted && MAIN_NAME_P (DECL_ASSEMBLER_NAME (decl));
+}
index 26b985d9c82f832a7bb3586c2ec8130d36cb00fa..5eaf116238fdfd06b549286f4b9c523ebeaa9434 100644 (file)
@@ -1,6 +1,6 @@
 /* Data flow analysis for GNU compiler.
    Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000 Free Software Foundation, Inc.
+   1999, 2000, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -251,6 +251,10 @@ regset regs_live_at_setjmp;
    are another pair, etc.  */
 rtx regs_may_share;
 
+/* Callback that determines if it's ok for a function to have no
+   noreturn attribute.  */
+int (*lang_missing_noreturn_ok_p) PARAMS ((tree));
+
 /* Set of registers that may be eliminable.  These are handled specially
    in updating regs_ever_live.  */
 
@@ -424,15 +428,15 @@ static void invalidate_mems_from_autoinc PARAMS ((struct propagate_block_info *,
 static void invalidate_mems_from_set   PARAMS ((struct propagate_block_info *,
                                                 rtx));
 static void remove_fake_successors     PARAMS ((basic_block));
-static void flow_nodes_print           PARAMS ((const char *, const sbitmap, 
+static void flow_nodes_print           PARAMS ((const char *, const sbitmap,
                                                 FILE *));
 static void flow_edge_list_print       PARAMS ((const char *, const edge *,
                                                 int, FILE *));
 static void flow_loops_cfg_dump                PARAMS ((const struct loops *,
                                                 FILE *));
-static int flow_loop_nested_p          PARAMS ((struct loop *, 
+static int flow_loop_nested_p          PARAMS ((struct loop *,
                                                 struct loop *));
-static int flow_loop_entry_edges_find  PARAMS ((basic_block, const sbitmap, 
+static int flow_loop_entry_edges_find  PARAMS ((basic_block, const sbitmap,
                                                 edge **));
 static int flow_loop_exit_edges_find   PARAMS ((const sbitmap, edge **));
 static int flow_loop_nodes_find        PARAMS ((basic_block, basic_block, sbitmap));
@@ -530,7 +534,9 @@ check_function_return_warnings ()
 {
   if (warn_missing_noreturn
       && !TREE_THIS_VOLATILE (cfun->decl)
-      && EXIT_BLOCK_PTR->pred == NULL)
+      && EXIT_BLOCK_PTR->pred == NULL
+      && (lang_missing_noreturn_ok_p
+         && !lang_missing_noreturn_ok_p (cfun->decl)))
     warning ("function might be possible candidate for attribute `noreturn'");
 
   /* If we have a path to EXIT, then we do return.  */
@@ -1537,7 +1543,7 @@ split_block (bb, insn)
   /* Redirect the src of the successor edges of bb to point to new_bb.  */
   for (e = new_bb->succ; e; e = e->succ_next)
     e->src = new_bb;
-  
+
   /* Place the new block just after the block being split.  */
   VARRAY_GROW (basic_block_info, ++n_basic_blocks);
 
@@ -1576,7 +1582,7 @@ split_block (bb, insn)
         propagate_block to determine which registers are live.  */
       COPY_REG_SET (new_bb->global_live_at_start, bb->global_live_at_end);
       propagate_block (new_bb, new_bb->global_live_at_start, NULL, NULL, 0);
-      COPY_REG_SET (bb->global_live_at_end, 
+      COPY_REG_SET (bb->global_live_at_end,
                    new_bb->global_live_at_start);
     }
 
@@ -3382,7 +3388,7 @@ calculate_global_regs_live (blocks_in, blocks_out, flags)
       SET_REGNO_REG_SET (new_live_at_end, STACK_POINTER_REGNUM);
 
       /* Before reload, there are a few registers that must be forced
-        live everywhere -- which might not already be the case for 
+        live everywhere -- which might not already be the case for
         blocks within infinite loops.  */
       if (! reload_completed)
        {
@@ -4200,7 +4206,7 @@ insn_dead_p (pbi, x, call_ok, notes)
 #ifdef AUTO_INC_DEC
              /* Check if memory reference matches an auto increment. Only
                 post increment/decrement or modify are valid.  */
-             if (GET_MODE (mem) == GET_MODE (r)
+             if (GET_MODE (mem) == GET_MODE (r)
                  && (GET_CODE (XEXP (mem, 0)) == POST_DEC
                      || GET_CODE (XEXP (mem, 0)) == POST_INC
                      || GET_CODE (XEXP (mem, 0)) == POST_MODIFY)
@@ -4978,7 +4984,7 @@ flush_reg_cond_reg_1 (node, data)
      the in-order traversal.  */
   if (xdata[1] >= (int) node->key)
     return 0;
-  
+
   /* Splice out portions of the expression that refer to regno.  */
   rcli = (struct reg_cond_life_info *) node->value;
   rcli->condition = elim_reg_cond (rcli->condition, regno);
@@ -6599,7 +6605,7 @@ count_or_remove_death_notes (blocks, kill)
 
 /* Update insns block within BB.  */
 
-void 
+void
 update_bb_for_insn (bb)
      basic_block bb;
 {
@@ -7089,7 +7095,7 @@ verify_edge_list (f, elist)
        if (EDGE_INDEX (elist, BASIC_BLOCK (pred), BASIC_BLOCK (succ))
            != EDGE_INDEX_NO_EDGE && found_edge == 0)
          fprintf (f, "*** Edge (%d, %d) has index %d, but there is no edge\n",
-                  pred, succ, EDGE_INDEX (elist, BASIC_BLOCK (pred),
+                  pred, succ, EDGE_INDEX (elist, BASIC_BLOCK (pred),
                                           BASIC_BLOCK (succ)));
       }
   for (succ = 0; succ < n_basic_blocks; succ++)
@@ -7334,7 +7340,7 @@ redirect_edge_pred (e, new_pred)
 \f
 /* Dump the list of basic blocks in the bitmap NODES.  */
 
-static void 
+static void
 flow_nodes_print (str, nodes, file)
      const char *str;
      const sbitmap nodes;
@@ -7353,7 +7359,7 @@ flow_nodes_print (str, nodes, file)
 
 /* Dump the list of edges in the array EDGE_LIST.  */
 
-static void 
+static void
 flow_edge_list_print (str, edge_list, num_edges, file)
      const char *str;
      const edge *edge_list;
@@ -7467,7 +7473,7 @@ flow_loop_dump (loop, file, loop_dump_aux, verbose)
 
 /* Dump the loop information specified by LOOPS to the stream FILE,
    using auxiliary dump callback function LOOP_DUMP_AUX if non null.  */
-void 
+void
 flow_loops_dump (loops, file, loop_dump_aux, verbose)
      const struct loops *loops;
      FILE *file;
@@ -7481,7 +7487,7 @@ flow_loops_dump (loops, file, loop_dump_aux, verbose)
   if (! num_loops || ! file)
     return;
 
-  fprintf (file, ";; %d loops found, %d levels\n", 
+  fprintf (file, ";; %d loops found, %d levels\n",
           num_loops, loops->levels);
 
   for (i = 0; i < num_loops; i++)
@@ -7510,7 +7516,7 @@ flow_loops_dump (loops, file, loop_dump_aux, verbose)
                     must be disjoint.  */
                  disjoint = ! flow_loop_nested_p (smaller ? loop : oloop,
                                                   smaller ? oloop : loop);
-                 fprintf (file, 
+                 fprintf (file,
                           ";; loop header %d shared by loops %d, %d %s\n",
                           loop->header->index, i, j,
                           disjoint ? "disjoint" : "nested");
@@ -7586,7 +7592,7 @@ flow_loop_entry_edges_find (header, nodes, entry_edges)
   for (e = header->pred; e; e = e->pred_next)
     {
       basic_block src = e->src;
-      
+
       if (src == ENTRY_BLOCK_PTR || ! TEST_BIT (nodes, src->index))
        num_entries++;
     }
@@ -7600,7 +7606,7 @@ flow_loop_entry_edges_find (header, nodes, entry_edges)
   for (e = header->pred; e; e = e->pred_next)
     {
       basic_block src = e->src;
-      
+
       if (src == ENTRY_BLOCK_PTR || ! TEST_BIT (nodes, src->index))
        (*entry_edges)[num_entries++] = e;
     }
@@ -7632,7 +7638,7 @@ flow_loop_exit_edges_find (nodes, exit_edges)
   EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, node, {
     for (e = BASIC_BLOCK (node)->succ; e; e = e->succ_next)
       {
-       basic_block dest = e->dest;       
+       basic_block dest = e->dest;
 
        if (dest == EXIT_BLOCK_PTR || ! TEST_BIT (nodes, dest->index))
            num_exits++;
@@ -7649,7 +7655,7 @@ flow_loop_exit_edges_find (nodes, exit_edges)
   EXECUTE_IF_SET_IN_SBITMAP (nodes, 0, node, {
     for (e = BASIC_BLOCK (node)->succ; e; e = e->succ_next)
       {
-       basic_block dest = e->dest;       
+       basic_block dest = e->dest;
 
        if (dest == EXIT_BLOCK_PTR || ! TEST_BIT (nodes, dest->index))
          (*exit_edges)[num_exits++] = e;
@@ -8143,7 +8149,7 @@ flow_loops_find (loops, flags)
      must always be built if this function is called.  */
   if (! (flags & LOOP_TREE))
     abort ();
-    
+
   memset (loops, 0, sizeof (*loops));
 
   /* Taking care of this degenerate case makes the rest of
@@ -8258,7 +8264,7 @@ flow_loops_find (loops, flags)
          loop->nodes = sbitmap_alloc (n_basic_blocks);
          loop->num_nodes
            = flow_loop_nodes_find (loop->header, loop->latch, loop->nodes);
-         
+
          /* Compute first and last blocks within the loop.
             These are often the same as the loop header and
             loop latch respectively, but this is not always
@@ -8267,7 +8273,7 @@ flow_loops_find (loops, flags)
            = BASIC_BLOCK (sbitmap_first_set_bit (loop->nodes));
          loop->last
            = BASIC_BLOCK (sbitmap_last_set_bit (loop->nodes));
-         
+
          if (flags & LOOP_EDGES)
            {
              /* Find edges which enter the loop header.
@@ -8277,12 +8283,12 @@ flow_loops_find (loops, flags)
                = flow_loop_entry_edges_find (loop->header,
                                              loop->nodes,
                                              &loop->entry_edges);
-             
+
              /* Find edges which exit the loop.  */
              loop->num_exits
                = flow_loop_exit_edges_find (loop->nodes,
                                             &loop->exit_edges);
-             
+
              /* Determine which loop nodes dominate all the exits
                 of the loop.  */
              loop->exits_doms = sbitmap_alloc (n_basic_blocks);
@@ -8290,17 +8296,17 @@ flow_loops_find (loops, flags)
              for (j = 0; j < loop->num_exits; j++)
                sbitmap_a_and_b (loop->exits_doms, loop->exits_doms,
                                 dom[loop->exit_edges[j]->src->index]);
-             
+
              /* The header of a natural loop must dominate
                 all exits.  */
              if (! TEST_BIT (loop->exits_doms, loop->header->index))
                abort ();
            }
-         
+
          if (flags & LOOP_PRE_HEADER)
            {
              /* Look to see if the loop has a pre-header node.  */
-             loop->pre_header 
+             loop->pre_header
                = flow_loop_pre_header_find (loop->header, dom);
 
              flow_loop_pre_header_scan (loop);
@@ -8347,7 +8353,7 @@ flow_loops_update (loops, flags)
      throw away the old stuff and rebuild what we need.  */
   if (loops->array)
     flow_loops_free (loops);
-  
+
   return flow_loops_find (loops, flags);
 }
 
index d4e79d21fe441c01cda2b700ac5454bc543c3643..4d379928c91968f62f7b73cb034c7632ed721c2b 100644 (file)
@@ -5,7 +5,7 @@
 @ignore
 @c man begin COPYRIGHT
 Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
-1998, 1999, 2000 Free Software Foundation, Inc.
+1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 
 Permission is granted to make and distribute verbatim copies of this
 manual provided the copyright notice and this permission notice are
@@ -2170,7 +2170,8 @@ Warn about functions which might be candidates for attribute @code{noreturn}.
 Note these are only possible candidates, not absolute ones.  Care should
 be taken to manually verify functions actually do not ever return before
 adding the @code{noreturn} attribute, otherwise subtle code generation
-bugs could be introduced.
+bugs could be introduced.  You will not get a warning for @code{main} in
+hosted C environments.
 
 @item -Wmissing-format-attribute
 If @samp{-Wformat} is enabled, also warn about functions which might be
index 7d4a347a1dbaa78c7509fbb8b4d478025741fb60..4f38dc1f432e93f3d8e7be1b048cc63b4c5bdacb 100644 (file)
@@ -1,6 +1,6 @@
 /* Top level of GNU C compiler
    Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000 Free Software Foundation, Inc.
+   1999, 2000, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -969,7 +969,7 @@ const char *user_label_prefix;
 
 lang_independent_options f_options[] =
 {
-  {"eliminate-dwarf2-dups", &flag_eliminate_dwarf2_dups, 1, 
+  {"eliminate-dwarf2-dups", &flag_eliminate_dwarf2_dups, 1,
    "Perform DWARF2 duplicate elimination"},
   {"float-store", &flag_float_store, 1,
    "Do not store floats in registers" },
@@ -1210,8 +1210,6 @@ documented_lang_options[] =
   { "-Wbad-function-cast",
     "Warn about casting functions to incompatible types" },
   { "-Wno-bad-function-cast", "" },
-  { "-Wmissing-noreturn",
-    "Warn about functions which might be candidates for attribute noreturn" },
   { "-Wno-missing-noreturn", "" },
   { "-Wmissing-format-attribute",
     "Warn about functions which might be candidates for format attributes" },
@@ -1461,7 +1459,9 @@ lang_independent_options W_options[] =
   {"padded", &warn_padded, 1,
    "Warn when padding is required to align struct members"},
   {"disabled-optimization", &warn_disabled_optimization, 1,
-   "Warn when an optimization pass is disabled"}
+   "Warn when an optimization pass is disabled"},
+  {"missing-noreturn", &warn_missing_noreturn, 1,
+   "Warn about functions which might be candidates for attribute noreturn"}
 };
 \f
 /* Output files for assembler code (real compiler output)
@@ -1576,7 +1576,7 @@ approx_sqrt (x)
   double s, d;
 
   if (x < 0)
-    abort ();   
+    abort ();
   if (x == 0)
     return 0;
 
@@ -1584,8 +1584,8 @@ approx_sqrt (x)
   do
     {
       d = (s * s - x) / (2 * s);
-      s -= d;                   
-    }        
+      s -= d;
+    }
   while (d > .0001);
   return s;
 }
@@ -1962,7 +1962,7 @@ wrapup_global_declarations (vec, len)
          if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
              && (! TREE_READONLY (decl)
                  || TREE_PUBLIC (decl)
-                 || (!optimize 
+                 || (!optimize
                      && flag_keep_static_consts
                      && !DECL_ARTIFICIAL (decl))
                  || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
@@ -2878,7 +2878,7 @@ rest_of_compilation (decl)
      integrate.*/
   rtx_equal_function_value_matters = 0;
   purge_hard_subreg_sets (get_insns ());
-  
+
   /* Don't return yet if -Wreturn-type; we need to do jump_optimize.  */
   if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
     goto exit_rest_of_compilation;
@@ -3075,7 +3075,7 @@ rest_of_compilation (decl)
 
          insns = get_insns ();
          eliminate_dead_code();
-  
+
          close_dump_file (DFI_dce, print_rtl_with_bb, insns);
          timevar_pop (TV_DEAD_CODE_ELIM);
        }