aboutsummaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@gcc.gnu.org>2003-08-19 13:29:01 -0700
committerAndrew Pinski <pinskia@gcc.gnu.org>2003-08-19 13:29:01 -0700
commit3390f9c9bef0be9e00dd389991d649abb36ab020 (patch)
treead286296a88a627c032b917d2d413f56d8875840 /gcc/function.c
parent02a2edc088afbf09c3c82f5e9d37b58b7155a0ad (diff)
downloadgcc-3390f9c9bef0be9e00dd389991d649abb36ab020.zip
gcc-3390f9c9bef0be9e00dd389991d649abb36ab020.tar.gz
gcc-3390f9c9bef0be9e00dd389991d649abb36ab020.tar.bz2
PR c++/10538, PR c/5582
ChangeLog: * langhooks-def.h (lhd_decl_uninit): Declare. (LANG_HOOKS_DECL_UNINIT): New macro. (LANG_HOOKS_INITIALIZER): Adjust. * langhooks.h (struct lang_hooks): Add new field decl_uninit. * langhooks.c (lhd_decl_uninit): Define. * c-common.c (c_decl_uninit_1): New function. (c_decl_uninit): New function. (warn_init_self): Define. * c-common.h (c_decl_uninit): Declare. (warn_init_self): Declare. * c.opt: Introduce -Winit-self. * c-opts.c (c_common_handle_options): Set warn_init_self. * c-lang.c (LANG_HOOKS_DECL_UNINIT): Define. * objc/objc-lang.c (LANG_HOOKS_DECL_UNINIT): Define. * function.c (uninitialized_vars_warning): Call the language hook. * doc/invoke.texi: Document -Winit-self. cp/ChangeLog: * cp/cp-lang.c (LANG_HOOKS_DECL_UNINIT): Define. testsuite: * gcc.dg/uninit-D.c: New Test. * gcc.dg/uninit-E.c: New Test. * gcc.dg/uninit-F.c: New Test. * gcc.dg/uninit-G.c: New Test. From-SVN: r70574
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/function.c b/gcc/function.c
index 84c1e6f..fd7c7f7 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5564,9 +5564,9 @@ uninitialized_vars_warning (tree block)
with a nonzero DECL_INITIAL had an initializer, so do not
claim it is potentially uninitialized.
- We do not care about the actual value in DECL_INITIAL, so we do
- not worry that it may be a dangling pointer. */
- && DECL_INITIAL (decl) == NULL_TREE
+ When the DECL_INITIAL is NULL call the language hook to tell us
+ if we want to warn. */
+ && (DECL_INITIAL (decl) == NULL_TREE || lang_hooks.decl_uninit (decl))
&& regno_uninitialized (REGNO (DECL_RTL (decl))))
warning ("%H'%D' might be used uninitialized in this function",
&DECL_SOURCE_LOCATION (decl), decl);