diff options
author | Tom Tromey <tromey@redhat.com> | 2007-11-06 15:57:02 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2007-11-06 15:57:02 +0000 |
commit | 38d346765a731bd88dcda419cc2a247485f49507 (patch) | |
tree | 16730e771eacc9991f800037794eaf32f3a28735 /gcc/function.c | |
parent | 9ae165a0722366ba1ee877d1099d147a506d0135 (diff) | |
download | gcc-38d346765a731bd88dcda419cc2a247485f49507.zip gcc-38d346765a731bd88dcda419cc2a247485f49507.tar.gz gcc-38d346765a731bd88dcda419cc2a247485f49507.tar.bz2 |
PR c++/32256, PR c++/32368:
gcc
PR c++/32256, PR c++/32368:
* function.c (saved_in_system_header): New global.
(push_cfun): Save in_system_header.
(pop_cfun): Restore in_system_header.
(push_struct_function): Save in_system_header.
gcc/testsuite
PR c++/32368:
* g++.dg/warn/pragma-system_header3.h: New.
* g++.dg/warn/pragma-system_header3.C: New.
PR c++/32256:
* g++.dg/warn/pragma-system_header4.C: New.
* g++.dg/warn/pragma-system_header4.h: New.
From-SVN: r129936
Diffstat (limited to 'gcc/function.c')
-rw-r--r-- | gcc/function.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gcc/function.c b/gcc/function.c index 05bbd64..56abe4d 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -3834,12 +3834,22 @@ DEF_VEC_ALLOC_P(function_p,heap); static VEC(function_p,heap) *cfun_stack; +/* We save the value of in_system_header here when pushing the first + function on the cfun stack, and we restore it from here when + popping the last function. */ + +static bool saved_in_system_header; + /* Push the current cfun onto the stack, and set cfun to new_cfun. */ void push_cfun (struct function *new_cfun) { + if (cfun == NULL) + saved_in_system_header = in_system_header; VEC_safe_push (function_p, heap, cfun_stack, cfun); + if (new_cfun) + in_system_header = DECL_IN_SYSTEM_HEADER (new_cfun->decl); set_cfun (new_cfun); } @@ -3848,7 +3858,10 @@ push_cfun (struct function *new_cfun) void pop_cfun (void) { - set_cfun (VEC_pop (function_p, cfun_stack)); + struct function *new_cfun = VEC_pop (function_p, cfun_stack); + in_system_header = ((new_cfun == NULL) ? saved_in_system_header + : DECL_IN_SYSTEM_HEADER (new_cfun->decl)); + set_cfun (new_cfun); } /* Return value of funcdef and increase it. */ @@ -3922,7 +3935,11 @@ allocate_struct_function (tree fndecl) void push_struct_function (tree fndecl) { + if (cfun == NULL) + saved_in_system_header = in_system_header; VEC_safe_push (function_p, heap, cfun_stack, cfun); + if (fndecl) + in_system_header = DECL_IN_SYSTEM_HEADER (fndecl); allocate_struct_function (fndecl); } |