diff options
author | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-08-19 20:29:01 +0000 |
---|---|---|
committer | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-08-19 20:29:01 +0000 |
commit | 0cb502930fc1b511dd1acab155ef5b0291d7edef (patch) | |
tree | ad286296a88a627c032b917d2d413f56d8875840 /gcc/function.c | |
parent | ac9b19aaa4d30842172a28c02ee38ec006d56e56 (diff) | |
download | gcc-0cb502930fc1b511dd1acab155ef5b0291d7edef.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@70574 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/function.c')
-rw-r--r-- | gcc/function.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/function.c b/gcc/function.c index 84c1e6fcc44..fd7c7f79350 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); |