This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] move function returnings to tree level
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 9 Feb 2004 16:57:28 -0800
- Subject: [tree-ssa] move function returnings to tree level
In the process, moves lang_missing_noreturn_ok_p to be a proper
lang-hook. I suppose this bit could have been done on mainline...
Anyway, the benefit from doing the return warning in trees is that
we can still look at a RETURN_EXPR, rather than groveling through
rtl for cfun->x_clobber_return_insn.
I also think we give better line number information, rather than
pegging everything at the closing brace of the function.
Finally, two uninit-N.c updates that I somehow failed to commit
with the previous suite of warning moves.
r~
* langhooks.h (lang_hooks_for_functions): Add missing_noreturn_ok_p.
* langhooks-def.h, c-lang.c, objc/objc-lang.c
(LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P): New.
* c-objc-common.c (c_missing_noreturn_ok_p): Return bool.
(c_objc_common_init): Don't set lang_missing_noreturn_ok_p.
* c-tree.h (c_missing_noreturn_ok_p): Update decl.
* flow.c (lang_missing_noreturn_ok_p): Remove.
cp/
* cp-lang.c (LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P): New.
* cp-tree.h (cp_missing_noreturn_ok_p): Declare.
* decl.c (cp_missing_noreturn_ok_p): Export.
(cxx_init_decl_processing): Don't set lang_missing_noreturn_ok_p.
* flow.c (check_function_return_warnings): Move to tree-cfg.c.
* toplev.c (rest_of_compilation): Don't call it.
* tree-cfg.c (execute_warn_function_return): Move from flow.c,
rename, update for tree vs rtl.
(pass_warn_function_return): New.
* tree-pass.h (pass_warn_function_return): Declare it.
* tree-optimize.c (init_tree_optimization_passes): Run it.
* function.h (struct function): Remove x_clobber_return_insn.
* function.c (free_after_compilation): Don't set it.
(expand_function_end): Likewise.
testsuite/
* gcc.dg/noreturn-1.c: Adjust line numbers on warnings.
* gcc.dg/noreturn-4.c: Likewise.
* gcc.dg/noreturn-7.c: Likewise. Adjust warnings for
changes to tail-call optimizations.
* gcc.dg/return-type-3.c: Turn on optimization.
* gcc.dg/uninit-6.c: Adjust line numbers on warnings.
* gcc.dg/uninit-8.c: XFAIL.
Index: c-lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-lang.c,v
retrieving revision 1.94.2.18
diff -c -p -d -r1.94.2.18 c-lang.c
*** c-lang.c 6 Feb 2004 15:20:29 -0000 1.94.2.18
--- c-lang.c 10 Feb 2004 00:37:47 -0000
*************** enum c_language_kind c_language = clk_c;
*** 88,93 ****
--- 88,95 ----
#define LANG_HOOKS_FUNCTION_ENTER_NESTED c_push_function_context
#undef LANG_HOOKS_FUNCTION_LEAVE_NESTED
#define LANG_HOOKS_FUNCTION_LEAVE_NESTED c_pop_function_context
+ #undef LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P
+ #define LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P c_missing_noreturn_ok_p
#undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
#define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL c_dup_lang_specific_decl
Index: c-objc-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-objc-common.c,v
retrieving revision 1.14.2.23
diff -c -p -d -r1.14.2.23 c-objc-common.c
*** c-objc-common.c 3 Jan 2004 23:01:36 -0000 1.14.2.23
--- c-objc-common.c 10 Feb 2004 00:37:47 -0000
*************** static bool c_tree_printer (pretty_print
*** 44,50 ****
static tree start_cdtor (int);
static void finish_cdtor (tree);
! int
c_missing_noreturn_ok_p (tree decl)
{
/* A missing noreturn is not ok for freestanding implementations and
--- 44,50 ----
static tree start_cdtor (int);
static void finish_cdtor (tree);
! bool
c_missing_noreturn_ok_p (tree decl)
{
/* A missing noreturn is not ok for freestanding implementations and
*************** c_objc_common_init (void)
*** 171,177 ****
putting them here anyway. The diagnostic format decoder might
want an enhanced ObjC implementation. */
diagnostic_format_decoder (global_dc) = &c_tree_printer;
- lang_missing_noreturn_ok_p = &c_missing_noreturn_ok_p;
/* If still unspecified, make it match -std=c99
(allowing for -pedantic-errors). */
--- 171,176 ----
Index: c-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-tree.h,v
retrieving revision 1.99.2.28
diff -c -p -d -r1.99.2.28 c-tree.h
*** c-tree.h 5 Jan 2004 22:33:06 -0000 1.99.2.28
--- c-tree.h 10 Feb 2004 00:37:47 -0000
*************** extern void merge_translation_unit_decls
*** 247,253 ****
extern int c_disregard_inline_limits (tree);
extern int c_cannot_inline_tree_fn (tree *);
extern bool c_objc_common_init (void);
! extern int c_missing_noreturn_ok_p (tree);
extern void c_objc_common_finish_file (void);
extern int defer_fn (tree);
extern bool c_warn_unused_global_decl (tree);
--- 247,253 ----
extern int c_disregard_inline_limits (tree);
extern int c_cannot_inline_tree_fn (tree *);
extern bool c_objc_common_init (void);
! extern bool c_missing_noreturn_ok_p (tree);
extern void c_objc_common_finish_file (void);
extern int defer_fn (tree);
extern bool c_warn_unused_global_decl (tree);
Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.534.2.24
diff -c -p -d -r1.534.2.24 flow.c
*** flow.c 9 Feb 2004 02:03:44 -0000 1.534.2.24
--- flow.c 10 Feb 2004 00:37:47 -0000
*************** regset regs_live_at_setjmp;
*** 192,201 ****
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) (tree);
-
/* Set of registers that may be eliminable. These are handled specially
in updating regs_ever_live. */
--- 192,197 ----
*************** static int invalidate_mems_from_autoinc
*** 316,363 ****
static void invalidate_mems_from_set (struct propagate_block_info *, rtx);
static void clear_log_links (sbitmap);
static int count_or_remove_death_notes_bb (basic_block, int);
-
-
- void
- check_function_return_warnings (void)
- {
- if (warn_missing_noreturn
- && !TREE_THIS_VOLATILE (cfun->decl)
- && 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. */
- if (TREE_THIS_VOLATILE (cfun->decl)
- && EXIT_BLOCK_PTR->pred != NULL)
- warning ("`noreturn' function does return");
-
- /* If the clobber_return_insn appears in some basic block, then we
- do reach the end without returning a value. */
- else if (warn_return_type
- && cfun->x_clobber_return_insn != NULL
- && EXIT_BLOCK_PTR->pred != NULL)
- {
- int max_uid = get_max_uid ();
-
- /* If clobber_return_insn was excised by jump1, then renumber_insns
- can make max_uid smaller than the number still recorded in our rtx.
- That's fine, since this is a quick way of verifying that the insn
- is no longer in the chain. */
- if (INSN_UID (cfun->x_clobber_return_insn) < max_uid)
- {
- rtx insn;
-
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- if (insn == cfun->x_clobber_return_insn)
- {
- warning ("control reaches end of non-void function");
- break;
- }
- }
- }
- }
/* Return the INSN immediately following the NOTE_INSN_BASIC_BLOCK
note associated with the BLOCK. */
--- 312,317 ----
Index: function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.374.2.40
diff -c -p -d -r1.374.2.40 function.c
*** function.c 9 Feb 2004 02:03:44 -0000 1.374.2.40
--- function.c 10 Feb 2004 00:37:47 -0000
*************** free_after_compilation (struct function
*** 459,465 ****
f->x_tail_recursion_label = NULL;
f->x_tail_recursion_reentry = NULL;
f->x_arg_pointer_save_area = NULL;
- f->x_clobber_return_insn = NULL;
f->x_context_display = NULL;
f->x_trampoline_list = NULL;
f->x_parm_birth_insn = NULL;
--- 459,464 ----
*************** expand_function_end (void)
*** 7116,7124 ****
end_sequence ();
after = emit_insn_after (seq, clobber_after);
-
- if (clobber_after != after)
- cfun->x_clobber_return_insn = after;
}
/* Output the label for the naked return from the function, if one is
--- 7115,7120 ----
Index: function.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.h,v
retrieving revision 1.83.2.25
diff -c -p -d -r1.83.2.25 function.h
*** function.h 30 Jan 2004 13:13:56 -0000 1.83.2.25
--- function.h 10 Feb 2004 00:37:47 -0000
*************** struct function GTY(())
*** 307,317 ****
needed by inner routines. */
rtx x_arg_pointer_save_area;
- /* If the function returns non-void, we will emit a clobber of the
- return registers just in case the user fell off the end without
- returning a proper value. This is that insn. */
- rtx x_clobber_return_insn;
-
/* Offset to end of allocated area of stack frame.
If stack grows down, this is the address of the last stack slot allocated.
If stack grows up, this is the address for the next slot. */
--- 307,312 ----
Index: langhooks-def.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks-def.h,v
retrieving revision 1.34.2.28
diff -c -p -d -r1.34.2.28 langhooks-def.h
*** langhooks-def.h 6 Feb 2004 15:20:29 -0000 1.34.2.28
--- langhooks-def.h 10 Feb 2004 00:37:47 -0000
*************** extern int lhd_gimplify_expr (tree *, tr
*** 133,138 ****
--- 133,139 ----
#define LANG_HOOKS_FUNCTION_FINAL lhd_do_nothing_f
#define LANG_HOOKS_FUNCTION_ENTER_NESTED lhd_do_nothing_f
#define LANG_HOOKS_FUNCTION_LEAVE_NESTED lhd_do_nothing_f
+ #define LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P hook_bool_tree_true
#define LANG_HOOKS_RTL_EXPAND_START lhd_do_nothing
#define LANG_HOOKS_RTL_EXPAND_STMT (void (*) (tree)) abort
*************** extern int lhd_gimplify_expr (tree *, tr
*** 198,204 ****
LANG_HOOKS_FUNCTION_INIT, \
LANG_HOOKS_FUNCTION_FINAL, \
LANG_HOOKS_FUNCTION_ENTER_NESTED, \
! LANG_HOOKS_FUNCTION_LEAVE_NESTED \
}
#define LANG_HOOKS_RTL_EXPAND_INITIALIZER { \
--- 199,206 ----
LANG_HOOKS_FUNCTION_INIT, \
LANG_HOOKS_FUNCTION_FINAL, \
LANG_HOOKS_FUNCTION_ENTER_NESTED, \
! LANG_HOOKS_FUNCTION_LEAVE_NESTED, \
! LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P \
}
#define LANG_HOOKS_RTL_EXPAND_INITIALIZER { \
Index: langhooks.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks.h,v
retrieving revision 1.42.2.29
diff -c -p -d -r1.42.2.29 langhooks.h
*** langhooks.h 6 Feb 2004 15:20:29 -0000 1.42.2.29
--- langhooks.h 10 Feb 2004 00:37:47 -0000
*************** struct lang_hooks_for_functions
*** 76,81 ****
--- 76,84 ----
/* Called when leaving a nested function. */
void (*leave_nested) (struct function *);
+
+ /* Determines if it's ok for a function to have no noreturn attribute. */
+ bool (*missing_noreturn_ok_p) (tree);
};
/* Lang hooks for rtl code generation. */
Index: output.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/output.h,v
retrieving revision 1.107.2.21
diff -c -p -d -r1.107.2.21 output.h
*** output.h 9 Feb 2004 02:03:46 -0000 1.107.2.21
--- output.h 10 Feb 2004 00:37:47 -0000
*************** extern int add_weak (tree, const char *,
*** 151,157 ****
/* Functions in flow.c */
extern void allocate_for_life_analysis (void);
extern int regno_clobbered_at_setjmp (int);
- extern void check_function_return_warnings (void);
/* Functions in varasm.c. */
--- 151,156 ----
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.654.2.94
diff -c -p -d -r1.654.2.94 toplev.c
*** toplev.c 9 Feb 2004 02:03:47 -0000 1.654.2.94
--- toplev.c 10 Feb 2004 00:37:48 -0000
*************** rest_of_compilation (tree decl)
*** 3229,3242 ****
if (cfun->tail_call_emit)
fixup_tail_calls ();
- /* We have to issue these warnings now already, because CFG cleanups
- further down may destroy the required information. However, this
- must be done after the sibcall optimization pass because the barrier
- emitted for noreturn calls that are candidate for the optimization
- is folded into the CALL_PLACEHOLDER until after this pass, so the
- CFG is inaccurate. */
- check_function_return_warnings ();
-
insn_locators_initialize ();
/* Complete generation of exception handling code. */
if (doing_eh (0))
--- 3229,3234 ----
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-cfg.c,v
retrieving revision 1.1.4.264
diff -c -p -d -r1.1.4.264 tree-cfg.c
*** tree-cfg.c 4 Feb 2004 06:08:20 -0000 1.1.4.264
--- tree-cfg.c 10 Feb 2004 00:37:48 -0000
*************** struct tree_opt_pass pass_split_crit_edg
*** 3975,3979 ****
0, /* todo_flags_start */
0, /* todo_flags_finish */
};
!
#include "gt-tree-cfg.h"
--- 3975,4048 ----
0, /* todo_flags_start */
0, /* todo_flags_finish */
};
!
! static void
! execute_warn_function_return (void)
! {
! location_t *locus;
! tree last;
! edge e;
!
! if (warn_missing_noreturn
! && !TREE_THIS_VOLATILE (cfun->decl)
! && EXIT_BLOCK_PTR->pred == NULL
! && !lang_hooks.function.missing_noreturn_ok_p (cfun->decl))
! warning ("%Jfunction might be possible candidate for attribute `noreturn'",
! cfun->decl);
!
! /* If we have a path to EXIT, then we do return. */
! if (TREE_THIS_VOLATILE (cfun->decl)
! && EXIT_BLOCK_PTR->pred != NULL)
! {
! locus = NULL;
! for (e = EXIT_BLOCK_PTR->pred; e ; e = e->pred_next)
! {
! last = last_stmt (e->src);
! if (TREE_CODE (last) == RETURN_EXPR
! && (locus = EXPR_LOCUS (last)) != NULL)
! break;
! }
! if (!locus)
! locus = &cfun->function_end_locus;
! warning ("%H`noreturn' function does return", locus);
! }
!
! /* If we see "return;" in some basic block, then we do reach the end
! without returning a value. */
! else if (warn_return_type
! && EXIT_BLOCK_PTR->pred != NULL
! && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (cfun->decl))))
! {
! for (e = EXIT_BLOCK_PTR->pred; e ; e = e->pred_next)
! {
! tree last = last_stmt (e->src);
! if (TREE_CODE (last) == RETURN_EXPR
! && TREE_OPERAND (last, 0) == NULL)
! {
! locus = EXPR_LOCUS (last);
! if (!locus)
! locus = &cfun->function_end_locus;
! warning ("%Hcontrol reaches end of non-void function", locus);
! break;
! }
! }
! }
! }
!
! struct tree_opt_pass pass_warn_function_return =
! {
! NULL, /* name */
! NULL, /* gate */
! execute_warn_function_return, /* execute */
! NULL, /* sub */
! NULL, /* next */
! 0, /* static_pass_number */
! 0, /* tv_id */
! PROP_ssa, /* properties_required */
! 0, /* properties_provided */
! 0, /* properties_destroyed */
! 0, /* todo_flags_start */
! 0 /* todo_flags_finish */
! };
!
#include "gt-tree-cfg.h"
Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v
retrieving revision 1.1.4.116
diff -c -p -d -r1.1.4.116 tree-optimize.c
*** tree-optimize.c 9 Feb 2004 02:03:47 -0000 1.1.4.116
--- tree-optimize.c 10 Feb 2004 00:37:48 -0000
*************** init_tree_optimization_passes (void)
*** 300,305 ****
--- 300,306 ----
NEXT_PASS (pass_cd_dce);
NEXT_PASS (pass_tail_calls);
NEXT_PASS (pass_late_warn_uninitialized);
+ NEXT_PASS (pass_warn_function_return);
NEXT_PASS (pass_del_ssa);
NEXT_PASS (pass_del_cfg);
*p = NULL;
Index: tree-pass.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-pass.h,v
retrieving revision 1.1.2.7
diff -c -p -d -r1.1.2.7 tree-pass.h
*** tree-pass.h 9 Feb 2004 02:03:48 -0000 1.1.2.7
--- tree-pass.h 10 Feb 2004 00:37:48 -0000
*************** extern struct tree_opt_pass pass_lower_c
*** 116,121 ****
--- 116,122 ----
extern struct tree_opt_pass pass_fold_builtins;
extern struct tree_opt_pass pass_early_warn_uninitialized;
extern struct tree_opt_pass pass_late_warn_uninitialized;
+ extern struct tree_opt_pass pass_warn_function_return;
#endif /* GCC_TREE_PASS_H */
Index: cp/cp-lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-lang.c,v
retrieving revision 1.36.2.29
diff -c -p -d -r1.36.2.29 cp-lang.c
*** cp/cp-lang.c 6 Feb 2004 15:20:30 -0000 1.36.2.29
--- cp/cp-lang.c 10 Feb 2004 00:37:48 -0000
*************** static void cxx_initialize_diagnostics (
*** 113,123 ****
#undef LANG_HOOKS_WRITE_GLOBALS
#define LANG_HOOKS_WRITE_GLOBALS lhd_do_nothing
-
#undef LANG_HOOKS_FUNCTION_INIT
#define LANG_HOOKS_FUNCTION_INIT cxx_push_function_context
#undef LANG_HOOKS_FUNCTION_FINAL
#define LANG_HOOKS_FUNCTION_FINAL cxx_pop_function_context
#undef LANG_HOOKS_RTL_EXPAND_START
#define LANG_HOOKS_RTL_EXPAND_START cxx_expand_function_start
--- 113,124 ----
#undef LANG_HOOKS_WRITE_GLOBALS
#define LANG_HOOKS_WRITE_GLOBALS lhd_do_nothing
#undef LANG_HOOKS_FUNCTION_INIT
#define LANG_HOOKS_FUNCTION_INIT cxx_push_function_context
#undef LANG_HOOKS_FUNCTION_FINAL
#define LANG_HOOKS_FUNCTION_FINAL cxx_pop_function_context
+ #undef LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P
+ #define LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P cp_missing_noreturn_ok_p
#undef LANG_HOOKS_RTL_EXPAND_START
#define LANG_HOOKS_RTL_EXPAND_START cxx_expand_function_start
Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.719.2.49
diff -c -p -d -r1.719.2.49 cp-tree.h
*** cp/cp-tree.h 30 Jan 2004 13:16:15 -0000 1.719.2.49
--- cp/cp-tree.h 10 Feb 2004 00:37:48 -0000
*************** extern tree cp_fname_init (const char
*** 3706,3711 ****
--- 3706,3712 ----
extern tree check_elaborated_type_specifier (enum tag_types, tree, bool);
extern tree cxx_builtin_type_decls (void);
extern void warn_extern_redeclared_static (tree, tree);
+ extern bool cp_missing_noreturn_ok_p (tree);
extern bool have_extern_spec;
extern GTY(()) tree last_function_parms;
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.911.2.60
diff -c -p -d -r1.911.2.60 decl.c
*** cp/decl.c 30 Jan 2004 13:16:16 -0000 1.911.2.60
--- cp/decl.c 10 Feb 2004 00:37:49 -0000
*************** static tree check_special_function_retur
*** 115,121 ****
static tree push_cp_library_fn (enum tree_code, tree);
static tree build_cp_library_fn (tree, enum tree_code, tree);
static void store_parm_decls (tree);
- static int cp_missing_noreturn_ok_p (tree);
static void initialize_local_var (tree, tree);
static void expand_static_init (tree, tree);
static tree next_initializable_field (tree);
--- 115,120 ----
*************** cxx_init_decl_processing (void)
*** 2929,2937 ****
/* Create all the identifiers we need. */
initialize_predefined_identifiers ();
- /* Fill in back-end hooks. */
- lang_missing_noreturn_ok_p = &cp_missing_noreturn_ok_p;
-
/* Create the global variables. */
push_to_top_level ();
--- 2928,2933 ----
*************** build_void_list_node (void)
*** 11273,11279 ****
return t;
}
! static int
cp_missing_noreturn_ok_p (tree decl)
{
/* A missing noreturn is ok for the `main' function. */
--- 11269,11275 ----
return t;
}
! bool
cp_missing_noreturn_ok_p (tree decl)
{
/* A missing noreturn is ok for the `main' function. */
Index: objc/objc-lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/objc/objc-lang.c,v
retrieving revision 1.24.2.14
diff -c -p -d -r1.24.2.14 objc-lang.c
*** objc/objc-lang.c 6 Feb 2004 15:20:30 -0000 1.24.2.14
--- objc/objc-lang.c 10 Feb 2004 00:37:49 -0000
*************** enum c_language_kind c_language = clk_ob
*** 86,91 ****
--- 86,93 ----
#define LANG_HOOKS_FUNCTION_ENTER_NESTED c_push_function_context
#undef LANG_HOOKS_FUNCTION_LEAVE_NESTED
#define LANG_HOOKS_FUNCTION_LEAVE_NESTED c_pop_function_context
+ #undef LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P
+ #define LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P c_missing_noreturn_ok_p
#undef LANG_HOOKS_RTL_EXPAND_STMT
#define LANG_HOOKS_RTL_EXPAND_STMT expand_stmt_toplev
Index: testsuite/gcc.dg/noreturn-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/noreturn-1.c,v
retrieving revision 1.7.28.4
diff -c -p -d -r1.7.28.4 noreturn-1.c
*** testsuite/gcc.dg/noreturn-1.c 16 Oct 2003 18:15:09 -0000 1.7.28.4
--- testsuite/gcc.dg/noreturn-1.c 10 Feb 2004 00:37:49 -0000
*************** foo3(void)
*** 26,41 ****
extern void foo4(void);
void
foo4(void)
! {
exit(0);
! } /* { dg-warning "candidate for attribute `noreturn'" "detect noreturn candidate" } */
extern void foo5(void) __attribute__ ((__noreturn__));
void
foo5(void)
{
return; /* { dg-warning "`noreturn' has a `return' statement" "detect invalid return" } */
! } /* { dg-warning "`noreturn' function does return" "detect return from noreturn" } */
extern void foo6(void);
void
--- 26,42 ----
extern void foo4(void);
void
foo4(void)
! { /* { dg-warning "candidate for attribute `noreturn'" "detect noreturn candidate" } */
exit(0);
! }
extern void foo5(void) __attribute__ ((__noreturn__));
void
foo5(void)
{
return; /* { dg-warning "`noreturn' has a `return' statement" "detect invalid return" } */
! }
! /* { dg-warning "function does return" "detect return from noreturn" { target *-*-* } 37 } */
extern void foo6(void);
void
Index: testsuite/gcc.dg/noreturn-4.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/noreturn-4.c,v
retrieving revision 1.1.26.2
diff -c -p -d -r1.1.26.2 noreturn-4.c
*** testsuite/gcc.dg/noreturn-4.c 11 Mar 2003 00:15:13 -0000 1.1.26.2
--- testsuite/gcc.dg/noreturn-4.c 10 Feb 2004 00:37:49 -0000
*************** extern void exit (int) __attribute__ ((_
*** 5,10 ****
int
main (void)
! {
exit (0);
! } /* { dg-warning "warning: function might be possible candidate for attribute `noreturn'" "warn for main" } */
--- 5,10 ----
int
main (void)
! { /* { dg-warning "warning: function might be possible candidate for attribute `noreturn'" "warn for main" } */
exit (0);
! }
Index: testsuite/gcc.dg/noreturn-7.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/noreturn-7.c,v
retrieving revision 1.1.8.1
diff -c -p -d -r1.1.8.1 noreturn-7.c
*** testsuite/gcc.dg/noreturn-7.c 3 Jan 2004 23:03:45 -0000 1.1.8.1
--- testsuite/gcc.dg/noreturn-7.c 10 Feb 2004 00:37:49 -0000
*************** void _exit(int status) __attribute__ ((_
*** 14,24 ****
int z = 0;
void g()
! {
if (++z > 10)
_exit(0);
g();
! } /* { dg-warning "possible candidate" } */
void f()
{
--- 14,24 ----
int z = 0;
void g()
! { /* { dg-warning "possible candidate" } */
if (++z > 10)
_exit(0);
g();
! }
void f()
{
*************** void f()
*** 28,42 ****
} /* { dg-bogus "does return" } */
int h()
! {
if (++z > 10)
_exit(0);
return h();
} /* { dg-bogus "end of non-void function" } */
int k()
! {
if (++z > 10)
_exit(0);
k();
! } /* { dg-warning "end of non-void function" } */
--- 28,42 ----
} /* { dg-bogus "does return" } */
int h()
! { /* { dg-warning "possible candidate" } */
if (++z > 10)
_exit(0);
return h();
} /* { dg-bogus "end of non-void function" } */
int k()
! { /* { dg-warning "possible candidate" } */
if (++z > 10)
_exit(0);
k();
! }
Index: testsuite/gcc.dg/return-type-3.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/return-type-3.c,v
retrieving revision 1.1.8.1
diff -c -p -d -r1.1.8.1 return-type-3.c
*** testsuite/gcc.dg/return-type-3.c 9 Apr 2003 19:28:58 -0000 1.1.8.1
--- testsuite/gcc.dg/return-type-3.c 10 Feb 2004 00:37:49 -0000
***************
*** 3,9 ****
call optimization. The return clobber insn was cleaned up and
the warning was never issued. */
/* { dg-do compile } */
! /* { dg-options "-foptimize-sibling-calls -Wreturn-type" } */
extern void foo(void);
--- 3,9 ----
call optimization. The return clobber insn was cleaned up and
the warning was never issued. */
/* { dg-do compile } */
! /* { dg-options "-O -foptimize-sibling-calls -Wreturn-type" } */
extern void foo(void);
Index: testsuite/gcc.dg/uninit-6.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/uninit-6.c,v
retrieving revision 1.2
diff -c -p -d -r1.2 uninit-6.c
*** testsuite/gcc.dg/uninit-6.c 4 Sep 1999 15:09:14 -0000 1.2
--- testsuite/gcc.dg/uninit-6.c 10 Feb 2004 00:37:49 -0000
*************** struct tree *
*** 34,45 ****
make_something(int a, int b, int c)
{
struct tree *rv;
! struct tree *field; /* { dg-bogus "field" "uninitialized variable warning" { xfail *-*-* } } */
rv = malloc (sizeof (struct tree));
rv->car = 0;
! APPEND(rv, field, INTEGER_T, a);
APPEND(rv, field, PTR_T, b);
APPEND(rv, field, INTEGER_T, c);
--- 34,45 ----
make_something(int a, int b, int c)
{
struct tree *rv;
! struct tree *field;
rv = malloc (sizeof (struct tree));
rv->car = 0;
! APPEND(rv, field, INTEGER_T, a); /* { dg-bogus "field" "uninitialized variable warning" { xfail *-*-* } } */
APPEND(rv, field, PTR_T, b);
APPEND(rv, field, INTEGER_T, c);
Index: testsuite/gcc.dg/uninit-8.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/uninit-8.c,v
retrieving revision 1.2.36.1
diff -c -p -d -r1.2.36.1 uninit-8.c
*** testsuite/gcc.dg/uninit-8.c 18 Jan 2004 07:18:38 -0000 1.2.36.1
--- testsuite/gcc.dg/uninit-8.c 10 Feb 2004 00:37:49 -0000
*************** void
*** 11,17 ****
add_bignums (int *out, int *x, int *y)
{
int p, sum;
! int carry; /* { dg-bogus "carry" "uninitialized variable warning" } */
p = 0;
for (; *x; x++, y++, out++, p++)
--- 11,17 ----
add_bignums (int *out, int *x, int *y)
{
int p, sum;
! int carry; /* { dg-bogus "carry" "uninitialized variable warning" { xfail *-*-* } } */
p = 0;
for (; *x; x++, y++, out++, p++)